From 1007f5aeb4455c439d014a30135c4eade1e5a75b Mon Sep 17 00:00:00 2001 From: David Baumgold Date: Thu, 10 Oct 2013 16:15:57 -0400 Subject: [PATCH 1/3] load gettext on every page --- cms/templates/base.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cms/templates/base.html b/cms/templates/base.html index 9bb7ae2285..cc27128183 100644 --- a/cms/templates/base.html +++ b/cms/templates/base.html @@ -159,8 +159,8 @@ var require = { deps: ["coffee/src/ajax_prefix"] } }, - // load jquery automatically - deps: ["jquery"], + // load jquery and gettext automatically + deps: ["jquery", "gettext"], callback: function() { // load other scripts on every page, after jquery loads require(["js/base", "coffee/src/main", "coffee/src/logger", "datepair"]); From fb01d8fa81f7719b967494a8e41fd9035414a8ee Mon Sep 17 00:00:00 2001 From: David Baumgold Date: Fri, 11 Oct 2013 13:33:48 -0400 Subject: [PATCH 2/3] Fixes to avoid CSRF error in acceptance tests --- .../contentstore/features/component.py | 17 +++++++++-------- cms/static/coffee/src/main.coffee | 7 ++++--- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/cms/djangoapps/contentstore/features/component.py b/cms/djangoapps/contentstore/features/component.py index 5a15516f60..af82b1ff7a 100644 --- a/cms/djangoapps/contentstore/features/component.py +++ b/cms/djangoapps/contentstore/features/component.py @@ -5,6 +5,7 @@ from lettuce import world, step from nose.tools import assert_true, assert_in, assert_equal # pylint: disable=E0611 from common import create_studio_user, add_course_author, log_into_studio + @step(u'I am in Studio editing a new unit$') def add_unit(step): world.clear_courses() @@ -18,7 +19,7 @@ def add_unit(step): add_course_author(user, course) log_into_studio() world.wait_for_requirejs([ - "jquery", "js/models/course", "coffee/src/models/module", + "jquery", "gettext", "js/models/course", "coffee/src/models/module", "coffee/src/views/unit", "jquery.ui", ]) world.wait_for_mathjax() @@ -39,13 +40,13 @@ def add_a_single_step_component(step): css_selector = 'a[data-type="{}"]'.format(component.lower()) world.css_click(css_selector) - # In the current implementation, all the "new component" - # buttons are handled by one BackBone.js view. - # If we click two buttons at super-human speed, - # the view will miss the second click while it's - # processing the first. - # To account for this, we wait for each component - # to be created before clicking the next component. + # In the current implementation, all the "new component" + # buttons are handled by one BackBone.js view. + # If we click two buttons at super-human speed, + # the view will miss the second click while it's + # processing the first. + # To account for this, we wait for each component + # to be created before clicking the next component. world.wait_for_visible('section.xmodule_{}Module'.format(component)) diff --git a/cms/static/coffee/src/main.coffee b/cms/static/coffee/src/main.coffee index 09253cbf40..c88b14fee4 100644 --- a/cms/static/coffee/src/main.coffee +++ b/cms/static/coffee/src/main.coffee @@ -1,5 +1,6 @@ -define ["jquery", "underscore.string", "backbone", "js/views/feedback_notification", "jquery.cookie"], -($, str, Backbone, NotificationView) -> +define ["domReady", "jquery", "underscore.string", "backbone", "gettext", + "js/views/feedback_notification", "jquery.cookie"], +(domReady, $, str, Backbone, gettext, NotificationView) -> AjaxPrefix.addAjaxPrefix jQuery, -> $("meta[name='path_prefix']").attr('content') @@ -36,5 +37,5 @@ define ["jquery", "underscore.string", "backbone", "js/views/feedback_notificati if onTouchBasedDevice() $('body').addClass 'touch-based-device' - $(main) + domReady(main) return main From b6281cb0a68e17c078aab90148593e91eae83404 Mon Sep 17 00:00:00 2001 From: David Baumgold Date: Fri, 11 Oct 2013 14:19:16 -0400 Subject: [PATCH 3/3] Define CMS.URL.UPLOAD_ASSET immediately --- cms/templates/settings.html | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cms/templates/settings.html b/cms/templates/settings.html index 961b7d3d92..f3eec1e195 100644 --- a/cms/templates/settings.html +++ b/cms/templates/settings.html @@ -17,6 +17,10 @@