Merge pull request #819 from MITx/feature/cale/cas-unit-location-view
Wire up the unit location display
This commit is contained in:
@@ -144,8 +144,9 @@ def edit_subsection(request, location):
|
||||
if item.location.category != 'sequential':
|
||||
return HttpResponseBadRequest
|
||||
|
||||
return render_to_response('edit_subsection.html',
|
||||
{'subsection':item})
|
||||
return render_to_response('edit_subsection.html',
|
||||
{'subsection': item})
|
||||
|
||||
|
||||
@login_required
|
||||
def edit_unit(request, location):
|
||||
@@ -166,7 +167,7 @@ def edit_unit(request, location):
|
||||
lms_link = "{lms_base}/courses/{course_id}/jump_to/{location}".format(
|
||||
lms_base=settings.LMS_BASE,
|
||||
# TODO: These will need to be changed to point to the particular instance of this problem in the particular course
|
||||
course_id= modulestore().get_containing_courses(item.location)[0].id,
|
||||
course_id = modulestore().get_containing_courses(item.location)[0].id,
|
||||
location=item.location,
|
||||
)
|
||||
else:
|
||||
@@ -188,10 +189,22 @@ def edit_unit(request, location):
|
||||
in item.get_children()
|
||||
]
|
||||
|
||||
# TODO (cpennington): If we share units between courses,
|
||||
# this will need to change to check permissions correctly so as
|
||||
# to pick the correct parent subsection
|
||||
containing_subsection_locs = modulestore().get_parent_locations(location)
|
||||
containing_subsection = modulestore().get_item(containing_subsection_locs[0])
|
||||
|
||||
containing_section_locs = modulestore().get_parent_locations(containing_subsection.location)
|
||||
containing_section = modulestore().get_item(containing_section_locs[0])
|
||||
|
||||
return render_to_response('unit.html', {
|
||||
'unit': item,
|
||||
'components': components,
|
||||
'component_templates': component_templates,
|
||||
'lms_link': lms_link,
|
||||
'subsection': containing_subsection,
|
||||
'section': containing_section,
|
||||
})
|
||||
|
||||
|
||||
@@ -624,4 +637,4 @@ def asset_index(request, location):
|
||||
|
||||
# points to the temporary course landing page with log in and sign up
|
||||
def landing(request, org, course, coursename):
|
||||
return render_to_response('temp-course-landing.html', {})
|
||||
return render_to_response('temp-course-landing.html', {})
|
||||
|
||||
@@ -194,4 +194,4 @@
|
||||
margin-left: 96px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<%inherit file="base.html" />
|
||||
<%! from django.core.urlresolvers import reverse %>
|
||||
<%namespace name="units" file="widgets/units.html" />
|
||||
<%block name="bodyclass">unit</%block>
|
||||
<%block name="title">CMS Unit</%block>
|
||||
<%block name="jsextra">
|
||||
@@ -83,37 +84,36 @@
|
||||
</div>
|
||||
<div class="row unit-actions">
|
||||
<a href="#" class="save-button">Save</a>
|
||||
<a href="preview.html" target="_blank" class="preview-button">Preview</a>
|
||||
<a href="${lms_link}" target="_blank" class="preview-button">Preview</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="window unit-location">
|
||||
<h4>Unit Location</h4>
|
||||
<div class="window-contents">
|
||||
<div><input type="text" class="url" value="/courseware/Week_1/My_Unit" disabled /></div>
|
||||
<ol>
|
||||
<li>
|
||||
<a href="#" class="section-item">Week 1</a>
|
||||
<div><input type="text" class="url" value="/courseware/${section.url_name}/${subsection.url_name}" disabled /></div>
|
||||
<section class="courseware-section branch">
|
||||
<header>
|
||||
<div class="item-details">
|
||||
<h3>${section.display_name}</h3>
|
||||
</div>
|
||||
</header>
|
||||
<div class="unit-list">
|
||||
<ol>
|
||||
<li>
|
||||
<a href="#" class="section-item"><span class="folder-icon"></span>Administrivia and Circuit Elements</a>
|
||||
<ol>
|
||||
<li><a href="#" class="section-item"><span class="file-icon"></span>Motiviation for 6.002</a></li>
|
||||
<li><a href="#" class="section-item"><span class="file-icon"></span>Administrivia</a></li>
|
||||
<li><a href="#" class="section-item"><span class="file-icon"></span>Course Overview</a></li>
|
||||
<li><a href="#" class="section-item"><span class="file-icon"></span>Lumped Element Abstraction</a></li>
|
||||
<li><a href="#" class="section-item"><span class="file-icon"></span>Simple Power</a></li>
|
||||
<li><a href="#" class="current section-item"><span class="file-icon"></span>New Unit</a></li>
|
||||
<li>
|
||||
<a href="unit.html" class="new-unit-item">
|
||||
<span class="new-unit-icon"></span>New Unit
|
||||
<li class="branch">
|
||||
<div class="section-item">
|
||||
<div>
|
||||
<a href="${reverse('edit_subsection', args=[subsection.location])}">
|
||||
<span class="folder-icon"></span>
|
||||
<span class="subsection-name"><span class="subsection-name-value">${subsection.display_name}</span></span>
|
||||
</a>
|
||||
</li>
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
${units.enum_units(subsection, actions=False, selected=unit.location)}
|
||||
</li>
|
||||
</ol>
|
||||
</li>
|
||||
</ol>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -3,18 +3,28 @@
|
||||
<!--
|
||||
This def will enumerate through a passed in subsection and list all of the units
|
||||
-->
|
||||
<%def name="enum_units(subsection)">
|
||||
<%def name="enum_units(subsection, actions=True, selected=None)">
|
||||
<ol>
|
||||
% for unit in subsection.get_children():
|
||||
<li class="leaf">
|
||||
<div class="section-item">
|
||||
<%
|
||||
if unit.location == selected:
|
||||
selected_class = 'editing'
|
||||
else:
|
||||
selected_class = ''
|
||||
%>
|
||||
<div class="section-item ${selected_class}">
|
||||
<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>
|
||||
<span class="${unit.category}-icon"></span>
|
||||
${unit.display_name}
|
||||
<span class="private-tag">- private</span>
|
||||
</a>
|
||||
% if actions:
|
||||
<div class="item-actions">
|
||||
<a href="${reverse('delete_unit', args=[unit.location])}" classs="edit-button wip"><span class="delete-icon"></span></a>
|
||||
<a href="#" class="drag-handle wip"></a>
|
||||
</div>
|
||||
% endif
|
||||
</div>
|
||||
</li>
|
||||
% endfor
|
||||
|
||||
Reference in New Issue
Block a user