container.html 7.42 KB
Newer Older
1
<%inherit file="base.html" />
2 3 4 5 6 7 8 9
<%def name="online_help_token()">
<%
if is_unit_page:
    return "unit"
else:
    return "container"
%>
</%def>
10 11 12
<%!
import json

13
from xmodule.modulestore import PublishState
14
from contentstore.views.helpers import xblock_studio_url, xblock_type_display_name
15 16
from django.utils.translation import ugettext as _
%>
17
<%block name="title">${xblock.display_name_with_default} ${xblock_type_display_name(xblock)}</%block>
18 19 20 21 22
<%block name="bodyclass">is-signedin course container view-container</%block>

<%namespace name='static' file='static_content.html'/>
<%namespace name="units" file="widgets/units.html" />

23 24 25 26
<%!
templates = ["basic-modal", "modal-button", "edit-xblock-modal",
    "editor-mode-button", "upload-dialog", "image-modal",
    "add-xblock-component", "add-xblock-component-button", "add-xblock-component-menu",
27 28
    "add-xblock-component-menu-problem", "xblock-string-field-editor", "publish-xblock", "publish-history",
    "unit-outline"]
29
%>
30
<%block name="header_extras">
31
% for template_name in templates:
32 33 34 35
<script type="text/template" id="${template_name}-tpl">
    <%static:include path="js/${template_name}.underscore" />
</script>
% endfor
36
<link rel="stylesheet" type="text/css" href="${static.url('js/vendor/timepicker/jquery.timepicker.css')}" />
37 38
</%block>

39 40
<%block name="jsextra">
<script type='text/javascript'>
41
    require(["domReady!", "jquery", "js/models/xblock_info", "js/views/pages/container",
42
        "js/collections/component_template", "xmodule", "coffee/src/main", "xblock/cms.runtime.v1"],
43
            function(doc, $, XBlockInfo, ContainerPage, ComponentTemplates, xmoduleLoader) {
44
                var templates = new ComponentTemplates(${component_templates | n}, {parse: true});
45
                var mainXBlockInfo = new XBlockInfo(${json.dumps(xblock_info) | n}, {parse: true});
46
                var isUnitPage = ${json.dumps(is_unit_page)}
47 48 49 50 51

                xmoduleLoader.done(function () {
                    var view = new ContainerPage({
                        el: $('#content'),
                        model: mainXBlockInfo,
52
                        action: "${action}",
53 54
                        templates: templates,
                        isUnitPage: isUnitPage
55 56
                    });
                    view.render();
57 58 59 60 61 62 63 64 65
                });
            });
</script>

</%block>

<%block name="content">


66
<div class="wrapper-mast wrapper">
67
    <header class="mast has-actions has-navigation has-subtitle">
68
        <div class="page-header">
69
            <small class="navigation navigation-parents subtitle">
cahrens committed
70
                % for ancestor in ancestor_xblocks:
71
                    <%
72
                    ancestor_url = xblock_studio_url(ancestor)
73
                    %>
cahrens committed
74
                    % if ancestor_url:
75
                        <a href="${ancestor_url}" class="navigation-item navigation-link navigation-parent">${ancestor.display_name_with_default | h}</a>
76 77
                    % else:
                        <span class="navigation-item navigation-parent">${ancestor.display_name_with_default | h}</span>
78 79
                    % endif
                % endfor
80
            </small>
81 82 83 84
            <div class="wrapper-xblock-field" data-field="display_name">
                <h1 class="page-header-title is-editable xblock-field-value">${xblock.display_name_with_default | h}</h1>
            </div>
        </div>
85 86 87 88

        <nav class="nav-actions">
            <h3 class="sr">${_("Page Actions")}</h3>
            <ul>
89 90
                % if is_unit_page:
                    <li class="action-item action-view nav-item">
91
                        <a href="${published_preview_link}" class="button button-view action-button is-disabled">
92 93 94 95
                            <span class="action-button-text">${_("View Published Version")}</span>
                        </a>
                    </li>
                    <li class="action-item action-preview nav-item">
96
                        <a href="${draft_preview_link}" class="button button-preview action-button is-disabled">
97 98 99 100 101
                            <span class="action-button-text">${_("Preview Changes")}</span>
                        </a>
                    </li>
                % else:
                    <li class="action-item action-edit nav-item">
102
                        <a href="#" class="button button-edit action-button edit-button">
103 104 105 106
                            <i class="icon-pencil"></i>
                            <span class="action-button-text">${_("Edit")}</span>
                        </a>
                    </li>
107
                % endif
108 109 110 111 112 113 114 115 116
            </ul>
        </nav>
    </header>
</div>

<div class="wrapper-content wrapper">
    <div class="inner-wrapper">
        <section class="content-area">

117
            <article class="content-primary">
118 119 120 121 122 123 124 125 126 127
                % if is_visible_to_students:
                    <div class="container-message wrapper-message">
                        <div class="message has-warnings">
                            <p class="warning">
                                <i class="icon-warning-sign"></i>
                                ${_("This content is live for students. Edit with caution.")}
                            </p>
                        </div>
                    </div>
                % endif
Calen Pennington committed
128
                <section class="wrapper-xblock level-page is-hidden studio-xblock-wrapper" data-locator="${xblock_locator}" data-course-key="${xblock_locator.course_key}">
129 130 131 132
                </section>
                <div class="ui-loading">
                    <p><span class="spin"><i class="icon-refresh"></i></span> <span class="copy">${_("Loading...")}</span></p>
                </div>
133 134
            </article>
            <aside class="content-supplementary" role="complimentary">
135 136 137 138 139 140
                % if not is_unit_page:
                    <div class="bit">
                        <h3 class="title-3">${_("What can I do on this page?")}</h3>
                        <ul class="list-details">
                            <li class="item-detail">${_("You can view and edit course components that contain other components on this page. In the case of experiment blocks, this allows you to confirm that you have properly configured your experiment groups and make changes to existing content.")}</li>
                        </ul>
141
                    </div>
142 143
                % endif
                % if is_unit_page:
144
                    <div id="publish-unit"></div>
145
                    <div id="publish-history" class="unit-publish-history"></div>
146 147 148
                    <div class="unit-location is-hidden">
                        <h4 class="bar-mod-title">${_("Unit Location")}</h4>
                        <div class="wrapper-unit-id bar-mod-content">
149 150 151 152 153 154
                            <h5 class="title">Unit Location ID</h5>
                            <p class="unit-id">
                                <span class="unit-id-value" id="unit-location-id-input">${unit.location.name}</span>
                                <span class="tip"><span class="sr">Tip: </span>${_("Use this ID to link to this unit from other places in your course")}</span>
                            </p>
                        </div>
155
                        <div class="wrapper-unit-tree-location bar-mod-content">
156
                            <h5 class="title">Unit Tree Location</h5>
157 158
                            <div class="wrapper-unit-overview">
                            </div>
159
                        </div>
160 161
                    </div>
                % endif
162 163 164 165 166
            </aside>
        </section>
    </div>
</div>
</%block>