Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions cms/djangoapps/contentstore/tests/test_contentstore.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
70 changes: 1 addition & 69 deletions cms/djangoapps/contentstore/views/component.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,20 @@
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

from contentstore.utils import get_lms_link_for_item
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
from django.utils.translation import ugettext as _

__all__ = ['OPEN_ENDED_COMPONENT_TYPES',
'ADVANCED_COMPONENT_POLICY_KEY',
'subsection_handler',
'container_handler',
'component_handler'
]
Expand Down Expand Up @@ -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'
Expand All @@ -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):
"""
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove unused after deletion modules: ModuleStoreEnum, Scope, CourseGradingModel.

Expand Down
99 changes: 0 additions & 99 deletions cms/static/coffee/spec/views/overview_spec.coffee

This file was deleted.

Loading