course-outline.underscore 8.51 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
        }
    }
}

var statusIconClass = '';
if (statusType === 'warning') {
26
    statusIconClass = 'fa-file-o';
27
} else if (statusType === 'error') {
28
    statusIconClass = 'fa-warning';
29
} else if (statusType === 'staff-only') {
30
    statusIconClass = 'fa-lock';
31
}
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
    <span class="draggable-drop-indicator draggable-drop-indicator-before"><i class="icon fa fa-caret-right"></i></span>
43

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

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

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

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

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