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',
......
(function(){var t=this;var e=t.Backbone;var i=[];var r=i.push;var s=i.slice;var n=i.splice;var a;if(typeof exports!=="undefined"){a=exports}else{a=t.Backbone={}}a.VERSION="1.0.0";var h=t._;if(!h&&typeof require!=="undefined")h=require("underscore");a.$=t.jQuery||t.Zepto||t.ender||t.$;a.noConflict=function(){t.Backbone=e;return this};a.emulateHTTP=false;a.emulateJSON=false;var o=a.Events={on:function(t,e,i){if(!l(this,"on",t,[e,i])||!e)return this;this._events||(this._events={});var r=this._events[t]||(this._events[t]=[]);r.push({callback:e,context:i,ctx:i||this});return this},once:function(t,e,i){if(!l(this,"once",t,[e,i])||!e)return this;var r=this;var s=h.once(function(){r.off(t,s);e.apply(this,arguments)});s._callback=e;return this.on(t,s,i)},off:function(t,e,i){var r,s,n,a,o,u,c,f;if(!this._events||!l(this,"off",t,[e,i]))return this;if(!t&&!e&&!i){this._events={};return this}a=t?[t]:h.keys(this._events);for(o=0,u=a.length;o<u;o++){t=a[o];if(n=this._events[t]){this._events[t]=r=[];if(e||i){for(c=0,f=n.length;c<f;c++){s=n[c];if(e&&e!==s.callback&&e!==s.callback._callback||i&&i!==s.context){r.push(s)}}}if(!r.length)delete this._events[t]}}return this},trigger:function(t){if(!this._events)return this;var e=s.call(arguments,1);if(!l(this,"trigger",t,e))return this;var i=this._events[t];var r=this._events.all;if(i)c(i,e);if(r)c(r,arguments);return this},stopListening:function(t,e,i){var r=this._listeners;if(!r)return this;var s=!e&&!i;if(typeof e==="object")i=this;if(t)(r={})[t._listenerId]=t;for(var n in r){r[n].off(e,i,this);if(s)delete this._listeners[n]}return this}};var u=/\s+/;var l=function(t,e,i,r){if(!i)return true;if(typeof i==="object"){for(var s in i){t[e].apply(t,[s,i[s]].concat(r))}return false}if(u.test(i)){var n=i.split(u);for(var a=0,h=n.length;a<h;a++){t[e].apply(t,[n[a]].concat(r))}return false}return true};var c=function(t,e){var i,r=-1,s=t.length,n=e[0],a=e[1],h=e[2];switch(e.length){case 0:while(++r<s)(i=t[r]).callback.call(i.ctx);return;case 1:while(++r<s)(i=t[r]).callback.call(i.ctx,n);return;case 2:while(++r<s)(i=t[r]).callback.call(i.ctx,n,a);return;case 3:while(++r<s)(i=t[r]).callback.call(i.ctx,n,a,h);return;default:while(++r<s)(i=t[r]).callback.apply(i.ctx,e)}};var f={listenTo:"on",listenToOnce:"once"};h.each(f,function(t,e){o[e]=function(e,i,r){var s=this._listeners||(this._listeners={});var n=e._listenerId||(e._listenerId=h.uniqueId("l"));s[n]=e;if(typeof i==="object")r=this;e[t](i,r,this);return this}});o.bind=o.on;o.unbind=o.off;h.extend(a,o);var d=a.Model=function(t,e){var i;var r=t||{};e||(e={});this.cid=h.uniqueId("c");this.attributes={};h.extend(this,h.pick(e,p));if(e.parse)r=this.parse(r,e)||{};if(i=h.result(this,"defaults")){r=h.defaults({},r,i)}this.set(r,e);this.changed={};this.initialize.apply(this,arguments)};var p=["url","urlRoot","collection"];h.extend(d.prototype,o,{changed:null,validationError:null,idAttribute:"id",initialize:function(){},toJSON:function(t){return h.clone(this.attributes)},sync:function(){return a.sync.apply(this,arguments)},get:function(t){return this.attributes[t]},escape:function(t){return h.escape(this.get(t))},has:function(t){return this.get(t)!=null},set:function(t,e,i){var r,s,n,a,o,u,l,c;if(t==null)return this;if(typeof t==="object"){s=t;i=e}else{(s={})[t]=e}i||(i={});if(!this._validate(s,i))return false;n=i.unset;o=i.silent;a=[];u=this._changing;this._changing=true;if(!u){this._previousAttributes=h.clone(this.attributes);this.changed={}}c=this.attributes,l=this._previousAttributes;if(this.idAttribute in s)this.id=s[this.idAttribute];for(r in s){e=s[r];if(!h.isEqual(c[r],e))a.push(r);if(!h.isEqual(l[r],e)){this.changed[r]=e}else{delete this.changed[r]}n?delete c[r]:c[r]=e}if(!o){if(a.length)this._pending=true;for(var f=0,d=a.length;f<d;f++){this.trigger("change:"+a[f],this,c[a[f]],i)}}if(u)return this;if(!o){while(this._pending){this._pending=false;this.trigger("change",this,i)}}this._pending=false;this._changing=false;return this},unset:function(t,e){return this.set(t,void 0,h.extend({},e,{unset:true}))},clear:function(t){var e={};for(var i in this.attributes)e[i]=void 0;return this.set(e,h.extend({},t,{unset:true}))},hasChanged:function(t){if(t==null)return!h.isEmpty(this.changed);return h.has(this.changed,t)},changedAttributes:function(t){if(!t)return this.hasChanged()?h.clone(this.changed):false;var e,i=false;var r=this._changing?this._previousAttributes:this.attributes;for(var s in t){if(h.isEqual(r[s],e=t[s]))continue;(i||(i={}))[s]=e}return i},previous:function(t){if(t==null||!this._previousAttributes)return null;return this._previousAttributes[t]},previousAttributes:function(){return h.clone(this._previousAttributes)},fetch:function(t){t=t?h.clone(t):{};if(t.parse===void 0)t.parse=true;var e=this;var i=t.success;t.success=function(r){if(!e.set(e.parse(r,t),t))return false;if(i)i(e,r,t);e.trigger("sync",e,r,t)};R(this,t);return this.sync("read",this,t)},save:function(t,e,i){var r,s,n,a=this.attributes;if(t==null||typeof t==="object"){r=t;i=e}else{(r={})[t]=e}if(r&&(!i||!i.wait)&&!this.set(r,i))return false;i=h.extend({validate:true},i);if(!this._validate(r,i))return false;if(r&&i.wait){this.attributes=h.extend({},a,r)}if(i.parse===void 0)i.parse=true;var o=this;var u=i.success;i.success=function(t){o.attributes=a;var e=o.parse(t,i);if(i.wait)e=h.extend(r||{},e);if(h.isObject(e)&&!o.set(e,i)){return false}if(u)u(o,t,i);o.trigger("sync",o,t,i)};R(this,i);s=this.isNew()?"create":i.patch?"patch":"update";if(s==="patch")i.attrs=r;n=this.sync(s,this,i);if(r&&i.wait)this.attributes=a;return n},destroy:function(t){t=t?h.clone(t):{};var e=this;var i=t.success;var r=function(){e.trigger("destroy",e,e.collection,t)};t.success=function(s){if(t.wait||e.isNew())r();if(i)i(e,s,t);if(!e.isNew())e.trigger("sync",e,s,t)};if(this.isNew()){t.success();return false}R(this,t);var s=this.sync("delete",this,t);if(!t.wait)r();return s},url:function(){var t=h.result(this,"urlRoot")||h.result(this.collection,"url")||U();if(this.isNew())return t;return t+(t.charAt(t.length-1)==="/"?"":"/")+encodeURIComponent(this.id)},parse:function(t,e){return t},clone:function(){return new this.constructor(this.attributes)},isNew:function(){return this.id==null},isValid:function(t){return this._validate({},h.extend(t||{},{validate:true}))},_validate:function(t,e){if(!e.validate||!this.validate)return true;t=h.extend({},this.attributes,t);var i=this.validationError=this.validate(t,e)||null;if(!i)return true;this.trigger("invalid",this,i,h.extend(e||{},{validationError:i}));return false}});var v=["keys","values","pairs","invert","pick","omit"];h.each(v,function(t){d.prototype[t]=function(){var e=s.call(arguments);e.unshift(this.attributes);return h[t].apply(h,e)}});var g=a.Collection=function(t,e){e||(e={});if(e.url)this.url=e.url;if(e.model)this.model=e.model;if(e.comparator!==void 0)this.comparator=e.comparator;this._reset();this.initialize.apply(this,arguments);if(t)this.reset(t,h.extend({silent:true},e))};var m={add:true,remove:true,merge:true};var y={add:true,merge:false,remove:false};h.extend(g.prototype,o,{model:d,initialize:function(){},toJSON:function(t){return this.map(function(e){return e.toJSON(t)})},sync:function(){return a.sync.apply(this,arguments)},add:function(t,e){return this.set(t,h.defaults(e||{},y))},remove:function(t,e){t=h.isArray(t)?t.slice():[t];e||(e={});var i,r,s,n;for(i=0,r=t.length;i<r;i++){n=this.get(t[i]);if(!n)continue;delete this._byId[n.id];delete this._byId[n.cid];s=this.indexOf(n);this.models.splice(s,1);this.length--;if(!e.silent){e.index=s;n.trigger("remove",n,this,e)}this._removeReference(n)}return this},set:function(t,e){e=h.defaults(e||{},m);if(e.parse)t=this.parse(t,e);if(!h.isArray(t))t=t?[t]:[];var i,s,a,o,u,l;var c=e.at;var f=this.comparator&&c==null&&e.sort!==false;var d=h.isString(this.comparator)?this.comparator:null;var p=[],v=[],g={};for(i=0,s=t.length;i<s;i++){if(!(a=this._prepareModel(t[i],e)))continue;if(u=this.get(a)){if(e.remove)g[u.cid]=true;if(e.merge){u.set(a.attributes,e);if(f&&!l&&u.hasChanged(d))l=true}}else if(e.add){p.push(a);a.on("all",this._onModelEvent,this);this._byId[a.cid]=a;if(a.id!=null)this._byId[a.id]=a}}if(e.remove){for(i=0,s=this.length;i<s;++i){if(!g[(a=this.models[i]).cid])v.push(a)}if(v.length)this.remove(v,e)}if(p.length){if(f)l=true;this.length+=p.length;if(c!=null){n.apply(this.models,[c,0].concat(p))}else{r.apply(this.models,p)}}if(l)this.sort({silent:true});if(e.silent)return this;for(i=0,s=p.length;i<s;i++){(a=p[i]).trigger("add",a,this,e)}if(l)this.trigger("sort",this,e);return this},reset:function(t,e){e||(e={});for(var i=0,r=this.models.length;i<r;i++){this._removeReference(this.models[i])}e.previousModels=this.models;this._reset();this.add(t,h.extend({silent:true},e));if(!e.silent)this.trigger("reset",this,e);return this},push:function(t,e){t=this._prepareModel(t,e);this.add(t,h.extend({at:this.length},e));return t},pop:function(t){var e=this.at(this.length-1);this.remove(e,t);return e},unshift:function(t,e){t=this._prepareModel(t,e);this.add(t,h.extend({at:0},e));return t},shift:function(t){var e=this.at(0);this.remove(e,t);return e},slice:function(t,e){return this.models.slice(t,e)},get:function(t){if(t==null)return void 0;return this._byId[t.id!=null?t.id:t.cid||t]},at:function(t){return this.models[t]},where:function(t,e){if(h.isEmpty(t))return e?void 0:[];return this[e?"find":"filter"](function(e){for(var i in t){if(t[i]!==e.get(i))return false}return true})},findWhere:function(t){return this.where(t,true)},sort:function(t){if(!this.comparator)throw new Error("Cannot sort a set without a comparator");t||(t={});if(h.isString(this.comparator)||this.comparator.length===1){this.models=this.sortBy(this.comparator,this)}else{this.models.sort(h.bind(this.comparator,this))}if(!t.silent)this.trigger("sort",this,t);return this},sortedIndex:function(t,e,i){e||(e=this.comparator);var r=h.isFunction(e)?e:function(t){return t.get(e)};return h.sortedIndex(this.models,t,r,i)},pluck:function(t){return h.invoke(this.models,"get",t)},fetch:function(t){t=t?h.clone(t):{};if(t.parse===void 0)t.parse=true;var e=t.success;var i=this;t.success=function(r){var s=t.reset?"reset":"set";i[s](r,t);if(e)e(i,r,t);i.trigger("sync",i,r,t)};R(this,t);return this.sync("read",this,t)},create:function(t,e){e=e?h.clone(e):{};if(!(t=this._prepareModel(t,e)))return false;if(!e.wait)this.add(t,e);var i=this;var r=e.success;e.success=function(s){if(e.wait)i.add(t,e);if(r)r(t,s,e)};t.save(null,e);return t},parse:function(t,e){return t},clone:function(){return new this.constructor(this.models)},_reset:function(){this.length=0;this.models=[];this._byId={}},_prepareModel:function(t,e){if(t instanceof d){if(!t.collection)t.collection=this;return t}e||(e={});e.collection=this;var i=new this.model(t,e);if(!i._validate(t,e)){this.trigger("invalid",this,t,e);return false}return i},_removeReference:function(t){if(this===t.collection)delete t.collection;t.off("all",this._onModelEvent,this)},_onModelEvent:function(t,e,i,r){if((t==="add"||t==="remove")&&i!==this)return;if(t==="destroy")this.remove(e,r);if(e&&t==="change:"+e.idAttribute){delete this._byId[e.previous(e.idAttribute)];if(e.id!=null)this._byId[e.id]=e}this.trigger.apply(this,arguments)}});var _=["forEach","each","map","collect","reduce","foldl","inject","reduceRight","foldr","find","detect","filter","select","reject","every","all","some","any","include","contains","invoke","max","min","toArray","size","first","head","take","initial","rest","tail","drop","last","without","indexOf","shuffle","lastIndexOf","isEmpty","chain"];h.each(_,function(t){g.prototype[t]=function(){var e=s.call(arguments);e.unshift(this.models);return h[t].apply(h,e)}});var w=["groupBy","countBy","sortBy"];h.each(w,function(t){g.prototype[t]=function(e,i){var r=h.isFunction(e)?e:function(t){return t.get(e)};return h[t](this.models,r,i)}});var b=a.View=function(t){this.cid=h.uniqueId("view");this._configure(t||{});this._ensureElement();this.initialize.apply(this,arguments);this.delegateEvents()};var x=/^(\S+)\s*(.*)$/;var E=["model","collection","el","id","attributes","className","tagName","events"];h.extend(b.prototype,o,{tagName:"div",$:function(t){return this.$el.find(t)},initialize:function(){},render:function(){return this},remove:function(){this.$el.remove();this.stopListening();return this},setElement:function(t,e){if(this.$el)this.undelegateEvents();this.$el=t instanceof a.$?t:a.$(t);this.el=this.$el[0];if(e!==false)this.delegateEvents();return this},delegateEvents:function(t){if(!(t||(t=h.result(this,"events"))))return this;this.undelegateEvents();for(var e in t){var i=t[e];if(!h.isFunction(i))i=this[t[e]];if(!i)continue;var r=e.match(x);var s=r[1],n=r[2];i=h.bind(i,this);s+=".delegateEvents"+this.cid;if(n===""){this.$el.on(s,i)}else{this.$el.on(s,n,i)}}return this},undelegateEvents:function(){this.$el.off(".delegateEvents"+this.cid);return this},_configure:function(t){if(this.options)t=h.extend({},h.result(this,"options"),t);h.extend(this,h.pick(t,E));this.options=t},_ensureElement:function(){if(!this.el){var t=h.extend({},h.result(this,"attributes"));if(this.id)t.id=h.result(this,"id");if(this.className)t["class"]=h.result(this,"className");var e=a.$("<"+h.result(this,"tagName")+">").attr(t);this.setElement(e,false)}else{this.setElement(h.result(this,"el"),false)}}});a.sync=function(t,e,i){var r=k[t];h.defaults(i||(i={}),{emulateHTTP:a.emulateHTTP,emulateJSON:a.emulateJSON});var s={type:r,dataType:"json"};if(!i.url){s.url=h.result(e,"url")||U()}if(i.data==null&&e&&(t==="create"||t==="update"||t==="patch")){s.contentType="application/json";s.data=JSON.stringify(i.attrs||e.toJSON(i))}if(i.emulateJSON){s.contentType="application/x-www-form-urlencoded";s.data=s.data?{model:s.data}:{}}if(i.emulateHTTP&&(r==="PUT"||r==="DELETE"||r==="PATCH")){s.type="POST";if(i.emulateJSON)s.data._method=r;var n=i.beforeSend;i.beforeSend=function(t){t.setRequestHeader("X-HTTP-Method-Override",r);if(n)return n.apply(this,arguments)}}if(s.type!=="GET"&&!i.emulateJSON){s.processData=false}if(s.type==="PATCH"&&window.ActiveXObject&&!(window.external&&window.external.msActiveXFilteringEnabled)){s.xhr=function(){return new ActiveXObject("Microsoft.XMLHTTP")}}var o=i.xhr=a.ajax(h.extend(s,i));e.trigger("request",e,o,i);return o};var k={create:"POST",update:"PUT",patch:"PATCH","delete":"DELETE",read:"GET"};a.ajax=function(){return a.$.ajax.apply(a.$,arguments)};var S=a.Router=function(t){t||(t={});if(t.routes)this.routes=t.routes;this._bindRoutes();this.initialize.apply(this,arguments)};var $=/\((.*?)\)/g;var T=/(\(\?)?:\w+/g;var H=/\*\w+/g;var A=/[\-{}\[\]+?.,\\\^$|#\s]/g;h.extend(S.prototype,o,{initialize:function(){},route:function(t,e,i){if(!h.isRegExp(t))t=this._routeToRegExp(t);if(h.isFunction(e)){i=e;e=""}if(!i)i=this[e];var r=this;a.history.route(t,function(s){var n=r._extractParameters(t,s);i&&i.apply(r,n);r.trigger.apply(r,["route:"+e].concat(n));r.trigger("route",e,n);a.history.trigger("route",r,e,n)});return this},navigate:function(t,e){a.history.navigate(t,e);return this},_bindRoutes:function(){if(!this.routes)return;this.routes=h.result(this,"routes");var t,e=h.keys(this.routes);while((t=e.pop())!=null){this.route(t,this.routes[t])}},_routeToRegExp:function(t){t=t.replace(A,"\\$&").replace($,"(?:$1)?").replace(T,function(t,e){return e?t:"([^/]+)"}).replace(H,"(.*?)");return new RegExp("^"+t+"$")},_extractParameters:function(t,e){var i=t.exec(e).slice(1);return h.map(i,function(t){return t?decodeURIComponent(t):null})}});var I=a.History=function(){this.handlers=[];h.bindAll(this,"checkUrl");if(typeof window!=="undefined"){this.location=window.location;this.history=window.history}};var N=/^[#\/]|\s+$/g;var P=/^\/+|\/+$/g;var O=/msie [\w.]+/;var C=/\/$/;I.started=false;h.extend(I.prototype,o,{interval:50,getHash:function(t){var e=(t||this).location.href.match(/#(.*)$/);return e?e[1]:""},getFragment:function(t,e){if(t==null){if(this._hasPushState||!this._wantsHashChange||e){t=this.location.pathname;var i=this.root.replace(C,"");if(!t.indexOf(i))t=t.substr(i.length)}else{t=this.getHash()}}return t.replace(N,"")},start:function(t){if(I.started)throw new Error("Backbone.history has already been started");I.started=true;this.options=h.extend({},{root:"/"},this.options,t);this.root=this.options.root;this._wantsHashChange=this.options.hashChange!==false;this._wantsPushState=!!this.options.pushState;this._hasPushState=!!(this.options.pushState&&this.history&&this.history.pushState);var e=this.getFragment();var i=document.documentMode;var r=O.exec(navigator.userAgent.toLowerCase())&&(!i||i<=7);this.root=("/"+this.root+"/").replace(P,"/");if(r&&this._wantsHashChange){this.iframe=a.$('<iframe src="javascript:0" tabindex="-1" />').hide().appendTo("body")[0].contentWindow;this.navigate(e)}if(this._hasPushState){a.$(window).on("popstate",this.checkUrl)}else if(this._wantsHashChange&&"onhashchange"in window&&!r){a.$(window).on("hashchange",this.checkUrl)}else if(this._wantsHashChange){this._checkUrlInterval=setInterval(this.checkUrl,this.interval)}this.fragment=e;var s=this.location;var n=s.pathname.replace(/[^\/]$/,"$&/")===this.root;if(this._wantsHashChange&&this._wantsPushState&&!this._hasPushState&&!n){this.fragment=this.getFragment(null,true);this.location.replace(this.root+this.location.search+"#"+this.fragment);return true}else if(this._wantsPushState&&this._hasPushState&&n&&s.hash){this.fragment=this.getHash().replace(N,"");this.history.replaceState({},document.title,this.root+this.fragment+s.search)}if(!this.options.silent)return this.loadUrl()},stop:function(){a.$(window).off("popstate",this.checkUrl).off("hashchange",this.checkUrl);clearInterval(this._checkUrlInterval);I.started=false},route:function(t,e){this.handlers.unshift({route:t,callback:e})},checkUrl:function(t){var e=this.getFragment();if(e===this.fragment&&this.iframe){e=this.getFragment(this.getHash(this.iframe))}if(e===this.fragment)return false;if(this.iframe)this.navigate(e);this.loadUrl()||this.loadUrl(this.getHash())},loadUrl:function(t){var e=this.fragment=this.getFragment(t);var i=h.any(this.handlers,function(t){if(t.route.test(e)){t.callback(e);return true}});return i},navigate:function(t,e){if(!I.started)return false;if(!e||e===true)e={trigger:e};t=this.getFragment(t||"");if(this.fragment===t)return;this.fragment=t;var i=this.root+t;if(this._hasPushState){this.history[e.replace?"replaceState":"pushState"]({},document.title,i)}else if(this._wantsHashChange){this._updateHash(this.location,t,e.replace);if(this.iframe&&t!==this.getFragment(this.getHash(this.iframe))){if(!e.replace)this.iframe.document.open().close();this._updateHash(this.iframe.location,t,e.replace)}}else{return this.location.assign(i)}if(e.trigger)this.loadUrl(t)},_updateHash:function(t,e,i){if(i){var r=t.href.replace(/(javascript:|#).*$/,"");t.replace(r+"#"+e)}else{t.hash="#"+e}}});a.history=new I;var j=function(t,e){var i=this;var r;if(t&&h.has(t,"constructor")){r=t.constructor}else{r=function(){return i.apply(this,arguments)}}h.extend(r,i,e);var s=function(){this.constructor=r};s.prototype=i.prototype;r.prototype=new s;if(t)h.extend(r.prototype,t);r.__super__=i.prototype;return r};d.extend=g.extend=S.extend=b.extend=I.extend=j;var U=function(){throw new Error('A "url" property or function must be specified')};var R=function(t,e){var i=e.error;e.error=function(r){if(i)i(t,r,e);t.trigger("error",t,r,e)}}}).call(this);
...@@ -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