Files
edx-platform/cms/templates/widgets/units.html
Calen Pennington 0d88379eeb Make course ids and usage ids opaque to LMS and Studio [partial commit]
This commit adds all of cms.

These keys are now objects with a limited interface, and the particular
internal representation is managed by the data storage layer (the
modulestore).

For the LMS, there should be no outward-facing changes to the system.
The keys are, for now, a change to internal representation only. For
Studio, the new serialized form of the keys is used in urls, to allow
for further migration in the future.

Co-Author: Andy Armstrong <andya@edx.org>
Co-Author: Christina Roberts <christina@edx.org>
Co-Author: David Baumgold <db@edx.org>
Co-Author: Diana Huang <dkh@edx.org>
Co-Author: Don Mitchell <dmitchell@edx.org>
Co-Author: Julia Hansbrough <julia@edx.org>
Co-Author: Nimisha Asthagiri <nasthagiri@edx.org>
Co-Author: Sarina Canelake <sarina@edx.org>

[LMS-2370]
2014-05-07 12:56:43 -04:00

59 lines
2.1 KiB
HTML

<%! from django.utils.translation import ugettext as _ %>
<%! from contentstore.utils import compute_publish_state, reverse_usage_url %>
<!--
This def will enumerate through a passed in subsection and list all of the units
-->
<%def name="enum_units(subsection, actions=True, selected=None, sortable=True, subsection_units=None)">
<ol ${'class="sortable-unit-list"' if sortable else ''}>
<%
if subsection_units is None:
subsection_units = subsection.get_children()
%>
% for unit in subsection_units:
<li class="courseware-unit unit is-draggable" data-locator="${unit.location}"
data-parent="${subsection.location}" data-course-key="${unit.location.course_key}">
<%include file="_ui-dnd-indicator-before.html" />
<%
unit_state = compute_publish_state(unit)
if unit.location == selected:
selected_class = 'editing'
else:
selected_class = ''
%>
<div class="section-item ${selected_class}">
<a href="${reverse_usage_url('unit_handler', unit.location)}" class="${unit_state}-item">
<span class="unit-name">${unit.display_name_with_default}</span>
</a>
% if actions:
<div class="item-actions">
<ul class="actions-list">
<li class="actions-item delete">
<a href="#" data-tooltip="${_("Delete this unit")}" class="delete-unit-button action" data-locator="${unit.location}"><i class="icon-trash"></i><span class="sr">${_("Delete unit")}</span></a>
</li>
<li class="actions-item drag">
<span data-tooltip="${_("Drag to sort")}" class="drag-handle unit-drag-handle action"><span class="sr"> ${_("Drag to reorder unit")}</span></span>
</li>
</ul>
</div>
% endif
</div>
<%include file="_ui-dnd-indicator-after.html" />
</li>
% endfor
<li class="courseware-unit add-new-unit">
<%include file="_ui-dnd-indicator-initial.html" />
<a href="#" class="new-unit-item" data-category="${new_unit_category}" data-parent="${subsection.location}">
<i class="icon-plus"></i> ${_("New Unit")}
</a>
</li>
</ol>
</%def>