course-outline.underscore 8.36 KB
Newer Older
1 2
<%
var releasedToStudents = xblockInfo.get('released_to_students');
3
var visibilityState = xblockInfo.get('visibility_state');
4
var published = xblockInfo.get('published');
5 6 7

var statusMessage = null;
var statusType = null;
8
if (staffOnlyMessage) {
9
    statusType = 'staff-only';
10
    statusMessage = gettext('Contains staff only content');
11
} else if (visibilityState === 'needs_attention') {
12
    if (xblockInfo.isVertical()) {
13
        statusType = 'warning';
14 15
        if (published && releasedToStudents) {
            statusMessage = gettext('Unpublished changes to live content');
16
        } else if (!published) {
17
            statusMessage = gettext('Unpublished units will not be released');
18 19
        } else {
            statusMessage = gettext('Unpublished changes to content that will release in the future');
20 21 22 23 24 25 26 27 28 29 30 31
        }
    }
}

var statusIconClass = '';
if (statusType === 'warning') {
    statusIconClass = 'icon-file-alt';
} else if (statusType === 'error') {
    statusIconClass = 'icon-warning-sign';
} else if (statusType === 'staff-only') {
    statusIconClass = 'icon-lock';
}
32 33 34 35 36

var gradingType = gettext('Not Graded');
if (xblockInfo.get('graded')) {
    gradingType = xblockInfo.get('format')
}
37
%>
38
<% if (parentInfo) { %>
39
<li class="outline-item outline-<%= xblockType %> <%= visibilityClass %> is-draggable <%= includesChildren ? 'is-collapsible' : '' %> <%= isCollapsed ? 'is-collapsed' : '' %>"
40 41
    data-parent="<%= parentInfo.get('id') %>" data-locator="<%= xblockInfo.get('id') %>">

42 43
    <span class="draggable-drop-indicator draggable-drop-indicator-before"><i class="icon-caret-right"></i></span>

44 45
    <div class="<%= xblockType %>-header">
        <% if (includesChildren) { %>
46 47
            <h3 class="<%= xblockType %>-header-details expand-collapse <%= isCollapsed ? 'expand' : 'collapse' %> ui-toggle-expansion"
                title="<%= interpolate(gettext('Collapse/Expand this %(xblock_type)s'), { xblock_type: xblockTypeDisplayName }, true) %>">
48 49 50 51
                <i class="icon-caret-down icon"></i>
        <% } else { %>
            <h3 class="<%= xblockType %>-header-details">
        <% } %>
52
                <% if (xblockInfo.isVertical()) { %>
53 54 55
                    <span class="unit-title item-title">
                        <a href="<%= xblockInfo.get('studio_url') %>"><%= xblockInfo.get('display_name') %></a>
                    </span>
56
                <% } else { %>
57 58
                    <span class="wrapper-<%= xblockType %>-title wrapper-xblock-field incontext-editor is-editable" data-field="display_name" data-field-display-name="<%= gettext("Display Name") %>">
                        <span class="<%= xblockType %>-title item-title xblock-field-value incontext-editor-value"><%= xblockInfo.get('display_name') %></span>
59 60 61 62
                    </span>
                <% } %>
            </h3>

63 64
        <div class="<%= xblockType %>-header-actions">
            <ul class="actions-list">
65 66 67 68 69 70 71 72
                <% if (xblockInfo.isPublishable()) { %>
                    <li class="action-item action-publish">
                        <a href="#" data-tooltip="<%= gettext('Publish') %>" class="publish-button action-button">
                            <i class="icon icon-upload-alt"></i>
                            <span class="sr action-button-text"><%= gettext('Publish') %></span>
                        </a>
                    </li>
                <% } %>
73 74 75 76 77 78 79 80
                <% if (xblockInfo.isEditableOnCourseOutline()) { %>
                    <li class="action-item action-configure">
                        <a href="#" data-tooltip="<%= gettext('Configure') %>" class="configure-button action-button">
                            <i class="icon-gear"></i>
                            <span class="sr action-button-text"><%= gettext('Configure') %></span>
                        </a>
                    </li>
                <% } %>
81 82 83 84 85 86
                <li class="action-item action-delete">
                    <a href="#" data-tooltip="<%= gettext('Delete') %>" class="delete-button action-button">
                        <i class="icon icon-trash"></i>
                        <span class="sr action-button-text"><%= gettext('Delete') %></span>
                    </a>
                </li>
87 88 89 90 91 92
                <li class="action-item action-drag">
                    <span data-tooltip="<%= gettext('Drag to reorder') %>"
                          class="drag-handle <%= xblockType %>-drag-handle action">
                        <span class="sr"><%= gettext('Drag to reorder') %></span>
                    </span>
                </li>
93
            </ul>
94
        </div>
95
    </div>
96
    <div class="<%= xblockType %>-status">
97
        <% if (!xblockInfo.isVertical()) { %>
98 99
            <div class="status-release">
                <p>
100
                    <span class="sr status-release-label"><%= gettext('Release Status:') %></span>
101 102 103 104 105 106 107 108
                    <span class="status-release-value">
                        <% if (xblockInfo.get('released_to_students')) { %>
                            <i class="icon icon-check-sign"></i>
                            <%= gettext('Released:') %>
                        <% } else if (xblockInfo.get('release_date')) { %>
                            <i class="icon icon-time"></i>
                            <%= gettext('Scheduled:') %>
                        <% } else { %>
109
                            <i class="icon icon-time"></i>
110 111 112 113 114 115 116
                            <%= gettext('Unscheduled') %>
                        <% } %>
                        <% if (xblockInfo.get('release_date')) { %>
                            <%= xblockInfo.get('release_date') %>
                        <% } %>
                    </span>
                </p>
117
            </div>
118 119 120 121 122
            <% if (xblockInfo.get('due_date') || xblockInfo.get('graded')) { %>
                <div class="status-grading">
                    <p>
                        <span class="sr status-grading-label"> <%= gettext('Graded as:') %> </span>
                        <i class="icon icon-ok"></i>
123
                        <span class="status-grading-value"> <%= gradingType %> </span>
124 125 126 127 128 129
                        <% if (xblockInfo.get('due_date')) { %>
                            <span class="status-grading-date"> <%= gettext('Due:') %> <%= xblockInfo.get('due_date') %> </span>
                        <% } %>
                    </p>
                </div>
            <% } %>
130 131 132 133 134 135
        <% } %>

        <% if (statusMessage) { %>
        <div class="status-message">
            <i class="icon <%= statusIconClass %>"></i>
            <p class="status-message-copy"><%- statusMessage %></p>
136
        </div>
137 138
        <% } %>
    </div>
139 140 141
<% } %>

    <% if (!parentInfo && xblockInfo.get('child_info') && xblockInfo.get('child_info').children.length === 0) { %>
142
        <div class="no-content add-section">
143
            <p><%= gettext("You haven't added any content to this course yet.") %>
144
                <a href="#" class="button button-new" data-category="<%= childCategory %>"
145 146
                   data-parent="<%= xblockInfo.get('id') %>" data-default-name="<%= defaultNewChildName %>"
                   title="<%= interpolate(gettext('Click to add a new %(xblock_type)s'), { xblock_type: defaultNewChildName }, true) %>" >
147
                    <i class="icon-plus"></i><%= addChildLabel %>
148 149 150
                </a>
            </p>
        </div>
151
    <% } else if (!xblockInfo.isVertical()) { %>
152
        <div class="outline-content <%= xblockType %>-content">
153
            <ol class="<%= typeListClass %> is-sortable">
154 155 156
                <li class="ui-splint ui-splint-indicator">
                    <span class="draggable-drop-indicator draggable-drop-indicator-initial"><i class="icon-caret-right"></i></span>
                </li>
157
            </ol>
158

159 160 161
            <% if (childType) { %>
                <div class="add-<%= childType %> add-item">
                    <a href="#" class="button button-new" data-category="<%= childCategory %>"
162 163
                       data-parent="<%= xblockInfo.get('id') %>" data-default-name="<%= defaultNewChildName %>"
                       title="<%= interpolate(gettext('Click to add a new %(xblock_type)s'), { xblock_type: defaultNewChildName }, true) %>" >
164 165 166 167 168
                        <i class="icon icon-plus"></i><%= addChildLabel %>
                    </a>
                </div>
            <% } %>
        </div>
169 170 171
    <% } %>

<% if (parentInfo) { %>
172
    <span class="draggable-drop-indicator draggable-drop-indicator-after"><i class="icon-caret-right"></i></span>
173 174
</li>
<% } %>