LMS fixes required to upgrade BackboneJS

This commit is contained in:
muhammad-ammar
2016-04-19 18:34:46 +05:00
committed by muzaffaryousaf
parent c87821446b
commit 4fd2a7d176
38 changed files with 85 additions and 29 deletions

View File

@@ -1,9 +1,9 @@
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"],
($, ui, Backbone, PromptView, NotificationView, ModuleEditView, ModuleModel, ModuleUtils) ->
(_, $, ui, Backbone, PromptView, NotificationView, ModuleEditView, ModuleModel, ModuleUtils) ->
class TabsEdit extends Backbone.View
initialize: =>
initialize: (options) =>
@$('.component').each((idx, element) =>
model = new ModuleModel({
id: $(element).data('locator')
@@ -15,7 +15,7 @@ define ["jquery", "jquery.ui", "backbone", "common/js/components/views/feedback_
model: model
)
)
@options = _.extend({}, options)
@options.mast.find('.new-tab').on('click', @addNewTab)
$('.add-pages .new-tab').on('click', @addNewTab)
$('.toggle-checkbox').on('click', @toggleVisibilityOfTab)

View File

@@ -17,11 +17,11 @@ function($, Backbone, _, Utils) {
uploadTpl: '#file-upload',
initialize: function () {
initialize: function (options) {
_.bindAll(this,
'changeHandler', 'clickHandler', 'xhrResetProgressBar', 'xhrProgressHandler', 'xhrCompleteHandler'
);
this.options = _.extend({}, options);
this.file = false;
this.render();
},

View File

@@ -28,11 +28,13 @@ function($, Backbone, _, Utils, FileUploader, gettext) {
choose: '#transcripts-choose'
},
initialize: function () {
initialize: function (options) {
_.bindAll(this,
'importHandler', 'replaceHandler', 'chooseHandler', 'useExistingHandler', 'showError', 'hideError'
);
this.options = _.extend({}, options);
this.component_locator = this.$el.closest('[data-locator]').data('locator');
this.fileUploader = new FileUploader({

View File

@@ -25,9 +25,10 @@ function($, Backbone, _, AbstractEditor, Utils, MessageManager) {
'youtube': 'http://youtube.com/'
},
initialize: function () {
initialize: function (options) {
// Initialize MessageManager that is responsible for
// status messages and errors.
this.options = _.extend({}, options);
var Messenger = this.options.MessageManager || MessageManager;
this.messenger = new Messenger({

View File

@@ -35,7 +35,7 @@ var libraryFiles = [
{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.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.paginator.min.js', included: false},
{pattern: 'xmodule_js/common_static/js/vendor/backbone-relational.min.js', included: false},

View File

@@ -35,7 +35,7 @@ var libraryFiles = [
{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.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.paginator.min.js', included: false},
{pattern: 'xmodule_js/common_static/js/vendor/timepicker/jquery.timepicker.js', included: false},