{% extends base_template %}
{% load compressed djblets_js %}

{% block review_ui_css %}
{%  for bundle_name in review_ui.css_bundle_names %}
{%   compressed_css bundle_name %}
{%  endfor %}
{% endblock %}

{% block review_ui_scripts %}
{%  for bundle_name in review_ui.js_bundle_names %}
{%   compressed_js bundle_name %}
{%  endfor %}
{%  for js_file in review_ui.js_files %}
<script src="{{js_file}}"></script>
{%  endfor %}

<script>
    $(document).ready(function() {
        RB.PageManager.ready(function(page) {
{%  block review_ui_setup %}
            var view = new {{review_ui.js_view_class}}({
{%   block review_ui_view_params %}{% endblock %}
{%   for key, value in review_ui.get_js_view_data.items %}
                {{key|json_dumps}}: {{value|json_dumps}},
{%   endfor %}
                renderedInline: {{review_ui_inline|yesno:'true,false'}},
                model: new {{review_ui.js_model_class}}({
{%   for key, value in review_ui.get_js_model_data.items %}
                    {{key|json_dumps}}: {{value|json_dumps}},
{%   endfor %}
                    caption: '{{caption|escapejs}}',
                    reviewRequest: page.reviewRequest,
                    serializedCommentBlocks: {{review_ui.get_comments_json}}
                })
            });

{%   block review_ui_render %}
            $('#review_ui_{{review_ui_uuid}}').append(view.$el);
            view.render();
{%   endblock %}
{%  endblock %}
        });
    });
</script>
{% endblock %}

{% block review_ui_box_content %}
<div id="review_ui_{{review_ui_uuid}}">
{%  block review_ui_box_content_inner %}{% endblock %}
</div>
{% endblock %}
