From 711dc55c73e6de1a795dddef871f3b7c0cdb7330 Mon Sep 17 00:00:00 2001 From: Chris Dodge Date: Wed, 3 Oct 2012 14:16:23 -0400 Subject: [PATCH] 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 --- cms/djangoapps/contentstore/views.py | 3 +- cms/templates/edit_subsection.html | 62 ++-------------------------- cms/templates/overview.html | 25 ++--------- 3 files changed, 10 insertions(+), 80 deletions(-) diff --git a/cms/djangoapps/contentstore/views.py b/cms/djangoapps/contentstore/views.py index bfd7704a3e..33bfafea4f 100644 --- a/cms/djangoapps/contentstore/views.py +++ b/cms/djangoapps/contentstore/views.py @@ -144,7 +144,8 @@ def edit_subsection(request, location): if item.location.category != 'sequential': return HttpResponseBadRequest - return render_to_response('edit_subsection.html', {}) + return render_to_response('edit_subsection.html', + {'subsection':item}) @login_required def edit_unit(request, location): diff --git a/cms/templates/edit_subsection.html b/cms/templates/edit_subsection.html index a9a15cd2e3..c9fe9fbda8 100644 --- a/cms/templates/edit_subsection.html +++ b/cms/templates/edit_subsection.html @@ -2,8 +2,10 @@ <%! from django.core.urlresolvers import reverse %> <%block name="bodyclass">subsection <%block name="title">CMS Subsection -<%block name="content"> +<%namespace name="units" file="widgets/units.html" /> + +<%block name="content">
@@ -18,63 +20,7 @@
-
    -
  1. -
    - Motivation for 6.002x -
    - - - -
    -
    -
  2. -
  3. -
    - Administrivia -
    - - - -
    -
    -
  4. -
  5. -
    - Course Overview -
    - - - -
    -
    -
  6. -
  7. - -
  8. -
  9. -
    - Simple Power -
    - - - -
    -
    -
  10. -
  11. - - New Unit - -
  12. -
+ ${units.enum_units(subsection)}
diff --git a/cms/templates/overview.html b/cms/templates/overview.html index f07bfa0a39..f4ae4abe4d 100644 --- a/cms/templates/overview.html +++ b/cms/templates/overview.html @@ -2,6 +2,9 @@ <%! from django.core.urlresolvers import reverse %> <%block name="title">CMS Courseware Overview +<%namespace name="units" file="widgets/units.html" /> + + <%block name="content">
@@ -44,27 +47,7 @@
- -
    - % for unit in subsection.get_children(): -
  1. - -
  2. - % endfor -
  3. - - New Unit - -
  4. -
+ ${units.enum_units(subsection)} % endfor