Commit 7f32aae4 by Chris Dodge

rename method to something that actually better reflects what it is doing. Also…

rename method to something that actually better reflects what it is doing. Also rename a variable to help with readability
parent e5115953
......@@ -362,11 +362,11 @@ class ContentStoreTest(TestCase):
if tab['type'] == 'static_tab':
reverse_tabs.insert(0, 'i4x://edX/full/static_tab/{0}'.format(tab['url_slug']))
resp = self.client.post(reverse('reorder_tabs'), json.dumps({'tabs':reverse_tabs}), "application/json")
resp = self.client.post(reverse('reorder_static_tabs'), json.dumps({'tabs':reverse_tabs}), "application/json")
course = ms.get_item(Location(['i4x','edX','full','course','6.002_Spring_2012', None]))
# compare to make sure that the tabs information is in the expected order after the server call
# compare to make sure that the tabs information is in the expected order after the server call
course_tabs = []
for tab in course.tabs:
if tab['type'] == 'static_tab':
......
......@@ -906,19 +906,19 @@ def edit_static(request, org, course, coursename):
@login_required
@expect_json
def reorder_tabs(request):
def reorder_static_tabs(request):
tabs = request.POST['tabs']
course = get_course_for_item(tabs[0])
if not has_access(request.user, course.location):
raise PermissionDenied()
# get list of course_tabs
course_tabs = [t for t in course.tabs if t['type'] == 'static_tab']
# get list of existing static tabs in course
# make sure they are the same lengths (i.e. the number of passed in tabs equals the number
# that we know about) otherwise we can drop some!
if len(course_tabs) != len(tabs):
existing_static_tabs = [t for t in course.tabs if t['type'] == 'static_tab']
if len(existing_static_tabs) != len(tabs):
return HttpResponseBadRequest()
# load all reference tabs, return BadRequest if we can't find any of them
......
......@@ -31,7 +31,7 @@ class CMS.Views.TabsEdit extends Backbone.View
)
$.ajax({
type:'POST',
url: '/reorder_tabs',
url: '/reorder_static_tabs',
data: JSON.stringify({
tabs : tabs
}),
......
......@@ -17,7 +17,7 @@ urlpatterns = ('',
url(r'^publish_draft$', 'contentstore.views.publish_draft', name='publish_draft'),
url(r'^unpublish_unit$', 'contentstore.views.unpublish_unit', name='unpublish_unit'),
url(r'^create_new_course', 'contentstore.views.create_new_course', name='create_new_course'),
url(r'^reorder_tabs', 'contentstore.views.reorder_tabs', name='reorder_tabs'),
url(r'^reorder_static_tabs', 'contentstore.views.reorder_static_tabs', name='reorder_static_tabs'),
url(r'^(?P<org>[^/]+)/(?P<course>[^/]+)/course/(?P<name>[^/]+)$',
'contentstore.views.course_index', name='course_index'),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment