Commit 711dc55c by Chris Dodge

add subsection edit page to the project with a shared 'unit' widget that will…

add subsection edit page to the project with a shared 'unit' widget that will render out unit lists. Both edit_subsection and overview.html will share this widget
parent ca3aecd6
...@@ -144,7 +144,8 @@ def edit_subsection(request, location): ...@@ -144,7 +144,8 @@ def edit_subsection(request, location):
if item.location.category != 'sequential': if item.location.category != 'sequential':
return HttpResponseBadRequest return HttpResponseBadRequest
return render_to_response('edit_subsection.html', {}) return render_to_response('edit_subsection.html',
{'subsection':item})
@login_required @login_required
def edit_unit(request, location): def edit_unit(request, location):
......
...@@ -2,8 +2,10 @@ ...@@ -2,8 +2,10 @@
<%! from django.core.urlresolvers import reverse %> <%! from django.core.urlresolvers import reverse %>
<%block name="bodyclass">subsection</%block> <%block name="bodyclass">subsection</%block>
<%block name="title">CMS Subsection</%block> <%block name="title">CMS Subsection</%block>
<%block name="content">
<%namespace name="units" file="widgets/units.html" />
<%block name="content">
<div class="main-wrapper"> <div class="main-wrapper">
<div class="inner-wrapper"> <div class="inner-wrapper">
<div class="main-column"> <div class="main-column">
...@@ -18,63 +20,7 @@ ...@@ -18,63 +20,7 @@
</div> </div>
<div class="unit-list"> <div class="unit-list">
<label>Units:</label> <label>Units:</label>
<ol> ${units.enum_units(subsection)}
<li class="leaf">
<div class="section-item">
<a href="unit.html"><span class="video-icon"></span>Motivation for 6.002x</a>
<div class="item-actions">
<a href="#" class="edit-button"><span class="delete-icon"></span></a>
<a href="#" class="visibility-toggle"><span class="toggle-icon"></span></a>
<a href="#" class="drag-handle"></a>
</div>
</div>
</li>
<li class="leaf">
<div class="section-item">
<a href="unit.html"><span class="video-icon"></span>Administrivia</a>
<div class="item-actions">
<a href="#" class="edit-button"><span class="delete-icon"></span></a>
<a href="#" class="visibility-toggle"><span class="toggle-icon"></span></a>
<a href="#" class="drag-handle"></a>
</div>
</div>
</li>
<li class="leaf">
<div class="section-item">
<a href="unit.html"><span class="video-icon"></span>Course Overview</a>
<div class="item-actions">
<a href="#" class="edit-button"><span class="delete-icon"></span></a>
<a href="#" class="visibility-toggle"><span class="toggle-icon"></span></a>
<a href="#" class="drag-handle"></a>
</div>
</div>
</li>
<li class="leaf">
<div class="section-item">
<a href="unit.html"><span class="video-icon"></span>Lumped Element Abstraction</a>
<div class="item-actions">
<a href="#" class="edit-button"><span class="delete-icon"></span></a>
<a href="#" class="visibility-toggle"><span class="toggle-icon"></span></a>
<a href="#" class="drag-handle"></a>
</div>
</div>
</li>
<li class="leaf">
<div class="section-item">
<a href="unit.html"><span class="video-icon"></span>Simple Power</a>
<div class="item-actions">
<a href="#" class="edit-button"><span class="delete-icon"></span></a>
<a href="#" class="visibility-toggle"><span class="toggle-icon"></span></a>
<a href="#" class="drag-handle"></a>
</div>
</div>
</li>
<li>
<a href="unit.html" class="new-unit-item">
<span class="new-unit-icon"></span>New Unit
</a>
</li>
</ol>
</div> </div>
<div> <div>
<label>Policy:</label> <label>Policy:</label>
......
...@@ -2,6 +2,9 @@ ...@@ -2,6 +2,9 @@
<%! from django.core.urlresolvers import reverse %> <%! from django.core.urlresolvers import reverse %>
<%block name="title">CMS Courseware Overview</%block> <%block name="title">CMS Courseware Overview</%block>
<%namespace name="units" file="widgets/units.html" />
<%block name="content"> <%block name="content">
<div class="main-wrapper"> <div class="main-wrapper">
<div class="inner-wrapper"> <div class="inner-wrapper">
...@@ -44,27 +47,7 @@ ...@@ -44,27 +47,7 @@
<a href="#" class="drag-handle wip"></a> <a href="#" class="drag-handle wip"></a>
</div> </div>
</div> </div>
${units.enum_units(subsection)}
<ol>
% for unit in subsection.get_children():
<li class="leaf">
<div class="section-item">
<a href="${reverse('edit_unit', args=[unit.location])}" class="private-item">
<span class="${unit.category}-icon"></span>${unit.display_name} <span class="private-tag">– private</span>
</a>
<div class="item-actions">
<a href="${reverse('delete_unit', args=[unit.location])}" class="edit-button wip"><span class="delete-icon"></span></a>
<a href="#" class="drag-handle wip"></a>
</div>
</div>
</li>
% endfor
<li>
<a href="#" class="new-unit-item wip">
<span class="new-unit-icon"></span>New Unit
</a>
</li>
</ol>
</li> </li>
% endfor % endfor
</ol> </ol>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment