Files
edx-platform/cms/templates/js/course-outline.underscore
2014-08-07 12:27:14 -04:00

134 lines
5.6 KiB
Plaintext

<%
var category = xblockInfo.get('category');
var releasedToStudents = xblockInfo.get('released_to_students');
var visibilityState = xblockInfo.get('visibility_state');
var listType = 'list-unknown';
if (xblockType === 'course') {
listType = 'list-sections';
} else if (xblockType === 'section') {
listType = 'list-subsections';
} else if (xblockType === 'subsection') {
listType = 'list-units';
}
var statusMessage = null;
var statusType = null;
if (visibilityState === 'staff_only') {
statusType = 'staff-only';
statusMessage = 'Contains staff only content';
} else if (visibilityState === 'needs_attention') {
if (category === 'vertical') {
statusType = 'warning';
if (releasedToStudents) {
statusMessage = 'Unpublished changes to live content';
} else {
statusMessage = 'Unpublished units will not be released';
}
}
}
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';
}
%>
<% if (parentInfo) { %>
<li class="outline-item outline-<%= xblockType %> <%= visibilityClass %> is-draggable <%= includesChildren ? 'is-collapsible' : '' %> <%= isCollapsed ? 'is-collapsed' : '' %>"
data-parent="<%= parentInfo.get('id') %>" data-locator="<%= xblockInfo.get('id') %>">
<div class="<%= xblockType %>-header">
<% if (includesChildren) { %>
<h3 class="<%= xblockType %>-header-details expand-collapse <%= isCollapsed ? 'expand' : 'collapse' %> ui-toggle-expansion" title="<%= gettext('Collapse/Expand this Checklist') %>">
<i class="icon-caret-down icon"></i>
<% } else { %>
<h3 class="<%= xblockType %>-header-details">
<% } %>
<% if (category === 'vertical') { %>
<span class="unit-title item-title">
<a href="<%= xblockInfo.get('studio_url') %>"><%= xblockInfo.get('display_name') %></a>
</span>
<% } else { %>
<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>
</span>
<% } %>
</h3>
<div class="<%= xblockType %>-header-actions">
<ul class="actions-list">
<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>
</ul>
</div>
</div>
<div class="<%= xblockType %>-status">
<% if (category !== 'vertical') { %>
<div class="status-release">
<p>
<span class="sr status-release-label">Release Status:</span>
<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 { %>
<i class="icon icon-file-alt"></i>
<%= gettext('Unscheduled') %>
<% } %>
<% if (xblockInfo.get('release_date')) { %>
<%= xblockInfo.get('release_date') %>
<% } %>
</span>
</p>
</div>
<% } %>
<% if (statusMessage) { %>
<div class="status-message">
<i class="icon <%= statusIconClass %>"></i>
<p class="status-message-copy"><%- statusMessage %></p>
</div>
<% } %>
</div>
<% } %>
<% if (!parentInfo && xblockInfo.get('child_info') && xblockInfo.get('child_info').children.length === 0) { %>
<div class="no-content add-section">
<p><%= gettext("You haven't added any content to this course yet.") %>
<a href="#" class="button button-new" data-category="<%= childCategory %>"
data-parent="<%= xblockInfo.get('id') %>" data-default-name="<%= defaultNewChildName %>">
<i class="icon icon-plus"></i><%= addChildLabel %>
</a>
</p>
</div>
<% } else { %>
<div class="outline-content <%= xblockType %>-content">
<ol class="<%= listType %> is-sortable">
</ol>
<% if (childType) { %>
<div class="add-<%= childType %> add-item">
<a href="#" class="button button-new" data-category="<%= childCategory %>"
data-parent="<%= xblockInfo.get('id') %>" data-default-name="<%= defaultNewChildName %>">
<i class="icon icon-plus"></i><%= addChildLabel %>
</a>
</div>
<% } %>
</div>
<% } %>
<% if (parentInfo) { %>
</li>
<% } %>