From 9cc1af5052c182255b49dc39e6bfbde2e1328f1e Mon Sep 17 00:00:00 2001 From: Chris Dodge Date: Wed, 7 Nov 2012 15:27:44 -0500 Subject: [PATCH] first pass at static tab editing. Doesn't yet support drag/drop as well as new tab creation, which needs to modify the policy on the course --- cms/djangoapps/contentstore/views.py | 23 ++++++++++++++++++++++- cms/templates/widgets/header.html | 2 +- cms/urls.py | 1 + common/lib/xmodule/setup.py | 6 +++--- common/lib/xmodule/xmodule/html_module.py | 22 ++++++++++++++++++++++ 5 files changed, 49 insertions(+), 5 deletions(-) diff --git a/cms/djangoapps/contentstore/views.py b/cms/djangoapps/contentstore/views.py index b3af6f7e7b..5495b5ea0b 100644 --- a/cms/djangoapps/contentstore/views.py +++ b/cms/djangoapps/contentstore/views.py @@ -66,7 +66,7 @@ log = logging.getLogger(__name__) COMPONENT_TYPES = ['customtag', 'discussion', 'html', 'problem', 'video'] -DIRECT_ONLY_CATEGORIES = ['course', 'chapter', 'sequential'] +DIRECT_ONLY_CATEGORIES = ['course', 'chapter', 'sequential', 'about', 'static_tab', 'course_info'] def _modulestore(location): @@ -870,6 +870,27 @@ def edit_static(request, org, course, coursename): return render_to_response('edit-static-page.html', {}) +def edit_tabs(request, org, course, coursename): + location = ['i4x', org, course, 'course', coursename] + course_item = modulestore().get_item(location) + static_tabs_loc = Location('i4x', org, course, 'static_tab', None) + + static_tabs = modulestore('direct').get_items(static_tabs_loc) + + # import pudb; pudb.set_trace() + + components = [ + static_tab.location.url() + for static_tab + in static_tabs + ] + + return render_to_response('edit-tabs.html', { + 'active_tab': 'pages', + 'context_course':course_item, + 'components': components + }) + def not_found(request): return render_to_response('error.html', {'error': '404'}) diff --git a/cms/templates/widgets/header.html b/cms/templates/widgets/header.html index 2b9b2c7884..0f5780a5d2 100644 --- a/cms/templates/widgets/header.html +++ b/cms/templates/widgets/header.html @@ -10,7 +10,7 @@ ${context_course.display_name}