Commit c32b30ba by Felipe Montoya

Relocating inside the cms namespace

Addressing feedback
parent 27d4e4bd
...@@ -34,9 +34,7 @@ ...@@ -34,9 +34,7 @@
message = str.truncate(jqXHR.responseText, 300); message = str.truncate(jqXHR.responseText, 300);
} }
} else { } else {
message = gettext('This may be happening because of an error with our server' + message = gettext('This may be happening because of an error with our server or your internet connection. Try refreshing the page or making sure you are online.'); //jshint ignore:line
'or your internet connection. Try refreshing the page or making' +
'sure you are online.');
} }
msg = new NotificationView.Error({ msg = new NotificationView.Error({
'title': gettext("Studio's having trouble saving your work"), 'title': gettext("Studio's having trouble saving your work"),
......
...@@ -247,7 +247,7 @@ ...@@ -247,7 +247,7 @@
exports: 'XBlock', exports: 'XBlock',
deps: ['xblock/core'] deps: ['xblock/core']
}, },
'js/main': { 'cms/js/main': {
deps: ['coffee/src/ajax_prefix'] deps: ['coffee/src/ajax_prefix']
}, },
'js/src/logger': { 'js/src/logger': {
......
...@@ -199,7 +199,7 @@ ...@@ -199,7 +199,7 @@
'mock-ajax': { 'mock-ajax': {
deps: ['jquery'] deps: ['jquery']
}, },
'js/main': { 'cms/js/main': {
deps: ['coffee/src/ajax_prefix'] deps: ['coffee/src/ajax_prefix']
}, },
'coffee/src/ajax_prefix': { 'coffee/src/ajax_prefix': {
...@@ -217,6 +217,7 @@ ...@@ -217,6 +217,7 @@
jasmine.getFixtures().fixturesPath += 'coffee/fixtures'; jasmine.getFixtures().fixturesPath += 'coffee/fixtures';
testFiles = [ testFiles = [
'cms/js/spec/main_spec',
'cms/js/spec/xblock/cms.runtime.v1_spec', 'cms/js/spec/xblock/cms.runtime.v1_spec',
'coffee/spec/models/course_spec', 'coffee/spec/models/course_spec',
'coffee/spec/models/metadata_spec', 'coffee/spec/models/metadata_spec',
...@@ -229,7 +230,6 @@ ...@@ -229,7 +230,6 @@
'coffee/spec/views/metadata_edit_spec', 'coffee/spec/views/metadata_edit_spec',
'coffee/spec/views/textbook_spec', 'coffee/spec/views/textbook_spec',
'coffee/spec/views/upload_spec', 'coffee/spec/views/upload_spec',
'js/spec/main_spec',
'js/spec/video/transcripts/utils_spec', 'js/spec/video/transcripts/utils_spec',
'js/spec/video/transcripts/editor_spec', 'js/spec/video/transcripts/editor_spec',
'js/spec/video/transcripts/videolist_spec', 'js/spec/video/transcripts/videolist_spec',
......
(function(sandbox) { (function(sandbox) {
'use strict'; 'use strict';
require(["jquery", "backbone", "js/main", "edx-ui-toolkit/js/utils/spec-helpers/ajax-helpers", "jquery.cookie"], require(["jquery", "backbone", "cms/js/main", "edx-ui-toolkit/js/utils/spec-helpers/ajax-helpers", "jquery.cookie"],
function($, Backbone, main, AjaxHelpers) { function($, Backbone, main, AjaxHelpers) {
describe("CMS", function() { describe("CMS", function() {
return it("should initialize URL", function() { it("should initialize URL", function() {
return expect(window.CMS.URL).toBeDefined(); expect(window.CMS.URL).toBeDefined();
}); });
}); });
describe("main helper", function() { describe("main helper", function() {
...@@ -22,17 +22,17 @@ ...@@ -22,17 +22,17 @@
return $.ajaxSettings; return $.ajaxSettings;
}); });
it("turn on Backbone emulateHTTP", function() { it("turn on Backbone emulateHTTP", function() {
return expect(Backbone.emulateHTTP).toBeTruthy(); expect(Backbone.emulateHTTP).toBeTruthy();
}); });
return it("setup AJAX CSRF token", function() { it("setup AJAX CSRF token", function() {
return expect($.ajaxSettings.headers["X-CSRFToken"]).toEqual("stubCSRFToken"); expect($.ajaxSettings.headers["X-CSRFToken"]).toEqual("stubCSRFToken");
}); });
}); });
describe("AJAX Errors", function() { describe("AJAX Errors", function() {
var server; var server;
server = null; server = null;
beforeEach(function() { beforeEach(function() {
return appendSetFixtures(sandbox({ appendSetFixtures(sandbox({
id: "page-notification" id: "page-notification"
})); }));
}); });
...@@ -49,7 +49,7 @@ ...@@ -49,7 +49,7 @@
$.ajax("/test"); $.ajax("/test");
expect($("#page-notification")).toBeEmpty(); expect($("#page-notification")).toBeEmpty();
server.respond(); server.respond();
return expect($("#page-notification")).toBeEmpty(); expect($("#page-notification")).toBeEmpty();
}); });
it("AJAX request with error should pop an error notification", function() { it("AJAX request with error should pop an error notification", function() {
server = AjaxHelpers.server([ server = AjaxHelpers.server([
...@@ -60,7 +60,7 @@ ...@@ -60,7 +60,7 @@
$.ajax("/test"); $.ajax("/test");
server.respond(); server.respond();
expect($("#page-notification")).not.toBeEmpty(); expect($("#page-notification")).not.toBeEmpty();
return expect($("#page-notification")).toContainElement('div.wrapper-notification-error'); expect($("#page-notification")).toContainElement('div.wrapper-notification-error');
}); });
it("can override AJAX request with error so it does not pop an error notification", function() { it("can override AJAX request with error so it does not pop an error notification", function() {
server = AjaxHelpers.server([ server = AjaxHelpers.server([
...@@ -73,7 +73,7 @@ ...@@ -73,7 +73,7 @@
notifyOnError: false notifyOnError: false
}); });
server.respond(); server.respond();
return expect($("#page-notification")).toBeEmpty(); expect($("#page-notification")).toBeEmpty();
}); });
}); });
}); });
......
...@@ -174,7 +174,7 @@ ...@@ -174,7 +174,7 @@
exports: 'XBlock', exports: 'XBlock',
deps: ['xblock/core'] deps: ['xblock/core']
}, },
'js/main': { 'cms/js/main': {
deps: ['coffee/src/ajax_prefix'] deps: ['coffee/src/ajax_prefix']
}, },
'coffee/src/ajax_prefix': { 'coffee/src/ajax_prefix': {
......
define ["backbone", "js/models/textbook", "js/collections/textbook", "js/models/chapter", "js/collections/chapter", "js/main"], define ["backbone", "js/models/textbook", "js/collections/textbook", "js/models/chapter", "js/collections/chapter", "cms/js/main"],
(Backbone, Textbook, TextbookSet, Chapter, ChapterSet, main) -> (Backbone, Textbook, TextbookSet, Chapter, ChapterSet, main) ->
describe "Textbook model", -> describe "Textbook model", ->
......
define ["js/models/metadata", "js/collections/metadata", "js/views/metadata", "js/main"], define ["js/models/metadata", "js/collections/metadata", "js/views/metadata", "cms/js/main"],
(MetadataModel, MetadataCollection, MetadataView, main) -> (MetadataModel, MetadataCollection, MetadataView, main) ->
verifyInputType = (input, expectedType) -> verifyInputType = (input, expectedType) ->
# Some browsers (e.g. FireFox) do not support the "number" # Some browsers (e.g. FireFox) do not support the "number"
......
...@@ -6,7 +6,7 @@ define([ ...@@ -6,7 +6,7 @@ define([
'backbone-relational', 'backbone-relational',
'backbone.associations', 'backbone.associations',
'gettext', 'gettext',
'js/main', 'cms/js/main',
'js/certificates/models/signatory', 'js/certificates/models/signatory',
'js/certificates/collections/signatories' 'js/certificates/collections/signatories'
], ],
......
define(['js/base', 'js/main', 'js/src/logger', 'datepair', 'accessibility', define(['js/base', 'cms/js/main', 'js/src/logger', 'datepair', 'accessibility',
'ieshim', 'tooltip_manager', 'lang_edx', 'js/models/course']); 'ieshim', 'tooltip_manager', 'lang_edx', 'js/models/course']);
define([ define([
'jquery', 'underscore', 'js/models/xblock_container_info', 'js/views/pages/container', 'jquery', 'underscore', 'js/models/xblock_container_info', 'js/views/pages/container',
'js/collections/component_template', 'xmodule', 'js/main', 'js/collections/component_template', 'xmodule', 'cms/js/main',
'xblock/cms.runtime.v1' 'xblock/cms.runtime.v1'
], ],
function($, _, XBlockContainerInfo, ContainerPage, ComponentTemplates, xmoduleLoader) { function($, _, XBlockContainerInfo, ContainerPage, ComponentTemplates, xmoduleLoader) {
......
define([ define([
'js/models/explicit_url', 'js/views/tabs', 'xmodule', 'js/main', 'xblock/cms.runtime.v1' 'js/models/explicit_url', 'js/views/tabs', 'xmodule', 'cms/js/main', 'xblock/cms.runtime.v1'
], function (TabsModel, TabsEditView, xmoduleLoader) { ], function (TabsModel, TabsEditView, xmoduleLoader) {
'use strict'; 'use strict';
return function (courseLocation, explicitUrl) { return function (courseLocation, explicitUrl) {
......
define([ define([
'jquery', 'underscore', 'js/models/xblock_info', 'js/views/pages/paged_container', 'jquery', 'underscore', 'js/models/xblock_info', 'js/views/pages/paged_container',
'js/views/library_container', 'js/collections/component_template', 'xmodule', 'js/main', 'js/views/library_container', 'js/collections/component_template', 'xmodule', 'cms/js/main',
'xblock/cms.runtime.v1' 'xblock/cms.runtime.v1'
], ],
function($, _, XBlockInfo, PagedContainerPage, LibraryContainerView, ComponentTemplates, xmoduleLoader) { function($, _, XBlockInfo, PagedContainerPage, LibraryContainerView, ComponentTemplates, xmoduleLoader) {
......
define([ define([
'backbone', 'underscore', 'gettext', 'js/models/group', 'js/collections/group', 'backbone', 'underscore', 'gettext', 'js/models/group', 'js/collections/group',
'backbone.associations', 'js/main' 'backbone.associations', 'cms/js/main'
], ],
function(Backbone, _, gettext, GroupModel, GroupCollection) { function(Backbone, _, gettext, GroupModel, GroupCollection) {
'use strict'; 'use strict';
......
define(["backbone", "underscore", "gettext", "js/models/chapter", "js/collections/chapter", define(["backbone", "underscore", "gettext", "js/models/chapter", "js/collections/chapter",
"backbone.associations", "js/main"], "backbone.associations", "cms/js/main"],
function(Backbone, _, gettext, ChapterModel, ChapterCollection) { function(Backbone, _, gettext, ChapterModel, ChapterCollection) {
var Textbook = Backbone.AssociatedModel.extend({ var Textbook = Backbone.AssociatedModel.extend({
......
define([ define([
'backbone', 'js/main', 'js/models/group_configuration', 'backbone', 'cms/js/main', 'js/models/group_configuration',
'js/models/group', 'js/collections/group', 'squire' 'js/models/group', 'js/collections/group', 'squire'
], function (Backbone, main, GroupConfigurationModel, GroupModel, GroupCollection, Squire) { ], function (Backbone, main, GroupConfigurationModel, GroupModel, GroupCollection, Squire) {
'use strict'; 'use strict';
......
define([ "jquery", "edx-ui-toolkit/js/utils/spec-helpers/ajax-helpers", "js/spec_helpers/edit_helpers", define([ "jquery", "edx-ui-toolkit/js/utils/spec-helpers/ajax-helpers", "js/spec_helpers/edit_helpers",
"js/views/container", "js/models/xblock_info", "jquery.simulate", "js/views/container", "js/models/xblock_info", "jquery.simulate",
"xmodule", "js/main", "xblock/cms.runtime.v1"], "xmodule", "cms/js/main", "xblock/cms.runtime.v1"],
function ($, AjaxHelpers, EditHelpers, ContainerView, XBlockInfo) { function ($, AjaxHelpers, EditHelpers, ContainerView, XBlockInfo) {
describe("Container View", function () { describe("Container View", function () {
......
define(["jquery", "URI", "edx-ui-toolkit/js/utils/spec-helpers/ajax-helpers", "common/js/components/utils/view_utils", define(["jquery", "URI", "edx-ui-toolkit/js/utils/spec-helpers/ajax-helpers", "common/js/components/utils/view_utils",
"js/views/xblock", "js/models/xblock_info", "xmodule", "js/main", "xblock/cms.runtime.v1"], "js/views/xblock", "js/models/xblock_info", "xmodule", "cms/js/main", "xblock/cms.runtime.v1"],
function ($, URI, AjaxHelpers, ViewUtils, XBlockView, XBlockInfo) { function ($, URI, AjaxHelpers, ViewUtils, XBlockView, XBlockInfo) {
"use strict"; "use strict";
describe("XBlockView", function() { describe("XBlockView", function() {
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
*/ */
define(["jquery", "underscore", "edx-ui-toolkit/js/utils/spec-helpers/ajax-helpers", define(["jquery", "underscore", "edx-ui-toolkit/js/utils/spec-helpers/ajax-helpers",
"common/js/spec_helpers/template_helpers", "js/spec_helpers/modal_helpers", "js/views/modals/edit_xblock", "common/js/spec_helpers/template_helpers", "js/spec_helpers/modal_helpers", "js/views/modals/edit_xblock",
"js/collections/component_template", "xmodule", "js/main", "xblock/cms.runtime.v1"], "js/collections/component_template", "xmodule", "cms/js/main", "xblock/cms.runtime.v1"],
function($, _, AjaxHelpers, TemplateHelpers, modal_helpers, EditXBlockModal, ComponentTemplates) { function($, _, AjaxHelpers, TemplateHelpers, modal_helpers, EditXBlockModal, ComponentTemplates) {
var installMockXBlock, uninstallMockXBlock, installMockXModule, uninstallMockXModule, var installMockXBlock, uninstallMockXBlock, installMockXModule, uninstallMockXModule,
......
...@@ -22,6 +22,7 @@ var options = { ...@@ -22,6 +22,7 @@ var options = {
// Otherwise Istanbul which is used for coverage tracking will cause tests to not run. // Otherwise Istanbul which is used for coverage tracking will cause tests to not run.
sourceFiles: [ sourceFiles: [
{pattern: 'coffee/src/**/!(*spec).js'}, {pattern: 'coffee/src/**/!(*spec).js'},
{pattern: 'cms/js/**/!(*spec|djangojs).js'},
{pattern: 'js/**/!(*spec|djangojs).js'} {pattern: 'js/**/!(*spec|djangojs).js'}
], ],
......
...@@ -39,7 +39,7 @@ REQUIREJS_WAIT = { ...@@ -39,7 +39,7 @@ REQUIREJS_WAIT = {
# Unit page # Unit page
re.compile(r'^Unit \|'): [ re.compile(r'^Unit \|'): [
"jquery", "js/base", "js/models/xblock_info", "js/views/pages/container", "jquery", "js/base", "js/models/xblock_info", "js/views/pages/container",
"js/collections/component_template", "xmodule", "js/main", "xblock/cms.runtime.v1"], "js/collections/component_template", "xmodule", "cms/js/main", "xblock/cms.runtime.v1"],
# Content - Outline # Content - Outline
# Note that calling your org, course number, or display name, 'course' will mess this up # Note that calling your org, course number, or display name, 'course' will mess this up
...@@ -49,18 +49,18 @@ REQUIREJS_WAIT = { ...@@ -49,18 +49,18 @@ REQUIREJS_WAIT = {
# Dashboard # Dashboard
re.compile(r'^Studio Home \|'): [ re.compile(r'^Studio Home \|'): [
"js/sock", "gettext", "js/base", "js/sock", "gettext", "js/base",
"jquery.ui", "js/main", "underscore"], "jquery.ui", "cms/js/main", "underscore"],
# Upload # Upload
re.compile(r'^\s*Files & Uploads'): [ re.compile(r'^\s*Files & Uploads'): [
'js/base', 'jquery.ui', 'js/main', 'underscore', 'js/base', 'jquery.ui', 'cms/js/main', 'underscore',
'js/views/assets', 'js/views/asset' 'js/views/assets', 'js/views/asset'
], ],
# Pages # Pages
re.compile(r'^Pages \|'): [ re.compile(r'^Pages \|'): [
'js/models/explicit_url', 'js/views/tabs', 'js/models/explicit_url', 'js/views/tabs',
'xmodule', 'js/main', 'xblock/cms.runtime.v1' 'xmodule', 'cms/js/main', 'xblock/cms.runtime.v1'
], ],
} }
......
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