rename method to something that actually better reflects what it is doing. Also rename a variable to help with readability

This commit is contained in:
Chris Dodge
2013-01-30 11:50:11 -05:00
parent e5115953ad
commit 7f32aae47d
4 changed files with 9 additions and 9 deletions

View File

@@ -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
course_tabs = []
for tab in course.tabs:
if tab['type'] == 'static_tab':

View File

@@ -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

View File

@@ -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
}),

View File

@@ -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'),