Commit d97b3cbd by Muzaffar yousaf

Merge pull request #12037 from edx/fedx/upgrade-backbone

Upgrade backbone via npm.
parents c6a4c231 4fd2a7d1
...@@ -52,7 +52,7 @@ ...@@ -52,7 +52,7 @@
"text": 'js/vendor/requirejs/text', "text": 'js/vendor/requirejs/text',
"underscore": "common/js/vendor/underscore", "underscore": "common/js/vendor/underscore",
"underscore.string": "common/js/vendor/underscore.string", "underscore.string": "common/js/vendor/underscore.string",
"backbone": "js/vendor/backbone-min", "backbone": "common/js/vendor/backbone-min",
"backbone-relational" : "js/vendor/backbone-relational.min", "backbone-relational" : "js/vendor/backbone-relational.min",
"backbone.associations": "js/vendor/backbone-associations-min", "backbone.associations": "js/vendor/backbone-associations-min",
"backbone.paginator": "js/vendor/backbone.paginator.min", "backbone.paginator": "js/vendor/backbone.paginator.min",
......
...@@ -29,7 +29,7 @@ requirejs.config({ ...@@ -29,7 +29,7 @@ requirejs.config({
"text": "xmodule_js/common_static/js/vendor/requirejs/text", "text": "xmodule_js/common_static/js/vendor/requirejs/text",
"underscore": "xmodule_js/common_static/common/js/vendor/underscore", "underscore": "xmodule_js/common_static/common/js/vendor/underscore",
"underscore.string": "xmodule_js/common_static/common/js/vendor/underscore.string", "underscore.string": "xmodule_js/common_static/common/js/vendor/underscore.string",
"backbone": "xmodule_js/common_static/js/vendor/backbone-min", "backbone": "xmodule_js/common_static/common/js/vendor/backbone-min",
"backbone.associations": "xmodule_js/common_static/js/vendor/backbone-associations-min", "backbone.associations": "xmodule_js/common_static/js/vendor/backbone-associations-min",
"backbone.paginator": "xmodule_js/common_static/js/vendor/backbone.paginator.min", "backbone.paginator": "xmodule_js/common_static/js/vendor/backbone.paginator.min",
"backbone-relational": "xmodule_js/common_static/js/vendor/backbone-relational.min", "backbone-relational": "xmodule_js/common_static/js/vendor/backbone-relational.min",
......
...@@ -26,7 +26,7 @@ requirejs.config({ ...@@ -26,7 +26,7 @@ requirejs.config({
"text": "xmodule_js/common_static/js/vendor/requirejs/text", "text": "xmodule_js/common_static/js/vendor/requirejs/text",
"underscore": "common/js/vendor/underscore", "underscore": "common/js/vendor/underscore",
"underscore.string": "common/js/vendor/underscore.string", "underscore.string": "common/js/vendor/underscore.string",
"backbone": "xmodule_js/common_static/js/vendor/backbone-min", "backbone": "xmodule_js/common_static/common/js/vendor/backbone-min",
"backbone.associations": "xmodule_js/common_static/js/vendor/backbone-associations-min", "backbone.associations": "xmodule_js/common_static/js/vendor/backbone-associations-min",
"backbone.paginator": "xmodule_js/common_static/js/vendor/backbone.paginator.min", "backbone.paginator": "xmodule_js/common_static/js/vendor/backbone.paginator.min",
"tinymce": "xmodule_js/common_static/js/vendor/tinymce/js/tinymce/tinymce.full.min", "tinymce": "xmodule_js/common_static/js/vendor/tinymce/js/tinymce/tinymce.full.min",
......
define ["jquery", "jquery.ui", "backbone", "common/js/components/views/feedback_prompt", define ["underscore", "jquery", "jquery.ui", "backbone", "common/js/components/views/feedback_prompt",
"common/js/components/views/feedback_notification", "coffee/src/views/module_edit", "js/models/module_info", "js/utils/module"], "common/js/components/views/feedback_notification", "coffee/src/views/module_edit", "js/models/module_info", "js/utils/module"],
($, ui, Backbone, PromptView, NotificationView, ModuleEditView, ModuleModel, ModuleUtils) -> (_, $, ui, Backbone, PromptView, NotificationView, ModuleEditView, ModuleModel, ModuleUtils) ->
class TabsEdit extends Backbone.View class TabsEdit extends Backbone.View
initialize: => initialize: (options) =>
@$('.component').each((idx, element) => @$('.component').each((idx, element) =>
model = new ModuleModel({ model = new ModuleModel({
id: $(element).data('locator') id: $(element).data('locator')
...@@ -15,7 +15,7 @@ define ["jquery", "jquery.ui", "backbone", "common/js/components/views/feedback_ ...@@ -15,7 +15,7 @@ define ["jquery", "jquery.ui", "backbone", "common/js/components/views/feedback_
model: model model: model
) )
) )
@options = _.extend({}, options)
@options.mast.find('.new-tab').on('click', @addNewTab) @options.mast.find('.new-tab').on('click', @addNewTab)
$('.add-pages .new-tab').on('click', @addNewTab) $('.add-pages .new-tab').on('click', @addNewTab)
$('.toggle-checkbox').on('click', @toggleVisibilityOfTab) $('.toggle-checkbox').on('click', @toggleVisibilityOfTab)
......
...@@ -26,6 +26,14 @@ define(["jquery", "underscore", "backbone", "gettext", "js/utils/handle_iframe_b ...@@ -26,6 +26,14 @@ define(["jquery", "underscore", "backbone", "gettext", "js/utils/handle_iframe_b
//override the constructor function //override the constructor function
constructor: function(options) { constructor: function(options) {
_.bindAll(this, 'beforeRender', 'render', 'afterRender'); _.bindAll(this, 'beforeRender', 'render', 'afterRender');
// Merge passed options and view's options property and
// attach to the view's options property
if (this.options) {
options = _.extend({}, _.result(this, 'options'), options);
}
this.options = options;
var _this = this; var _this = this;
this.render = _.wrap(this.render, function (render, options) { this.render = _.wrap(this.render, function (render, options) {
_this.beforeRender(); _this.beforeRender();
......
...@@ -100,8 +100,8 @@ define(['jquery', 'underscore', 'gettext', "js/views/baseview", ...@@ -100,8 +100,8 @@ define(['jquery', 'underscore', 'gettext', "js/views/baseview",
}; };
var roleEvents = {}; var roleEvents = {};
var self = this; var self = this;
for (var i = 0; i < self.roles.length; i++) { for (var i = 0; i < self.options.roles.length; i++) {
var role_name = self.roles[i].key; var role_name = self.options.roles[i].key;
var role_selector = 'click .user-actions .make-' + role_name; var role_selector = 'click .user-actions .make-' + role_name;
(function (role) { (function (role) {
......
...@@ -26,7 +26,7 @@ define(["jquery", "underscore", "gettext", "js/views/baseview"], ...@@ -26,7 +26,7 @@ define(["jquery", "underscore", "gettext", "js/views/baseview"],
'click .action-cancel': 'cancel' 'click .action-cancel': 'cancel'
}, },
options: $.extend({}, BaseView.prototype.options, { options: _.extend({}, BaseView.prototype.options, {
type: 'prompt', type: 'prompt',
closeIcon: false, closeIcon: false,
icon: false, icon: false,
......
...@@ -17,9 +17,9 @@ define(['jquery', 'backbone', 'underscore', 'gettext', 'js/views/baseview', ...@@ -17,9 +17,9 @@ define(['jquery', 'backbone', 'underscore', 'gettext', 'js/views/baseview',
VerificationAccessEditor, TimedExaminationPreferenceEditor, AccessEditor; VerificationAccessEditor, TimedExaminationPreferenceEditor, AccessEditor;
CourseOutlineXBlockModal = BaseModal.extend({ CourseOutlineXBlockModal = BaseModal.extend({
events : { events : _.extend({}, BaseModal.prototype.events, {
'click .action-save': 'save' 'click .action-save': 'save'
}, }),
options: $.extend({}, BaseModal.prototype.options, { options: $.extend({}, BaseModal.prototype.options, {
modalName: 'course-outline', modalName: 'course-outline',
...@@ -32,7 +32,6 @@ define(['jquery', 'backbone', 'underscore', 'gettext', 'js/views/baseview', ...@@ -32,7 +32,6 @@ define(['jquery', 'backbone', 'underscore', 'gettext', 'js/views/baseview',
initialize: function() { initialize: function() {
BaseModal.prototype.initialize.call(this); BaseModal.prototype.initialize.call(this);
this.events = $.extend({}, BaseModal.prototype.events, this.events);
this.template = this.loadTemplate('course-outline-modal'); this.template = this.loadTemplate('course-outline-modal');
this.options.title = this.getTitle(); this.options.title = this.getTitle();
}, },
...@@ -154,10 +153,10 @@ define(['jquery', 'backbone', 'underscore', 'gettext', 'js/views/baseview', ...@@ -154,10 +153,10 @@ define(['jquery', 'backbone', 'underscore', 'gettext', 'js/views/baseview',
} }
}, },
events: { events: _.extend({}, CourseOutlineXBlockModal.prototype.events, {
'click .action-save': 'save', 'click .action-save': 'save',
'click .settings-tab-button': 'handleShowTab', 'click .settings-tab-button': 'handleShowTab'
}, }),
/** /**
* Return request data. * Return request data.
...@@ -185,9 +184,9 @@ define(['jquery', 'backbone', 'underscore', 'gettext', 'js/views/baseview', ...@@ -185,9 +184,9 @@ define(['jquery', 'backbone', 'underscore', 'gettext', 'js/views/baseview',
PublishXBlockModal = CourseOutlineXBlockModal.extend({ PublishXBlockModal = CourseOutlineXBlockModal.extend({
events : { events : _.extend({}, CourseOutlineXBlockModal.prototype.events, {
'click .action-publish': 'save' 'click .action-publish': 'save'
}, }),
initialize: function() { initialize: function() {
CourseOutlineXBlockModal.prototype.initialize.call(this); CourseOutlineXBlockModal.prototype.initialize.call(this);
......
...@@ -9,10 +9,10 @@ define(["jquery", "underscore", "gettext", "js/views/modals/base_modal", "common ...@@ -9,10 +9,10 @@ define(["jquery", "underscore", "gettext", "js/views/modals/base_modal", "common
"strict mode"; "strict mode";
var EditXBlockModal = BaseModal.extend({ var EditXBlockModal = BaseModal.extend({
events : { events: _.extend({}, BaseModal.prototype.events, {
"click .action-save": "save", "click .action-save": "save",
"click .action-modes a": "changeMode" "click .action-modes a": "changeMode"
}, }),
options: $.extend({}, BaseModal.prototype.options, { options: $.extend({}, BaseModal.prototype.options, {
modalName: 'edit-xblock', modalName: 'edit-xblock',
...@@ -25,7 +25,6 @@ define(["jquery", "underscore", "gettext", "js/views/modals/base_modal", "common ...@@ -25,7 +25,6 @@ define(["jquery", "underscore", "gettext", "js/views/modals/base_modal", "common
initialize: function() { initialize: function() {
BaseModal.prototype.initialize.call(this); BaseModal.prototype.initialize.call(this);
this.events = _.extend({}, BaseModal.prototype.events, this.events);
this.template = this.loadTemplate('edit-xblock-modal'); this.template = this.loadTemplate('edit-xblock-modal');
this.editorModeButtonTemplate = this.loadTemplate('editor-mode-button'); this.editorModeButtonTemplate = this.loadTemplate('editor-mode-button');
}, },
......
...@@ -38,7 +38,7 @@ define(['jquery', 'underscore', 'gettext', 'js/views/modals/base_modal'], ...@@ -38,7 +38,7 @@ define(['jquery', 'underscore', 'gettext', 'js/views/modals/base_modal'],
return this.template({ return this.template({
response: this.response, response: this.response,
num_errors: this.response.length, num_errors: this.response.length
}); });
}, },
...@@ -57,7 +57,7 @@ define(['jquery', 'underscore', 'gettext', 'js/views/modals/base_modal'], ...@@ -57,7 +57,7 @@ define(['jquery', 'underscore', 'gettext', 'js/views/modals/base_modal'],
// hide the modal // hide the modal
BaseModal.prototype.hide.call(this); BaseModal.prototype.hide.call(this);
}, }
}); });
return ValidationErrorModal; return ValidationErrorModal;
......
...@@ -6,12 +6,14 @@ define(["jquery", "underscore", "gettext", "js/views/pages/container", "js/views ...@@ -6,12 +6,14 @@ define(["jquery", "underscore", "gettext", "js/views/pages/container", "js/views
'use strict'; 'use strict';
var PagedXBlockContainerPage = XBlockContainerPage.extend({ var PagedXBlockContainerPage = XBlockContainerPage.extend({
events: {"click .toggle-preview-button": "toggleChildrenPreviews"}, events: _.extend({}, XBlockContainerPage.prototype.events, {
'click .toggle-preview-button': 'toggleChildrenPreviews'
}),
defaultViewClass: PagedContainerView, defaultViewClass: PagedContainerView,
components_on_init: false, components_on_init: false,
initialize: function (options){ initialize: function (options) {
this.events = _.extend({}, XBlockContainerPage.prototype.events, this.events);
this.page_size = options.page_size || 10; this.page_size = options.page_size || 10;
this.showChildrenPreviews = options.showChildrenPreviews || true; this.showChildrenPreviews = options.showChildrenPreviews || true;
XBlockContainerPage.prototype.initialize.call(this, options); XBlockContainerPage.prototype.initialize.call(this, options);
......
define(["jquery", "underscore", "gettext", "js/views/modals/base_modal", "jquery.form"], define(["jquery", "underscore", "gettext", "js/views/modals/base_modal", "jquery.form"],
function($, _, gettext, BaseModal) { function($, _, gettext, BaseModal) {
var UploadDialog = BaseModal.extend({ var UploadDialog = BaseModal.extend({
events: { events: _.extend({}, BaseModal.prototype.events, {
"change input[type=file]": "selectFile", "change input[type=file]": "selectFile",
"click .action-upload": "upload" "click .action-upload": "upload"
}, }),
options: $.extend({}, BaseModal.prototype.options, { options: $.extend({}, BaseModal.prototype.options, {
modalName: 'assetupload', modalName: 'assetupload',
...@@ -15,7 +15,6 @@ define(["jquery", "underscore", "gettext", "js/views/modals/base_modal", "jquery ...@@ -15,7 +15,6 @@ define(["jquery", "underscore", "gettext", "js/views/modals/base_modal", "jquery
initialize: function() { initialize: function() {
BaseModal.prototype.initialize.call(this); BaseModal.prototype.initialize.call(this);
this.events = _.extend({}, BaseModal.prototype.events, this.events);
this.template = this.loadTemplate("upload-dialog"); this.template = this.loadTemplate("upload-dialog");
this.listenTo(this.model, "change", this.renderContents); this.listenTo(this.model, "change", this.renderContents);
this.options.title = this.model.get('title'); this.options.title = this.model.get('title');
......
...@@ -17,11 +17,11 @@ function($, Backbone, _, Utils) { ...@@ -17,11 +17,11 @@ function($, Backbone, _, Utils) {
uploadTpl: '#file-upload', uploadTpl: '#file-upload',
initialize: function () { initialize: function (options) {
_.bindAll(this, _.bindAll(this,
'changeHandler', 'clickHandler', 'xhrResetProgressBar', 'xhrProgressHandler', 'xhrCompleteHandler' 'changeHandler', 'clickHandler', 'xhrResetProgressBar', 'xhrProgressHandler', 'xhrCompleteHandler'
); );
this.options = _.extend({}, options);
this.file = false; this.file = false;
this.render(); this.render();
}, },
......
...@@ -28,11 +28,13 @@ function($, Backbone, _, Utils, FileUploader, gettext) { ...@@ -28,11 +28,13 @@ function($, Backbone, _, Utils, FileUploader, gettext) {
choose: '#transcripts-choose' choose: '#transcripts-choose'
}, },
initialize: function () { initialize: function (options) {
_.bindAll(this, _.bindAll(this,
'importHandler', 'replaceHandler', 'chooseHandler', 'useExistingHandler', 'showError', 'hideError' 'importHandler', 'replaceHandler', 'chooseHandler', 'useExistingHandler', 'showError', 'hideError'
); );
this.options = _.extend({}, options);
this.component_locator = this.$el.closest('[data-locator]').data('locator'); this.component_locator = this.$el.closest('[data-locator]').data('locator');
this.fileUploader = new FileUploader({ this.fileUploader = new FileUploader({
......
...@@ -25,9 +25,10 @@ function($, Backbone, _, AbstractEditor, Utils, MessageManager) { ...@@ -25,9 +25,10 @@ function($, Backbone, _, AbstractEditor, Utils, MessageManager) {
'youtube': 'http://youtube.com/' 'youtube': 'http://youtube.com/'
}, },
initialize: function () { initialize: function (options) {
// Initialize MessageManager that is responsible for // Initialize MessageManager that is responsible for
// status messages and errors. // status messages and errors.
this.options = _.extend({}, options);
var Messenger = this.options.MessageManager || MessageManager; var Messenger = this.options.MessageManager || MessageManager;
this.messenger = new Messenger({ this.messenger = new Messenger({
......
...@@ -37,7 +37,7 @@ lib_paths: ...@@ -37,7 +37,7 @@ lib_paths:
- xmodule_js/common_static/js/vendor/jquery.simulate.js - xmodule_js/common_static/js/vendor/jquery.simulate.js
- xmodule_js/common_static/common/js/vendor/underscore.js - xmodule_js/common_static/common/js/vendor/underscore.js
- xmodule_js/common_static/common/js/vendor/underscore.string.js - xmodule_js/common_static/common/js/vendor/underscore.string.js
- xmodule_js/common_static/js/vendor/backbone-min.js - xmodule_js/common_static/common/js/vendor/backbone-min.js
- xmodule_js/common_static/js/vendor/backbone-associations-min.js - xmodule_js/common_static/js/vendor/backbone-associations-min.js
- xmodule_js/common_static/js/vendor/backbone.paginator.min.js - xmodule_js/common_static/js/vendor/backbone.paginator.min.js
- xmodule_js/common_static/js/vendor/backbone-relational.min.js - xmodule_js/common_static/js/vendor/backbone-relational.min.js
......
...@@ -36,7 +36,7 @@ lib_paths: ...@@ -36,7 +36,7 @@ lib_paths:
- xmodule_js/common_static/js/vendor/jquery.cookie.js - xmodule_js/common_static/js/vendor/jquery.cookie.js
- xmodule_js/common_static/common/js/vendor/underscore.js - xmodule_js/common_static/common/js/vendor/underscore.js
- xmodule_js/common_static/common/js/vendor/underscore.string.js - xmodule_js/common_static/common/js/vendor/underscore.string.js
- xmodule_js/common_static/js/vendor/backbone-min.js - xmodule_js/common_static/common/js/vendor/backbone-min.js
- xmodule_js/common_static/js/vendor/backbone-associations-min.js - xmodule_js/common_static/js/vendor/backbone-associations-min.js
- xmodule_js/common_static/js/vendor/backbone.paginator.min.js - xmodule_js/common_static/js/vendor/backbone.paginator.min.js
- xmodule_js/common_static/js/vendor/timepicker/jquery.timepicker.js - xmodule_js/common_static/js/vendor/timepicker/jquery.timepicker.js
......
...@@ -35,7 +35,7 @@ var libraryFiles = [ ...@@ -35,7 +35,7 @@ var libraryFiles = [
{pattern: 'xmodule_js/common_static/js/vendor/jquery.simulate.js', included: false}, {pattern: 'xmodule_js/common_static/js/vendor/jquery.simulate.js', included: false},
{pattern: 'xmodule_js/common_static/common/js/vendor/underscore.js', included: false}, {pattern: 'xmodule_js/common_static/common/js/vendor/underscore.js', included: false},
{pattern: 'xmodule_js/common_static/common/js/vendor/underscore.string.js', included: false}, {pattern: 'xmodule_js/common_static/common/js/vendor/underscore.string.js', included: false},
{pattern: 'xmodule_js/common_static/js/vendor/backbone-min.js', included: false}, {pattern: 'xmodule_js/common_static/common/js/vendor/backbone-min.js', included: false},
{pattern: 'xmodule_js/common_static/js/vendor/backbone-associations-min.js', included: false}, {pattern: 'xmodule_js/common_static/js/vendor/backbone-associations-min.js', included: false},
{pattern: 'xmodule_js/common_static/js/vendor/backbone.paginator.min.js', included: false}, {pattern: 'xmodule_js/common_static/js/vendor/backbone.paginator.min.js', included: false},
{pattern: 'xmodule_js/common_static/js/vendor/backbone-relational.min.js', included: false}, {pattern: 'xmodule_js/common_static/js/vendor/backbone-relational.min.js', included: false},
......
...@@ -35,7 +35,7 @@ var libraryFiles = [ ...@@ -35,7 +35,7 @@ var libraryFiles = [
{pattern: 'xmodule_js/common_static/js/vendor/jquery.cookie.js', included: false}, {pattern: 'xmodule_js/common_static/js/vendor/jquery.cookie.js', included: false},
{pattern: 'xmodule_js/common_static/common/js/vendor/underscore.js', included: false}, {pattern: 'xmodule_js/common_static/common/js/vendor/underscore.js', included: false},
{pattern: 'xmodule_js/common_static/common/js/vendor/underscore.string.js', included: false}, {pattern: 'xmodule_js/common_static/common/js/vendor/underscore.string.js', included: false},
{pattern: 'xmodule_js/common_static/js/vendor/backbone-min.js', included: false}, {pattern: 'xmodule_js/common_static/common/js/vendor/backbone-min.js', included: false},
{pattern: 'xmodule_js/common_static/js/vendor/backbone-associations-min.js', included: false}, {pattern: 'xmodule_js/common_static/js/vendor/backbone-associations-min.js', included: false},
{pattern: 'xmodule_js/common_static/js/vendor/backbone.paginator.min.js', included: false}, {pattern: 'xmodule_js/common_static/js/vendor/backbone.paginator.min.js', included: false},
{pattern: 'xmodule_js/common_static/js/vendor/timepicker/jquery.timepicker.js', included: false}, {pattern: 'xmodule_js/common_static/js/vendor/timepicker/jquery.timepicker.js', included: false},
......
...@@ -15,7 +15,7 @@ class RequireJSPathOverridesTest(TestCase): ...@@ -15,7 +15,7 @@ class RequireJSPathOverridesTest(TestCase):
OVERRIDES = { OVERRIDES = {
'jquery': 'js/vendor/jquery.min.js', 'jquery': 'js/vendor/jquery.min.js',
'backbone': 'js/vendor/backbone-min.js', 'backbone': 'common/js/vendor/backbone-min.js',
'text': 'js/vendor/text.js' 'text': 'js/vendor/text.js'
} }
...@@ -26,7 +26,7 @@ class RequireJSPathOverridesTest(TestCase): ...@@ -26,7 +26,7 @@ class RequireJSPathOverridesTest(TestCase):
"paths: {", "paths: {",
"'jquery': 'js/vendor/jquery.min',", "'jquery': 'js/vendor/jquery.min',",
"'text': 'js/vendor/text',", "'text': 'js/vendor/text',",
"'backbone': 'js/vendor/backbone-min'", "'backbone': 'common/js/vendor/backbone-min'",
"}", "}",
"});", "});",
"}).call(this, require || RequireJS.require);", "}).call(this, require || RequireJS.require);",
......
...@@ -46,7 +46,7 @@ lib_paths: ...@@ -46,7 +46,7 @@ lib_paths:
- common_static/js/vendor/jquery.cookie.js - common_static/js/vendor/jquery.cookie.js
- common_static/js/vendor/json2.js - common_static/js/vendor/json2.js
- common_static/common/js/vendor/underscore.js - common_static/common/js/vendor/underscore.js
- common_static/js/vendor/backbone-min.js - common_static/common/js/vendor/backbone-min.js
- common_static/js/vendor/jquery.leanModal.js - common_static/js/vendor/jquery.leanModal.js
- common_static/js/vendor/CodeMirror/codemirror.js - common_static/js/vendor/CodeMirror/codemirror.js
- common_static/js/vendor/tinymce/js/tinymce/jquery.tinymce.min.js - common_static/js/vendor/tinymce/js/tinymce/jquery.tinymce.min.js
......
...@@ -45,7 +45,7 @@ var libraryFiles = [ ...@@ -45,7 +45,7 @@ var libraryFiles = [
{pattern: 'common_static/js/vendor/jquery.cookie.js', included: true}, {pattern: 'common_static/js/vendor/jquery.cookie.js', included: true},
{pattern: 'common_static/js/vendor/json2.js', included: true}, {pattern: 'common_static/js/vendor/json2.js', included: true},
{pattern: 'common_static/common/js/vendor/underscore.js', included: true}, {pattern: 'common_static/common/js/vendor/underscore.js', included: true},
{pattern: 'common_static/js/vendor/backbone-min.js', included: true}, {pattern: 'common_static/common/js/vendor/backbone-min.js', included: true},
{pattern: 'common_static/js/vendor/jquery.leanModal.js', included: true}, {pattern: 'common_static/js/vendor/jquery.leanModal.js', included: true},
{pattern: 'common_static/js/vendor/CodeMirror/codemirror.js', included: true}, {pattern: 'common_static/js/vendor/CodeMirror/codemirror.js', included: true},
{pattern: 'common_static/js/vendor/tinymce/js/tinymce/jquery.tinymce.min.js', included: true}, {pattern: 'common_static/js/vendor/tinymce/js/tinymce/jquery.tinymce.min.js', included: true},
......
...@@ -20,6 +20,7 @@ if Backbone? ...@@ -20,6 +20,7 @@ if Backbone?
super() super()
@mode = options.mode or "inline" # allowed values are "tab" or "inline" @mode = options.mode or "inline" # allowed values are "tab" or "inline"
@context = options.context or "course" # allowed values are "course" or "standalone" @context = options.context or "course" # allowed values are "course" or "standalone"
@course_settings = options.course_settings
if @mode not in ["tab", "inline"] if @mode not in ["tab", "inline"]
throw new Error("invalid mode: " + @mode) throw new Error("invalid mode: " + @mode)
...@@ -307,7 +308,7 @@ if Backbone? ...@@ -307,7 +308,7 @@ if Backbone?
model: @model model: @model
mode: @mode mode: @mode
context: @context context: @context
course_settings: @options.course_settings course_settings: @course_settings
) )
@editView.bind "thread:updated thread:cancel_edit", @closeEditView @editView.bind "thread:updated thread:cancel_edit", @closeEditView
@editView.bind "comment:endorse", @endorseThread @editView.bind "comment:endorse", @endorseThread
......
...@@ -20,7 +20,12 @@ ...@@ -20,7 +20,12 @@
'use strict'; 'use strict';
define(['backbone.paginator'], function (BackbonePaginator) { define(['backbone.paginator'], function (BackbonePaginator) {
var PagingCollection = BackbonePaginator.requestPager.extend({ var PagingCollection = BackbonePaginator.requestPager.extend({
initialize: function () { initialize: function (models, options) {
options = options || {};
if (options.url) {
this.url = options.url;
}
var self = this; var self = this;
// These must be initialized in the constructor because otherwise all PagingCollections would point // These must be initialized in the constructor because otherwise all PagingCollections would point
// to the same object references for sortableFields and filterableFields. // to the same object references for sortableFields and filterableFields.
......
...@@ -59,7 +59,8 @@ ...@@ -59,7 +59,8 @@
*/ */
}, },
initialize: function() { initialize: function(options) {
this.options = _.extend({}, this.options, options);
if (!this.options.type) { if (!this.options.type) {
throw "SystemFeedback: type required (given " + throw "SystemFeedback: type required (given " +
JSON.stringify(this.options) + ")"; JSON.stringify(this.options) + ")";
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
className: this.type + '-container', className: this.type + '-container',
itemViewClass: this.itemViewClass itemViewClass: this.itemViewClass
}); });
this.listView = new ItemListView({collection: this.options.collection}); this.listView = new ItemListView({collection: this.collection});
this.headerView = this.createHeaderView(); this.headerView = this.createHeaderView();
this.footerView = this.createFooterView(); this.footerView = this.createFooterView();
this.collection.on('page_changed', function () { this.collection.on('page_changed', function () {
...@@ -46,12 +46,12 @@ ...@@ -46,12 +46,12 @@
paginationLabel: gettext("Pagination"), paginationLabel: gettext("Pagination"),
createHeaderView: function() { createHeaderView: function() {
return new PagingHeader({collection: this.options.collection, srInfo: this.srInfo}); return new PagingHeader({collection: this.collection, srInfo: this.srInfo});
}, },
createFooterView: function() { createFooterView: function() {
return new PagingFooter({ return new PagingFooter({
collection: this.options.collection, hideWhenOnePage: true, collection: this.collection, hideWhenOnePage: true,
paginationLabel: this.paginationLabel paginationLabel: this.paginationLabel
}); });
}, },
......
...@@ -21,8 +21,7 @@ define([ ...@@ -21,8 +21,7 @@ define([
current_page: 1, current_page: 1,
start: 0, start: 0,
results: _.first(results, perPage) results: _.first(results, perPage)
}, }
{parse: true}
); );
collection.start = 0; collection.start = 0;
collection.totalCount = results.length; collection.totalCount = results.length;
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
'text': 'js/vendor/requirejs/text', 'text': 'js/vendor/requirejs/text',
'underscore': 'common/js/vendor/underscore', 'underscore': 'common/js/vendor/underscore',
'underscore.string': 'common/js/vendor/underscore.string', 'underscore.string': 'common/js/vendor/underscore.string',
'backbone': 'js/vendor/backbone-min', 'backbone': 'common/js/vendor/backbone-min',
'backbone.associations': 'js/vendor/backbone-associations-min', 'backbone.associations': 'js/vendor/backbone-associations-min',
'backbone.paginator': 'js/vendor/backbone.paginator.min', 'backbone.paginator': 'js/vendor/backbone.paginator.min',
'backbone-super': 'js/vendor/backbone-super', 'backbone-super': 'js/vendor/backbone-super',
......
...@@ -35,7 +35,7 @@ lib_paths: ...@@ -35,7 +35,7 @@ lib_paths:
- js/vendor/mustache.js - js/vendor/mustache.js
- common/js/vendor/underscore.js - common/js/vendor/underscore.js
- common/js/vendor/underscore.string.js - common/js/vendor/underscore.string.js
- js/vendor/backbone-min.js - common/js/vendor/backbone-min.js
- js/vendor/jquery.timeago.js - js/vendor/jquery.timeago.js
- js/vendor/URI.min.js - js/vendor/URI.min.js
- js/vendor/draggabilly.js - js/vendor/draggabilly.js
......
...@@ -36,7 +36,7 @@ lib_paths: ...@@ -36,7 +36,7 @@ lib_paths:
- js/vendor/jquery.truncate.js - js/vendor/jquery.truncate.js
- common/js/vendor/underscore.js - common/js/vendor/underscore.js
- common/js/vendor/underscore.string.js - common/js/vendor/underscore.string.js
- js/vendor/backbone-min.js - common/js/vendor/backbone-min.js
- js/vendor/backbone.paginator.min.js - js/vendor/backbone.paginator.min.js
- js/vendor/jquery.timeago.js - js/vendor/jquery.timeago.js
- js/vendor/URI.min.js - js/vendor/URI.min.js
......
...@@ -39,7 +39,7 @@ var libraryFiles = [ ...@@ -39,7 +39,7 @@ var libraryFiles = [
{pattern: 'js/vendor/mustache.js', included: true}, {pattern: 'js/vendor/mustache.js', included: true},
{pattern: 'common/js/vendor/underscore.js', included: true}, {pattern: 'common/js/vendor/underscore.js', included: true},
{pattern: 'common/js/vendor/underscore.string.js', included: true}, {pattern: 'common/js/vendor/underscore.string.js', included: true},
{pattern: 'js/vendor/backbone-min.js', included: true}, {pattern: 'common/js/vendor/backbone-min.js', included: true},
{pattern: 'js/vendor/jquery.timeago.js', included: true}, {pattern: 'js/vendor/jquery.timeago.js', included: true},
{pattern: 'js/vendor/URI.min.js', included: true}, {pattern: 'js/vendor/URI.min.js', included: true},
{pattern: 'coffee/src/ajax_prefix.js', included: true}, {pattern: 'coffee/src/ajax_prefix.js', included: true},
......
...@@ -37,7 +37,7 @@ var libraryFiles = [ ...@@ -37,7 +37,7 @@ var libraryFiles = [
{pattern: 'js/vendor/jquery.truncate.js', included: false}, {pattern: 'js/vendor/jquery.truncate.js', included: false},
{pattern: 'common/js/vendor/underscore.js', included: false}, {pattern: 'common/js/vendor/underscore.js', included: false},
{pattern: 'common/js/vendor/underscore.string.js', included: false}, {pattern: 'common/js/vendor/underscore.string.js', included: false},
{pattern: 'js/vendor/backbone-min.js', included: false}, {pattern: 'common/js/vendor/backbone-min.js', included: false},
{pattern: 'js/vendor/backbone.paginator.min.js', included: false}, {pattern: 'js/vendor/backbone.paginator.min.js', included: false},
{pattern: 'js/vendor/jquery.timeago.js', included: false}, {pattern: 'js/vendor/jquery.timeago.js', included: false},
{pattern: 'js/vendor/URI.min.js', included: false}, {pattern: 'js/vendor/URI.min.js', included: false},
......
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
function(PagingCollection) { function(PagingCollection) {
var BaseCollection = PagingCollection.extend({ var BaseCollection = PagingCollection.extend({
initialize: function(options) { initialize: function(options) {
this.url = options.url;
PagingCollection.prototype.initialize.call(this); PagingCollection.prototype.initialize.call(this);
this.course_id = options.course_id; this.course_id = options.course_id;
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
define(['teams/js/collections/team'], function (TeamCollection) { define(['teams/js/collections/team'], function (TeamCollection) {
var MyTeamsCollection = TeamCollection.extend({ var MyTeamsCollection = TeamCollection.extend({
initialize: function (teams, options) { initialize: function (teams, options) {
this.url = options.url;
TeamCollection.prototype.initialize.call(this, teams, options); TeamCollection.prototype.initialize.call(this, teams, options);
delete this.server_api.topic_id; delete this.server_api.topic_id;
this.server_api = _.extend(this.server_api, { this.server_api = _.extend(this.server_api, {
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
sortField: 'last_activity_at', sortField: 'last_activity_at',
initialize: function(teams, options) { initialize: function(teams, options) {
this.url = options.url;
var self = this; var self = this;
BaseCollection.prototype.initialize.call(this, options); BaseCollection.prototype.initialize.call(this, options);
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
function(BaseCollection, TeamMembershipModel) { function(BaseCollection, TeamMembershipModel) {
var TeamMembershipCollection = BaseCollection.extend({ var TeamMembershipCollection = BaseCollection.extend({
initialize: function(team_memberships, options) { initialize: function(team_memberships, options) {
this.url = options.url;
var self = this; var self = this;
BaseCollection.prototype.initialize.call(this, options); BaseCollection.prototype.initialize.call(this, options);
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
function(_, gettext, BaseCollection, TopicModel) { function(_, gettext, BaseCollection, TopicModel) {
var TopicCollection = BaseCollection.extend({ var TopicCollection = BaseCollection.extend({
initialize: function(topics, options) { initialize: function(topics, options) {
var self = this; var self = this;
BaseCollection.prototype.initialize.call(this, options); BaseCollection.prototype.initialize.call(this, options);
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
}, },
initialize: function(options) { initialize: function(options) {
this.options = _.extend({}, options);
// The URL ends with team_id,request_username. We want to replace // The URL ends with team_id,request_username. We want to replace
// the last occurrence of team_id with the actual team_id, and remove request_username // the last occurrence of team_id with the actual team_id, and remove request_username
// as the actual user to be removed from the team will be added on before calling DELETE. // as the actual user to be removed from the team will be added on before calling DELETE.
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
}, },
initialize: function(options) { initialize: function(options) {
this.options = _.extend({}, options);
this.showSortControls = options.showSortControls; this.showSortControls = options.showSortControls;
this.context = options.context; this.context = options.context;
this.myTeamsCollection = options.myTeamsCollection; this.myTeamsCollection = options.myTeamsCollection;
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
}, },
initialize: function (options) { initialize: function (options) {
this.options = _.extend({}, options);
this.itemViewClass = TopicCardView.extend({ this.itemViewClass = TopicCardView.extend({
router: options.router, router: options.router,
srInfo: this.srInfo srInfo: this.srInfo
......
...@@ -1268,7 +1268,7 @@ base_vendor_js = [ ...@@ -1268,7 +1268,7 @@ base_vendor_js = [
'js/vendor/requirejs/require.js', 'js/vendor/requirejs/require.js',
'js/RequireJS-namespace-undefine.js', 'js/RequireJS-namespace-undefine.js',
'js/vendor/URI.min.js', 'js/vendor/URI.min.js',
'js/vendor/backbone-min.js', 'common/js/vendor/backbone-min.js',
'edx-pattern-library/js/modernizr-custom.js', 'edx-pattern-library/js/modernizr-custom.js',
] ]
......
...@@ -9,7 +9,11 @@ ...@@ -9,7 +9,11 @@
function(Backbone, CertificateInvalidation) { function(Backbone, CertificateInvalidation) {
return Backbone.Collection.extend({ return Backbone.Collection.extend({
model: CertificateInvalidation model: CertificateInvalidation,
initialize: function(models, options) {
this.url = options.url;
}
}); });
} }
); );
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
model: CertificateExceptionModel, model: CertificateExceptionModel,
initialize: function(attrs, options){ initialize: function(attrs, options){
this.url = options.url;
this.generate_certificates_url = options.generate_certificates_url; this.generate_certificates_url = options.generate_certificates_url;
}, },
......
...@@ -19,8 +19,8 @@ ...@@ -19,8 +19,8 @@
notes: '' notes: ''
}, },
url: function() { initialize: function (attributes, options) {
return this.get('url'); this.url = options.url;
}, },
validate: function(attrs) { validate: function(attrs) {
......
...@@ -35,11 +35,15 @@ ...@@ -35,11 +35,15 @@
var notes = this.$("#certificate-invalidation-notes").val(); var notes = this.$("#certificate-invalidation-notes").val();
var message = ""; var message = "";
var certificate_invalidation = new CertificateInvalidationModel({ var certificate_invalidation = new CertificateInvalidationModel(
url: this.collection.url, {
user: user, user: user,
notes: notes notes: notes
}); },
{
url: this.collection.url
}
);
if (this.collection.findWhere({user: user})) { if (this.collection.findWhere({user: user})) {
message = gettext("Certificate of <%= user %> has already been invalidated. Please check your spelling and retry."); // jshint ignore:line message = gettext("Certificate of <%= user %> has already been invalidated. Please check your spelling and retry."); // jshint ignore:line
......
...@@ -9,6 +9,7 @@ define([ ...@@ -9,6 +9,7 @@ define([
initialize: function(models, options) { initialize: function(models, options) {
PagingCollection.prototype.initialize.call(this); PagingCollection.prototype.initialize.call(this);
this.url = options.url;
this.perPage = options.perPage; this.perPage = options.perPage;
this.server_api = _.pick(this.server_api, "page", "page_size"); this.server_api = _.pick(this.server_api, "page", "page_size");
if (options.text) { if (options.text) {
......
...@@ -11,7 +11,8 @@ define([ ...@@ -11,7 +11,8 @@ define([
return 'note-section-' + _.uniqueId(); return 'note-section-' + _.uniqueId();
}, },
initialize: function () { initialize: function (options) {
this.options = _.extend({}, options);
this.template = _.template(this.options.template); this.template = _.template(this.options.template);
this.className = this.options.className; this.className = this.options.className;
}, },
...@@ -37,8 +38,9 @@ define([ ...@@ -37,8 +38,9 @@ define([
}, },
template: _.template('<h3 class="course-title"><%- chapterName %></h3>'), template: _.template('<h3 class="course-title"><%- chapterName %></h3>'),
initialize: function () { initialize: function (options) {
this.children = []; this.children = [];
this.options = _.extend({}, options);
}, },
render: function () { render: function () {
......
...@@ -17,6 +17,7 @@ define([ ...@@ -17,6 +17,7 @@ define([
}, },
initialize: function (options) { initialize: function (options) {
this.options = _.extend({}, options);
this.template = templateUtils.loadTemplate('note-item'); this.template = templateUtils.loadTemplate('note-item');
this.logger = NotesLogger.getLogger('note_item', options.debug); this.logger = NotesLogger.getLogger('note_item', options.debug);
this.listenTo(this.model, 'change:is_expanded', this.render); this.listenTo(this.model, 'change:is_expanded', this.render);
......
...@@ -12,8 +12,9 @@ function (gettext, _, Backbone, NoteItemView, PagingHeaderView, PagingFooterView ...@@ -12,8 +12,9 @@ function (gettext, _, Backbone, NoteItemView, PagingHeaderView, PagingFooterView
'tabindex': -1 'tabindex': -1
}, },
initialize: function () { initialize: function (options) {
this.children = []; this.children = [];
this.options = _.extend({}, options);
if (this.options.createHeaderFooter) { if (this.options.createHeaderFooter) {
this.pagingHeaderView = new PagingHeaderView({collection: this.collection}); this.pagingHeaderView = new PagingHeaderView({collection: this.collection});
this.pagingFooterView = new PagingFooterView({collection: this.collection, hideWhenOnePage: true}); this.pagingFooterView = new PagingFooterView({collection: this.collection, hideWhenOnePage: true});
......
...@@ -52,6 +52,7 @@ define([ ...@@ -52,6 +52,7 @@ define([
}, },
initialize: function (options) { initialize: function (options) {
this.options = _.extend({}, options);
_.bindAll(this, 'onBeforeSearchStart', 'onSearch', 'onSearchError'); _.bindAll(this, 'onBeforeSearchStart', 'onSearch', 'onSearchError');
TabView.prototype.initialize.call(this, options); TabView.prototype.initialize.call(this, options);
this.searchResults = null; this.searchResults = null;
......
...@@ -24,6 +24,7 @@ define([ ...@@ -24,6 +24,7 @@ define([
}, },
initialize: function (options) { initialize: function (options) {
this.options = _.extend({}, options);
TabView.prototype.initialize.call(this, options); TabView.prototype.initialize.call(this, options);
_.bindAll(this, 'scrollToTag'); _.bindAll(this, 'scrollToTag');
this.options.scrollToTag = this.scrollToTag; this.options.scrollToTag = this.scrollToTag;
......
...@@ -29,7 +29,7 @@ define([ ...@@ -29,7 +29,7 @@ define([
beforeEach(function() { beforeEach(function() {
certificate_invalidation = new CertificateInvalidationModel({user: 'test_user'}); certificate_invalidation = new CertificateInvalidationModel({user: 'test_user'}, {url: 'test/url/'});
certificate_invalidation.set({ certificate_invalidation.set({
notes: "Test notes" notes: "Test notes"
}); });
...@@ -174,7 +174,9 @@ define([ ...@@ -174,7 +174,9 @@ define([
it("verifies view is rendered on add/remove to collection", function() { it("verifies view is rendered on add/remove to collection", function() {
var user = 'test3', var user = 'test3',
notes = 'test3 notes', notes = 'test3 notes',
model = new CertificateInvalidationModel({user: user, notes: notes}); model = new CertificateInvalidationModel(
{user: user, notes: notes}, {url: certificate_invalidation_url}
);
// Add another model in collection and verify it is rendered // Add another model in collection and verify it is rendered
view.collection.add(model); view.collection.add(model);
......
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
'text': 'xmodule_js/common_static/js/vendor/requirejs/text', 'text': 'xmodule_js/common_static/js/vendor/requirejs/text',
'underscore': 'common/js/vendor/underscore', 'underscore': 'common/js/vendor/underscore',
'underscore.string': 'common/js/vendor/underscore.string', 'underscore.string': 'common/js/vendor/underscore.string',
'backbone': 'xmodule_js/common_static/js/vendor/backbone-min', 'backbone': 'xmodule_js/common_static/common/js/vendor/backbone-min',
'backbone.associations': 'xmodule_js/common_static/js/vendor/backbone-associations-min', 'backbone.associations': 'xmodule_js/common_static/js/vendor/backbone-associations-min',
'backbone.paginator': 'xmodule_js/common_static/js/vendor/backbone.paginator.min', 'backbone.paginator': 'xmodule_js/common_static/js/vendor/backbone.paginator.min',
'backbone-super': 'js/vendor/backbone-super', 'backbone-super': 'js/vendor/backbone-super',
......
...@@ -654,6 +654,7 @@ define([ ...@@ -654,6 +654,7 @@ define([
function navigatesToSearch () { function navigatesToSearch () {
var requests = AjaxHelpers.requests(this); var requests = AjaxHelpers.requests(this);
Backbone.history.start();
Backbone.history.loadUrl('search/query'); Backbone.history.loadUrl('search/query');
expect(requests[0].requestBody).toContain('search_string=query'); expect(requests[0].requestBody).toContain('search_string=query');
} }
...@@ -687,6 +688,10 @@ define([ ...@@ -687,6 +688,10 @@ define([
this.$searchResults = $('.courseware-results'); this.$searchResults = $('.courseware-results');
}); });
afterEach(function (){
Backbone.history.stop();
});
it('shows loading message on search', showsLoadingMessage); it('shows loading message on search', showsLoadingMessage);
it('performs search', performsSearch); it('performs search', performsSearch);
it('shows an error message', showsErrorMessage); it('shows an error message', showsErrorMessage);
...@@ -715,6 +720,10 @@ define([ ...@@ -715,6 +720,10 @@ define([
this.$searchResults = $('#dashboard-search-results'); this.$searchResults = $('#dashboard-search-results');
}); });
afterEach(function (){
Backbone.history.stop();
});
it('shows loading message on search', showsLoadingMessage); it('shows loading message on search', showsLoadingMessage);
it('performs search', performsSearch); it('performs search', performsSearch);
it('shows an error message', showsErrorMessage); it('shows an error message', showsErrorMessage);
......
...@@ -49,6 +49,7 @@ ...@@ -49,6 +49,7 @@
AccountSettingsFieldViews.PasswordFieldView = FieldViews.LinkFieldView.extend({ AccountSettingsFieldViews.PasswordFieldView = FieldViews.LinkFieldView.extend({
initialize: function (options) { initialize: function (options) {
this.options = _.extend({}, options);
this._super(options); this._super(options);
_.bindAll(this, 'resetPassword'); _.bindAll(this, 'resetPassword');
}, },
...@@ -111,6 +112,7 @@ ...@@ -111,6 +112,7 @@
AccountSettingsFieldViews.AuthFieldView = FieldViews.LinkFieldView.extend({ AccountSettingsFieldViews.AuthFieldView = FieldViews.LinkFieldView.extend({
initialize: function (options) { initialize: function (options) {
this.options = _.extend({}, options);
this._super(options); this._super(options);
_.bindAll(this, 'redirect_to', 'disconnect', 'successMessage', 'inProgressMessage'); _.bindAll(this, 'redirect_to', 'disconnect', 'successMessage', 'inProgressMessage');
}, },
......
...@@ -6,7 +6,8 @@ ...@@ -6,7 +6,8 @@
var AccountSettingsView = Backbone.View.extend({ var AccountSettingsView = Backbone.View.extend({
initialize: function () { initialize: function (options) {
this.options = _.extend({}, options);
_.bindAll(this, 'render', 'renderFields', 'showLoadingError'); _.bindAll(this, 'render', 'renderFields', 'showLoadingError');
}, },
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
var BadgeView = Backbone.View.extend({ var BadgeView = Backbone.View.extend({
initialize: function(options) { initialize: function(options) {
this.options = _.extend({}, options);
this.context = _.extend(this.options.model.toJSON(), { this.context = _.extend(this.options.model.toJSON(), {
'created': new Moment(this.options.model.toJSON().created), 'created': new Moment(this.options.model.toJSON().created),
'ownProfile': options.ownProfile, 'ownProfile': options.ownProfile,
......
...@@ -9,7 +9,8 @@ ...@@ -9,7 +9,8 @@
var LearnerProfileView = Backbone.View.extend({ var LearnerProfileView = Backbone.View.extend({
initialize: function () { initialize: function (options) {
this.options = _.extend({}, options);
_.bindAll(this, 'showFullProfile', 'render', 'renderFields', 'showLoadingError'); _.bindAll(this, 'showFullProfile', 'render', 'renderFields', 'showLoadingError');
this.listenTo(this.options.preferencesModel, "change:" + 'account_privacy', this.render); this.listenTo(this.options.preferencesModel, "change:" + 'account_privacy', this.render);
var Router = Backbone.Router.extend({ var Router = Backbone.Router.extend({
......
...@@ -9,6 +9,9 @@ ...@@ -9,6 +9,9 @@
'class': 'wrapper-profile-section-two' 'class': 'wrapper-profile-section-two'
}, },
template: _.template(sectionTwoTemplate), template: _.template(sectionTwoTemplate),
initialize: function (options) {
this.options = _.extend({}, options);
},
render: function () { render: function () {
var self = this; var self = this;
var showFullProfile = this.options.showFullProfile(); var showFullProfile = this.options.showFullProfile();
......
...@@ -17,6 +17,9 @@ ...@@ -17,6 +17,9 @@
'focus .focusguard-start': 'focusGuardStart', 'focus .focusguard-start': 'focusGuardStart',
'focus .focusguard-end': 'focusGuardEnd' 'focus .focusguard-end': 'focusGuardEnd'
}, },
initialize: function (options) {
this.options = _.extend({}, options);
},
focusGuardStart: function () { focusGuardStart: function () {
// Should only be selected directly if shift-tabbing from the start, so grab last item. // Should only be selected directly if shift-tabbing from the start, so grab last item.
this.$el.find("a").last().focus(); this.$el.find("a").last().focus();
......
...@@ -46,6 +46,11 @@ ...@@ -46,6 +46,11 @@
'success': gettext('Your changes have been saved.') 'success': gettext('Your changes have been saved.')
}, },
constructor: function(options) {
this.options = _.extend({}, options);
Backbone.View.apply(this, arguments);
},
initialize: function () { initialize: function () {
this.template = _.template(this.fieldTemplate || ''); this.template = _.template(this.fieldTemplate || '');
......
...@@ -38,6 +38,7 @@ ...@@ -38,6 +38,7 @@
}, },
initialize: function (options) { initialize: function (options) {
this.options = _.extend({}, options);
this._super(options); this._super(options);
_.bindAll(this, 'render', 'imageChangeSucceeded', 'imageChangeFailed', 'fileSelected', _.bindAll(this, 'render', 'imageChangeSucceeded', 'imageChangeFailed', 'fileSelected',
'watchForPageUnload', 'onBeforeUnload'); 'watchForPageUnload', 'onBeforeUnload');
......
...@@ -57,7 +57,7 @@ lib_paths: ...@@ -57,7 +57,7 @@ lib_paths:
- xmodule_js/common_static/js/src/ - xmodule_js/common_static/js/src/
- xmodule_js/common_static/common/js/vendor/underscore.js - xmodule_js/common_static/common/js/vendor/underscore.js
- xmodule_js/common_static/common/js/vendor/underscore.string.js - xmodule_js/common_static/common/js/vendor/underscore.string.js
- xmodule_js/common_static/js/vendor/backbone-min.js - xmodule_js/common_static/common/js/vendor/backbone-min.js
- xmodule_js/common_static/js/vendor/backbone.paginator.min.js - xmodule_js/common_static/js/vendor/backbone.paginator.min.js
- xmodule_js/common_static/js/vendor/edxnotes/annotator-full.min.js - xmodule_js/common_static/js/vendor/edxnotes/annotator-full.min.js
- xmodule_js/common_static/js/test/i18n.js - xmodule_js/common_static/js/test/i18n.js
......
...@@ -61,7 +61,7 @@ var libraryFiles = [ ...@@ -61,7 +61,7 @@ var libraryFiles = [
{pattern: 'xmodule_js/common_static/js/src/**/*.js', included: false}, {pattern: 'xmodule_js/common_static/js/src/**/*.js', included: false},
{pattern: 'xmodule_js/common_static/common/js/vendor/underscore.js', included: false}, {pattern: 'xmodule_js/common_static/common/js/vendor/underscore.js', included: false},
{pattern: 'xmodule_js/common_static/common/js/vendor/underscore.string.js', included: false}, {pattern: 'xmodule_js/common_static/common/js/vendor/underscore.string.js', included: false},
{pattern: 'xmodule_js/common_static/js/vendor/backbone-min.js', included: false}, {pattern: 'xmodule_js/common_static/common/js/vendor/backbone-min.js', included: false},
{pattern: 'xmodule_js/common_static/js/vendor/backbone.paginator.min.js', included: false}, {pattern: 'xmodule_js/common_static/js/vendor/backbone.paginator.min.js', included: false},
{pattern: 'xmodule_js/common_static/js/vendor/edxnotes/annotator-full.min.js', included: false}, {pattern: 'xmodule_js/common_static/js/vendor/edxnotes/annotator-full.min.js', included: false},
{pattern: 'xmodule_js/common_static/js/test/i18n.js', included: false}, {pattern: 'xmodule_js/common_static/js/test/i18n.js', included: false},
......
...@@ -59,7 +59,7 @@ ...@@ -59,7 +59,7 @@
"moment-with-locales": "xmodule_js/common_static/js/vendor/moment-with-locales.min", "moment-with-locales": "xmodule_js/common_static/js/vendor/moment-with-locales.min",
"text": "js/vendor/requirejs/text", "text": "js/vendor/requirejs/text",
"logger": "js/src/logger", "logger": "js/src/logger",
"backbone": "js/vendor/backbone-min", "backbone": "common/js/vendor/backbone-min",
"backbone-super": "js/vendor/backbone-super", "backbone-super": "js/vendor/backbone-super",
"backbone.paginator": "js/vendor/backbone.paginator.min", "backbone.paginator": "js/vendor/backbone.paginator.min",
"underscore": "common/js/vendor/underscore", "underscore": "common/js/vendor/underscore",
......
...@@ -13,7 +13,7 @@ from openedx.core.djangolib.js_utils import ( ...@@ -13,7 +13,7 @@ from openedx.core.djangolib.js_utils import (
var save_url = '${save_url | n, js_escaped_string}'; var save_url = '${save_url | n, js_escaped_string}';
var schedule = ${schedule | n, dump_js_escaped_json}; var schedule = ${schedule | n, dump_js_escaped_json};
</script> </script>
<script src="${static.url('js/vendor/backbone-min.js')}"></script> <script src="${static.url('common/js/vendor/backbone-min.js')}"></script>
<script src="${static.url('js/vendor/timepicker/jquery.timepicker.js')}"></script> <script src="${static.url('js/vendor/timepicker/jquery.timepicker.js')}"></script>
<link rel="stylesheet" type="text/css" href="${static.url('js/vendor/timepicker/jquery.timepicker.css')}" /> <link rel="stylesheet" type="text/css" href="${static.url('js/vendor/timepicker/jquery.timepicker.css')}" />
<style> <style>
......
...@@ -9,7 +9,8 @@ ...@@ -9,7 +9,8 @@
"uglify-js": "2.4.24", "uglify-js": "2.4.24",
"underscore": "~1.8.3", "underscore": "~1.8.3",
"underscore.string": "~3.3.4", "underscore.string": "~3.3.4",
"picturefill": "~3.0.2" "picturefill": "~3.0.2",
"backbone": "~1.3.2"
}, },
"devDependencies": { "devDependencies": {
"edx-custom-a11y-rules": "edx/edx-custom-a11y-rules", "edx-custom-a11y-rules": "edx/edx-custom-a11y-rules",
......
...@@ -47,7 +47,8 @@ SASS_LOAD_PATHS = [ ...@@ -47,7 +47,8 @@ SASS_LOAD_PATHS = [
NPM_INSTALLED_LIBRARIES = [ NPM_INSTALLED_LIBRARIES = [
'underscore/underscore.js', 'underscore/underscore.js',
'underscore.string/dist/underscore.string.js', 'underscore.string/dist/underscore.string.js',
'picturefill/dist/picturefill.min.js' 'picturefill/dist/picturefill.min.js',
'backbone/backbone-min.js',
] ]
# Directory to install static vendor files # Directory to install static vendor files
......
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