From e8a751e326e763d24b2b46c65401757e097c2420 Mon Sep 17 00:00:00 2001 From: Tim Babych Date: Thu, 24 Jul 2014 14:55:10 +0300 Subject: [PATCH] Remove code and template responsible for subsection edit page --- .../contentstore/tests/test_contentstore.py | 5 - .../contentstore/views/component.py | 70 +-- .../coffee/spec/views/overview_spec.coffee | 99 ---- cms/static/js/base.js | 249 +-------- cms/static/sass/style-app-extend1.scss | 1 - cms/static/sass/views/_subsection.scss | 511 ------------------ cms/templates/container.html | 1 - cms/templates/edit_subsection.html | 130 ----- cms/templates/ux/reference/container.html | 1 - cms/templates/widgets/units.html | 55 -- cms/urls.py | 1 - common/djangoapps/terrain/ui_helpers.py | 2 +- lms/static/js/verify_student/photocapture.js | 10 +- 13 files changed, 14 insertions(+), 1121 deletions(-) delete mode 100644 cms/static/coffee/spec/views/overview_spec.coffee delete mode 100644 cms/static/sass/views/_subsection.scss delete mode 100644 cms/templates/edit_subsection.html delete mode 100644 cms/templates/widgets/units.html diff --git a/cms/djangoapps/contentstore/tests/test_contentstore.py b/cms/djangoapps/contentstore/tests/test_contentstore.py index 27865abfa412..659bd9eca5da 100644 --- a/cms/djangoapps/contentstore/tests/test_contentstore.py +++ b/cms/djangoapps/contentstore/tests/test_contentstore.py @@ -1289,11 +1289,6 @@ def test_get_html(handler): test_get_html('advanced_settings_handler') test_get_html('textbooks_list_handler') - # go look at a subsection page - subsection_key = course_key.make_usage_key('sequential', 'test_sequence') - resp = self.client.get_html(get_url('subsection_handler', subsection_key)) - self.assertEqual(resp.status_code, 200) - # go look at the Edit page unit_key = course_key.make_usage_key('vertical', 'test_vertical') resp = self.client.get_html(get_url('container_handler', unit_key)) diff --git a/cms/djangoapps/contentstore/views/component.py b/cms/djangoapps/contentstore/views/component.py index 4bf061ee33ca..92f6be5165a4 100644 --- a/cms/djangoapps/contentstore/views/component.py +++ b/cms/djangoapps/contentstore/views/component.py @@ -17,7 +17,6 @@ from xblock.core import XBlock from xblock.django.request import webob_to_django_response, django_to_webob_request from xblock.exceptions import NoSuchHandlerError -from xblock.fields import Scope from xblock.plugin import PluginMissingError from xblock.runtime import Mixologist @@ -25,7 +24,6 @@ from contentstore.views.helpers import get_parent_xblock, is_unit, xblock_type_display_name from contentstore.views.item import create_xblock_info -from models.settings.course_grading import CourseGradingModel from opaque_keys.edx.keys import UsageKey from .access import has_course_access @@ -33,7 +31,6 @@ __all__ = ['OPEN_ENDED_COMPONENT_TYPES', 'ADVANCED_COMPONENT_POLICY_KEY', - 'subsection_handler', 'container_handler', 'component_handler' ] @@ -66,7 +63,7 @@ 'done', # Lets students mark things as done. See https://github.com/pmitros/DoneXBlock 'audio', # Embed an audio file. See https://github.com/pmitros/AudioXBlock SPLIT_TEST_COMPONENT_TYPE, # Adds A/B test support - 'recommender' # Crowdsourced recommender. Prototype by dli&pmitros. Intended for roll-out in one place in one course. + 'recommender' # Crowdsourced recommender. Prototype by dli&pmitros. Intended for roll-out in one place in one course. ] + OPEN_ENDED_COMPONENT_TYPES + NOTE_COMPONENT_TYPES ADVANCED_COMPONENT_CATEGORY = 'advanced' @@ -81,71 +78,6 @@ } ] -@require_GET -@login_required -def subsection_handler(request, usage_key_string): - """ - The restful handler for subsection-specific requests. - - GET - html: return html page for editing a subsection - json: not currently supported - """ - if 'text/html' in request.META.get('HTTP_ACCEPT', 'text/html'): - usage_key = UsageKey.from_string(usage_key_string) - try: - course, item, lms_link = _get_item_in_course(request, usage_key) - except ItemNotFoundError: - return HttpResponseBadRequest() - - preview_link = get_lms_link_for_item(item.location, preview=True) - - # make sure that location references a 'sequential', otherwise return - # BadRequest - if item.location.category != 'sequential': - return HttpResponseBadRequest() - - parent = get_parent_xblock(item) - - # remove all metadata from the generic dictionary that is presented in a - # more normalized UI. We only want to display the XBlocks fields, not - # the fields from any mixins that have been added - fields = getattr(item, 'unmixed_class', item.__class__).fields - - policy_metadata = dict( - (field.name, field.read_from(item)) - for field - in fields.values() - if field.name not in ['display_name', 'start', 'due', 'format'] and field.scope == Scope.settings - ) - - can_view_live = False - subsection_units = item.get_children() - for unit in subsection_units: - has_published = modulestore().has_item(unit.location, revision=ModuleStoreEnum.RevisionOption.published_only) - if has_published: - can_view_live = True - break - - return render_to_response( - 'edit_subsection.html', - { - 'subsection': item, - 'context_course': course, - 'new_unit_category': 'vertical', - 'lms_link': lms_link, - 'preview_link': preview_link, - 'course_graders': json.dumps(CourseGradingModel.fetch(item.location.course_key).graders), - 'parent_item': parent, - 'locator': item.location, - 'policy_metadata': policy_metadata, - 'subsection_units': subsection_units, - 'can_view_live': can_view_live - } - ) - else: - return HttpResponseBadRequest("Only supports html requests") - def _load_mixed_class(category): """ diff --git a/cms/static/coffee/spec/views/overview_spec.coffee b/cms/static/coffee/spec/views/overview_spec.coffee deleted file mode 100644 index 333e369bc292..000000000000 --- a/cms/static/coffee/spec/views/overview_spec.coffee +++ /dev/null @@ -1,99 +0,0 @@ -define ["js/views/overview", "js/views/feedback_notification", "js/spec_helpers/create_sinon", "js/base", "date", "jquery.timepicker"], -(Overview, Notification, create_sinon) -> - - describe "Course Overview", -> - beforeEach -> - appendSetFixtures """ -
- - Release date: 06/12/2013 at 04:00 UTC - - Edit section release date -
- """ - - appendSetFixtures """ -