diff --git a/cms/static/js/base.js b/cms/static/js/base.js index ad81963b0f..c8371fcf64 100644 --- a/cms/static/js/base.js +++ b/cms/static/js/base.js @@ -895,4 +895,4 @@ function saveSetSectionScheduleDate(e) { hideModal(); }); -} \ No newline at end of file +} diff --git a/cms/static/js/hesitate.js b/cms/static/js/hesitate.js index c5848a6c0c..8609562220 100644 --- a/cms/static/js/hesitate.js +++ b/cms/static/js/hesitate.js @@ -2,13 +2,13 @@ * Create a HesitateEvent and assign it as the event to execute: * $(el).on('mouseEnter', CMS.HesitateEvent( expand, 'mouseLeave').trigger); * It calls the executeOnTimeOut function with the event.currentTarget after the configurable timeout IFF the cancelSelector event - * did not occur on the event.currentTarget. - * - * More specifically, when trigger is called (triggered by the event you bound it to), it starts a timer + * did not occur on the event.currentTarget. + * + * More specifically, when trigger is called (triggered by the event you bound it to), it starts a timer * which the cancelSelector event will cancel or if the timer finished, it executes the executeOnTimeOut function * passing it the original event (whose currentTarget s/b the specific ele). It never accumulates events; however, it doesn't hurt for your * code to minimize invocations of trigger by binding to mouseEnter v mouseOver and such. - * + * * NOTE: if something outside of this wants to cancel the event, invoke cachedhesitation.untrigger(null | anything); */ @@ -25,7 +25,7 @@ CMS.HesitateEvent.DURATION = 800; CMS.HesitateEvent.prototype.trigger = function(event) { if (event.data.timeoutEventId == null) { event.data.timeoutEventId = window.setTimeout( - function() { event.data.fireEvent(event); }, + function() { event.data.fireEvent(event); }, CMS.HesitateEvent.DURATION); event.data.originalEvent = event; $(event.data.originalEvent.delegateTarget).on(event.data.cancelSelector, event.data, event.data.untrigger); @@ -45,4 +45,4 @@ CMS.HesitateEvent.prototype.untrigger = function(event) { $(event.data.originalEvent.delegateTarget).off(event.data.cancelSelector, event.data.untrigger); } event.data.timeoutEventId = null; -}; \ No newline at end of file +}; diff --git a/cms/static/js/main.js b/cms/static/js/main.js index 4a9b5d2374..2d72edc4bf 100644 --- a/cms/static/js/main.js +++ b/cms/static/js/main.js @@ -80,6 +80,6 @@ $(document).ready(function(){ $('section.problem-edit').show(); return false; }); - + }); diff --git a/cms/static/js/models/course_info.js b/cms/static/js/models/course_info.js index 8cb5a654cb..3bd7ffa97a 100644 --- a/cms/static/js/models/course_info.js +++ b/cms/static/js/models/course_info.js @@ -1,17 +1,17 @@ -// single per course holds the updates and handouts +// single per course holds the updates and handouts CMS.Models.CourseInfo = Backbone.Model.extend({ // This model class is not suited for restful operations and is considered just a server side initialized container url: '', - + defaults: { "courseId": "", // the location url "updates" : null, // UpdateCollection "handouts": null // HandoutCollection }, - + idAttribute : "courseId" }); - + // course update -- biggest kludge here is the lack of a real id to map updates to originals CMS.Models.CourseUpdate = Backbone.Model.extend({ defaults: { @@ -26,11 +26,11 @@ CMS.Models.CourseUpdate = Backbone.Model.extend({ */ CMS.Models.CourseUpdateCollection = Backbone.Collection.extend({ url : function() {return this.urlbase + "course_info/updates/";}, - + model : CMS.Models.CourseUpdate }); - - - \ No newline at end of file + + + diff --git a/cms/static/js/models/course_relative.js b/cms/static/js/models/course_relative.js index 99bb1c6d77..6608f92a4f 100644 --- a/cms/static/js/models/course_relative.js +++ b/cms/static/js/models/course_relative.js @@ -16,7 +16,7 @@ CMS.Models.Location = Backbone.Model.extend({ }, _tagPattern : /[^:]+/g, _fieldPattern : new RegExp('[^/]+','g'), - + parse: function(payload) { if (_.isArray(payload)) { return { @@ -25,7 +25,7 @@ CMS.Models.Location = Backbone.Model.extend({ course: payload[2], category: payload[3], name: payload[4] - } + }; } else if (_.isString(payload)) { this._tagPattern.lastIndex = 0; // odd regex behavior requires this to be reset sometimes @@ -65,4 +65,4 @@ CMS.Models.CourseRelative = Backbone.Model.extend({ CMS.Models.CourseRelativeCollection = Backbone.Collection.extend({ model : CMS.Models.CourseRelative -}); \ No newline at end of file +}); diff --git a/cms/static/js/models/module_info.js b/cms/static/js/models/module_info.js index 6a593372c4..529d155aba 100644 --- a/cms/static/js/models/module_info.js +++ b/cms/static/js/models/module_info.js @@ -6,5 +6,5 @@ CMS.Models.ModuleInfo = Backbone.Model.extend({ "data": null, "metadata" : null, "children" : null - }, -}); \ No newline at end of file + } +}); diff --git a/cms/static/js/models/settings/advanced.js b/cms/static/js/models/settings/advanced.js index adc259239d..c074b12067 100644 --- a/cms/static/js/models/settings/advanced.js +++ b/cms/static/js/models/settings/advanced.js @@ -11,7 +11,7 @@ CMS.Models.Settings.Advanced = Backbone.Model.extend({ validate: function (attrs) { // Keys can no longer be edited. We are currently not validating values. }, - + save : function (attrs, options) { // wraps the save call w/ the deletion of the removed keys after we know the saved ones worked options = options ? _.clone(options) : {}; @@ -23,7 +23,7 @@ CMS.Models.Settings.Advanced = Backbone.Model.extend({ }; Backbone.Model.prototype.save.call(this, attrs, options); }, - + afterSave : function(self) { // remove deleted attrs if (!_.isEmpty(self.deleteKeys)) { diff --git a/cms/static/js/models/settings/course_details.js b/cms/static/js/models/settings/course_details.js index d41545cca9..b71b4e2ab2 100644 --- a/cms/static/js/models/settings/course_details.js +++ b/cms/static/js/models/settings/course_details.js @@ -66,7 +66,7 @@ CMS.Models.Settings.CourseDetails = Backbone.Model.extend({ save_videosource: function(newsource) { // newsource either is or just the "speed:key, *" string // returns the videosource for the preview which iss the key whose speed is closest to 1 - if (_.isEmpty(newsource) && !_.isEmpty(this.get('intro_video'))) this.save({'intro_video': null}); + if (_.isEmpty(newsource) && !_.isEmpty(this.get('intro_video'))) this.save({'intro_video': null}); // TODO remove all whitespace w/in string else { if (this.get('intro_video') !== newsource) this.save('intro_video', newsource); diff --git a/cms/static/js/models/settings/course_grading_policy.js b/cms/static/js/models/settings/course_grading_policy.js index 3f8b1bf29a..8162145003 100644 --- a/cms/static/js/models/settings/course_grading_policy.js +++ b/cms/static/js/models/settings/course_grading_policy.js @@ -1,9 +1,9 @@ if (!CMS.Models['Settings']) CMS.Models.Settings = new Object(); CMS.Models.Settings.CourseGradingPolicy = Backbone.Model.extend({ - defaults : { + defaults : { course_location : null, - graders : null, // CourseGraderCollection + graders : null, // CourseGraderCollection grade_cutoffs : null, // CourseGradeCutoff model grace_period : null // either null or { hours: n, minutes: m, ...} }, @@ -54,7 +54,7 @@ CMS.Models.Settings.CourseGrader = Backbone.Model.extend({ "type" : "", // must be unique w/in collection (ie. w/in course) "min_count" : 1, "drop_count" : 0, - "short_label" : "", // what to use in place of type if space is an issue + "short_label" : "", // what to use in place of type if space is an issue "weight" : 0 // int 0..100 }, parse : function(attrs) { @@ -125,4 +125,4 @@ CMS.Models.Settings.CourseGraderCollection = Backbone.Collection.extend({ sumWeights : function() { return this.reduce(function(subtotal, grader) { return subtotal + grader.get('weight'); }, 0); } -}); \ No newline at end of file +}); diff --git a/cms/static/js/views/checklists_view.js b/cms/static/js/views/checklists_view.js index 85c0f5242b..1ae29f99d5 100644 --- a/cms/static/js/views/checklists_view.js +++ b/cms/static/js/views/checklists_view.js @@ -93,4 +93,4 @@ CMS.Views.Checklists = Backbone.View.extend({ error : CMS.ServerError }); } -}); \ No newline at end of file +}); diff --git a/cms/static/js/views/course_info_edit.js b/cms/static/js/views/course_info_edit.js index a6d42e1927..50793c5f1e 100644 --- a/cms/static/js/views/course_info_edit.js +++ b/cms/static/js/views/course_info_edit.js @@ -32,7 +32,7 @@ CMS.Views.ClassInfoUpdateView = Backbone.View.extend({ "click .post-actions > .edit-button" : "onEdit", "click .post-actions > .delete-button" : "onDelete" }, - + initialize: function() { var self = this; // instantiates an editor template for each update in the collection @@ -41,13 +41,13 @@ CMS.Views.ClassInfoUpdateView = Backbone.View.extend({ "/static/client_templates/course_info_update.html", function (raw_template) { self.template = _.template(raw_template); - self.render(); + self.render(); } ); // when the client refetches the updates as a whole, re-render them this.listenTo(this.collection, 'reset', this.render); }, - + render: function () { // iterate over updates and create views for each using the template var updateEle = this.$el.find("#course-update-list"); @@ -66,14 +66,14 @@ CMS.Views.ClassInfoUpdateView = Backbone.View.extend({ this.$el.find('.date').datepicker({ 'dateFormat': 'MM d, yy' }); return this; }, - + onNew: function(event) { event.preventDefault(); var self = this; // create new obj, insert into collection, and render this one ele overriding the hidden attr var newModel = new CMS.Models.CourseUpdate(); this.collection.add(newModel, {at : 0}); - + var $newForm = $(this.template({ updateModel : newModel })); var updateEle = this.$el.find("#course-update-list"); @@ -87,7 +87,7 @@ CMS.Views.ClassInfoUpdateView = Backbone.View.extend({ lineWrapping: true, }); } - + $newForm.addClass('editing'); this.$currentPost = $newForm.closest('li'); @@ -99,21 +99,21 @@ CMS.Views.ClassInfoUpdateView = Backbone.View.extend({ $('.date').datepicker('destroy'); $('.date').datepicker({ 'dateFormat': 'MM d, yy' }); }, - + onSave: function(event) { event.preventDefault(); var targetModel = this.eventModel(event); targetModel.set({ date : this.dateEntry(event).val(), content : this.$codeMirror.getValue() }); - // push change to display, hide the editor, submit the change + // push change to display, hide the editor, submit the change targetModel.save({}, {error : CMS.ServerError}); this.closeEditor(this); analytics.track('Saved Course Update', { 'course': course_location_analytics, - 'date': this.dateEntry(event).val() + 'date': this.dateEntry(event).val() }); }, - + onCancel: function(event) { event.preventDefault(); // change editor contents back to model values and hide the editor @@ -121,13 +121,13 @@ CMS.Views.ClassInfoUpdateView = Backbone.View.extend({ var targetModel = this.eventModel(event); this.closeEditor(this, !targetModel.id); }, - + onEdit: function(event) { event.preventDefault(); var self = this; this.$currentPost = $(event.target).closest('li'); this.$currentPost.addClass('editing'); - + $(this.editor(event)).show(); var $textArea = this.$currentPost.find(".new-update-content").first(); if (this.$codeMirror == null ) { @@ -154,13 +154,13 @@ CMS.Views.ClassInfoUpdateView = Backbone.View.extend({ analytics.track('Deleted Course Update', { 'course': course_location_analytics, - 'date': this.dateEntry(event).val() + 'date': this.dateEntry(event).val() }); var targetModel = this.eventModel(event); this.modelDom(event).remove(); var cacheThis = this; - targetModel.destroy({success : function (model, response) { + targetModel.destroy({success : function (model, response) { cacheThis.collection.fetch({success : function() {cacheThis.render();}, error : CMS.ServerError}); }, @@ -192,17 +192,17 @@ CMS.Views.ClassInfoUpdateView = Backbone.View.extend({ this.$codeMirror = null; self.$currentPost.find('.CodeMirror').remove(); }, - - // Dereferencing from events to screen elements + + // Dereferencing from events to screen elements eventModel: function(event) { // not sure if it should be currentTarget or delegateTarget return this.collection.get($(event.currentTarget).attr("name")); }, - + modelDom: function(event) { return $(event.currentTarget).closest("li"); }, - + editor: function(event) { var li = $(event.currentTarget).closest("li"); if (li) return $(li).find("form").first(); @@ -216,7 +216,7 @@ CMS.Views.ClassInfoUpdateView = Backbone.View.extend({ contentEntry: function(event) { return $(event.currentTarget).closest("li").find(".new-update-content").first(); }, - + dateDisplay: function(event) { return $(event.currentTarget).closest("li").find("#date-display").first(); }, @@ -224,7 +224,7 @@ CMS.Views.ClassInfoUpdateView = Backbone.View.extend({ contentDisplay: function(event) { return $(event.currentTarget).closest("li").find(".update-contents").first(); } - + }); // the handouts view is dumb right now; it needs tied to a model and all that jazz @@ -245,7 +245,7 @@ CMS.Views.ClassInfoHandoutsView = Backbone.View.extend({ "/static/client_templates/course_info_handouts.html", function (raw_template) { self.template = _.template(raw_template); - self.render(); + self.render(); } ); }, @@ -253,8 +253,8 @@ CMS.Views.ClassInfoHandoutsView = Backbone.View.extend({ } ); }, - - render: function () { + + render: function () { var updateEle = this.$el; var self = this; this.$el.html( @@ -313,4 +313,4 @@ CMS.Views.ClassInfoHandoutsView = Backbone.View.extend({ self.$form.find('.CodeMirror').remove(); this.$codeMirror = null; } -}); \ No newline at end of file +}); diff --git a/cms/static/js/views/grader-select-view.js b/cms/static/js/views/grader-select-view.js index 50e32cbbe1..941342f89e 100644 --- a/cms/static/js/views/grader-select-view.js +++ b/cms/static/js/views/grader-select-view.js @@ -16,7 +16,7 @@ CMS.Models.AssignmentGrade = Backbone.Model.extend({ urlRoot : function() { if (this.has('location')) { var location = this.get('location'); - return '/' + location.get('org') + "/" + location.get('course') + '/' + location.get('category') + '/' + return '/' + location.get('org') + "/" + location.get('course') + '/' + location.get('category') + '/' + location.get('name') + '/gradeas/'; } else return ""; @@ -37,14 +37,14 @@ CMS.Views.OverviewAssignmentGrader = Backbone.View.extend({ '' + '<% if (!hideSymbol) {%><%};%>' + '' + - '