From 404c36b8f4090be7b7d7f05fed0a68e7189ccb1e Mon Sep 17 00:00:00 2001 From: David Baumgold Date: Mon, 24 Jun 2013 15:56:45 -0400 Subject: [PATCH] PDF textbooks: namespace JS variables for URLs --- cms/djangoapps/contentstore/views/course.py | 4 ++-- cms/static/coffee/spec/models/textbook_spec.coffee | 6 +++--- cms/static/coffee/spec/views/textbook_spec.coffee | 10 +++++----- cms/static/coffee/src/main.coffee | 1 + cms/static/js/models/textbook.js | 2 +- cms/static/js/views/textbook.js | 2 +- cms/templates/textbooks.html | 4 ++-- 7 files changed, 15 insertions(+), 14 deletions(-) diff --git a/cms/djangoapps/contentstore/views/course.py b/cms/djangoapps/contentstore/views/course.py index 5f7db176b5..7284b5e399 100644 --- a/cms/djangoapps/contentstore/views/course.py +++ b/cms/djangoapps/contentstore/views/course.py @@ -460,7 +460,7 @@ def textbook_index(request, org, course, name): return HttpResponse('', content_type="application/json", status=204) else: - upload_asset_callback_url = reverse('upload_asset', kwargs={ + upload_asset_url = reverse('upload_asset', kwargs={ 'org': org, 'course': course, 'coursename': name, @@ -473,6 +473,6 @@ def textbook_index(request, org, course, name): return render_to_response('textbooks.html', { 'context_course': course_module, 'course': course_module, - 'upload_asset_callback_url': upload_asset_callback_url, + 'upload_asset_url': upload_asset_url, 'textbook_url': textbook_url, }) diff --git a/cms/static/coffee/spec/models/textbook_spec.coffee b/cms/static/coffee/spec/models/textbook_spec.coffee index 037fdf7312..1d2134c0a5 100644 --- a/cms/static/coffee/spec/models/textbook_spec.coffee +++ b/cms/static/coffee/spec/models/textbook_spec.coffee @@ -71,14 +71,14 @@ describe "CMS.Models.Textbook input/output", -> describe "CMS.Collections.TextbookSet", -> beforeEach -> - window.TEXTBOOK_URL = "/textbooks" + CMS.URL.TEXTBOOK = "/textbooks" @collection = new CMS.Collections.TextbookSet() afterEach -> - delete window.TEXTBOOK_URL + delete CMS.URL.TEXTBOOK it "should have a url set", -> - expect(_.result(@collection, "url"), window.TEXTBOOK_URL) + expect(_.result(@collection, "url"), "/textbooks") it "can call save", -> spyOn(@collection, "sync") diff --git a/cms/static/coffee/spec/views/textbook_spec.coffee b/cms/static/coffee/spec/views/textbook_spec.coffee index 848afe9830..e6519471a2 100644 --- a/cms/static/coffee/spec/views/textbook_spec.coffee +++ b/cms/static/coffee/spec/views/textbook_spec.coffee @@ -225,11 +225,11 @@ describe "CMS.Views.EditChapter", -> @collection.add(@model) @view = new CMS.Views.EditChapter({model: @model}) spyOn(@view, "remove").andCallThrough() - window.UPLOAD_ASSET_CALLBACK_URL = "/upload" + CMS.URL.UPLOAD_ASSET = "/upload" window.section = new CMS.Models.Section({name: "abcde"}) afterEach -> - delete window.UPLOAD_ASSET_CALLBACK_URL + delete CMS.URL.UPLOAD_ASSET delete window.section it "can render", -> @@ -267,7 +267,7 @@ describe "CMS.Views.UploadDialog", -> beforeEach -> setFixtures($("