From 79b3af874983aae63e249ebcade3daf480822bc3 Mon Sep 17 00:00:00 2001 From: David Baumgold Date: Fri, 6 Sep 2013 09:16:26 -0400 Subject: [PATCH 1/2] tabs to spaces --- cms/static/js/views/grader-select-view.js | 164 +++++++++++----------- 1 file changed, 82 insertions(+), 82 deletions(-) diff --git a/cms/static/js/views/grader-select-view.js b/cms/static/js/views/grader-select-view.js index a16f5fa1b7..389ffa926e 100644 --- a/cms/static/js/views/grader-select-view.js +++ b/cms/static/js/views/grader-select-view.js @@ -1,99 +1,99 @@ CMS.Models.AssignmentGrade = Backbone.Model.extend({ - defaults : { - graderType : null, // the type label (string). May be "Not Graded" which implies None. I'd like to use id but that's ephemeral - location : null // A location object - }, - initialize : function(attrs) { - if (attrs['assignmentUrl']) { - this.set('location', new CMS.Models.Location(attrs['assignmentUrl'], {parse: true})); - } - }, - parse : function(attrs) { - if (attrs && attrs['location']) { - attrs.location = new CMS.Models.Location(attrs['location'], {parse: true}); - } - }, - urlRoot : function() { - if (this.has('location')) { - var location = this.get('location'); - return '/' + location.get('org') + "/" + location.get('course') + '/' + location.get('category') + '/' - + location.get('name') + '/gradeas/'; - } - else return ""; - } + defaults : { + graderType : null, // the type label (string). May be "Not Graded" which implies None. I'd like to use id but that's ephemeral + location : null // A location object + }, + initialize : function(attrs) { + if (attrs['assignmentUrl']) { + this.set('location', new CMS.Models.Location(attrs['assignmentUrl'], {parse: true})); + } + }, + parse : function(attrs) { + if (attrs && attrs['location']) { + attrs.location = new CMS.Models.Location(attrs['location'], {parse: true}); + } + }, + urlRoot : function() { + if (this.has('location')) { + var location = this.get('location'); + return '/' + location.get('org') + "/" + location.get('course') + '/' + location.get('category') + '/' + + location.get('name') + '/gradeas/'; + } + else return ""; + } }); CMS.Views.OverviewAssignmentGrader = Backbone.View.extend({ - // instantiate w/ { graders : CourseGraderCollection, el : } - events : { - "click .menu-toggle" : "showGradeMenu", - "click .menu li" : "selectGradeType" - }, - initialize : function() { - // call template w/ {assignmentType : formatname, graders : CourseGraderCollection instance } - this.template = _.template( - // TODO move to a template file - '

<%= assignmentType %>

' + - '' + - '<% if (!hideSymbol) {%><%};%>' + - '' + - ''); - this.assignmentGrade = new CMS.Models.AssignmentGrade({ - assignmentUrl : this.$el.closest('.id-holder').data('id'), - graderType : this.$el.data('initial-status')}); - // TODO throw exception if graders is null - this.graders = this.options['graders']; - var cachethis = this; - // defining here to get closure around this - this.removeMenu = function(e) { - e.preventDefault(); - cachethis.$el.removeClass('is-active'); - $(document).off('click', cachethis.removeMenu); - } - this.hideSymbol = this.options['hideSymbol']; - this.render(); - }, - render : function() { - this.$el.html(this.template({ assignmentType : this.assignmentGrade.get('graderType'), graders : this.graders, - hideSymbol : this.hideSymbol })); - if (this.assignmentGrade.has('graderType') && this.assignmentGrade.get('graderType') != "Not Graded") { - this.$el.addClass('is-set'); - } - else { - this.$el.removeClass('is-set'); - } - }, - showGradeMenu : function(e) { - e.preventDefault(); - // I sure hope this doesn't break anything but it's needed to keep the removeMenu from activating - e.stopPropagation(); - // nasty global event trap :-( - $(document).on('click', this.removeMenu); - this.$el.addClass('is-active'); - }, - selectGradeType : function(e) { - e.preventDefault(); + // instantiate w/ { graders : CourseGraderCollection, el : } + events : { + "click .menu-toggle" : "showGradeMenu", + "click .menu li" : "selectGradeType" + }, + initialize : function() { + // call template w/ {assignmentType : formatname, graders : CourseGraderCollection instance } + this.template = _.template( + // TODO move to a template file + '

<%= assignmentType %>

' + + '' + + '<% if (!hideSymbol) {%><%};%>' + + '' + + ''); + this.assignmentGrade = new CMS.Models.AssignmentGrade({ + assignmentUrl : this.$el.closest('.id-holder').data('id'), + graderType : this.$el.data('initial-status')}); + // TODO throw exception if graders is null + this.graders = this.options['graders']; + var cachethis = this; + // defining here to get closure around this + this.removeMenu = function(e) { + e.preventDefault(); + cachethis.$el.removeClass('is-active'); + $(document).off('click', cachethis.removeMenu); + } + this.hideSymbol = this.options['hideSymbol']; + this.render(); + }, + render : function() { + this.$el.html(this.template({ assignmentType : this.assignmentGrade.get('graderType'), graders : this.graders, + hideSymbol : this.hideSymbol })); + if (this.assignmentGrade.has('graderType') && this.assignmentGrade.get('graderType') != "Not Graded") { + this.$el.addClass('is-set'); + } + else { + this.$el.removeClass('is-set'); + } + }, + showGradeMenu : function(e) { + e.preventDefault(); + // I sure hope this doesn't break anything but it's needed to keep the removeMenu from activating + e.stopPropagation(); + // nasty global event trap :-( + $(document).on('click', this.removeMenu); + this.$el.addClass('is-active'); + }, + selectGradeType : function(e) { + e.preventDefault(); - this.removeMenu(e); + this.removeMenu(e); var saving = new CMS.Views.Notification.Mini({ title: gettext('Saving') + '…' }); saving.show(); - // TODO I'm not happy with this string fetch via the html for what should be an id. I'd rather use the id attr - // of the CourseGradingPolicy model or null for Not Graded (NOTE, change template's if check for is-selected accordingly) - this.assignmentGrade.save( + // TODO I'm not happy with this string fetch via the html for what should be an id. I'd rather use the id attr + // of the CourseGradingPolicy model or null for Not Graded (NOTE, change template's if check for is-selected accordingly) + this.assignmentGrade.save( 'graderType', $(e.target).text(), {success: function () { saving.hide(); }} ); - this.render(); - } + this.render(); + } }) From fd8b375f3a11190334bc4a25466282d0c598c672 Mon Sep 17 00:00:00 2001 From: David Baumgold Date: Fri, 6 Sep 2013 09:17:19 -0400 Subject: [PATCH 2/2] Translated … --- cms/static/coffee/src/views/module_edit.coffee | 6 +++--- cms/static/coffee/src/views/tabs.coffee | 6 +++--- cms/static/coffee/src/views/unit.coffee | 4 ++-- cms/static/js/base.js | 4 ++-- cms/static/js/models/section.js | 2 +- cms/static/js/views/course_info_edit.js | 6 +++--- cms/static/js/views/grader-select-view.js | 6 +++--- cms/static/js/views/overview.js | 2 +- cms/static/js/views/textbook.js | 4 ++-- 9 files changed, 20 insertions(+), 20 deletions(-) diff --git a/cms/static/coffee/src/views/module_edit.coffee b/cms/static/coffee/src/views/module_edit.coffee index c45feecd41..8eaabd22b2 100644 --- a/cms/static/coffee/src/views/module_edit.coffee +++ b/cms/static/coffee/src/views/module_edit.coffee @@ -60,8 +60,8 @@ class CMS.Views.ModuleEdit extends Backbone.View payload.parent_location = parent $.post( "/create_item" - payload - (data) => + payload + (data) => @model.set(id: data.id) @$el.data('id', data.id) @render() @@ -85,7 +85,7 @@ class CMS.Views.ModuleEdit extends Backbone.View data.metadata = _.extend(data.metadata || {}, @changedMetadata()) @hideModal() saving = new CMS.Views.Notification.Mini - title: gettext('Saving') + '…' + title: gettext('Saving…') saving.show() @model.save(data).done( => # # showToastMessage("Your changes have been saved.", null, 3) diff --git a/cms/static/coffee/src/views/tabs.coffee b/cms/static/coffee/src/views/tabs.coffee index 3ae80dc336..91bc6696ac 100644 --- a/cms/static/coffee/src/views/tabs.coffee +++ b/cms/static/coffee/src/views/tabs.coffee @@ -21,7 +21,7 @@ class CMS.Views.TabsEdit extends Backbone.View forcePlaceholderSize: true axis: 'y' items: '> .component' - ) + ) tabMoved: (event, ui) => tabs = [] @@ -34,7 +34,7 @@ class CMS.Views.TabsEdit extends Backbone.View $.ajax({ type:'POST', - url: '/reorder_static_tabs', + url: '/reorder_static_tabs', data: JSON.stringify({ tabs : tabs }), @@ -78,7 +78,7 @@ class CMS.Views.TabsEdit extends Backbone.View course: course_location_analytics id: $component.data('id') deleting = new CMS.Views.Notification.Mini - title: gettext('Deleting') + '…' + title: gettext('Deleting…') deleting.show() $.post('/delete_item', { id: $component.data('id') diff --git a/cms/static/coffee/src/views/unit.coffee b/cms/static/coffee/src/views/unit.coffee index 0154b4f51a..75bc463e22 100644 --- a/cms/static/coffee/src/views/unit.coffee +++ b/cms/static/coffee/src/views/unit.coffee @@ -42,7 +42,7 @@ class CMS.Views.UnitEdit extends Backbone.View payload = children : @components() saving = new CMS.Views.Notification.Mini - title: gettext('Saving') + '…' + title: gettext('Saving…') saving.show() options = success : => @model.unset('children') @@ -130,7 +130,7 @@ class CMS.Views.UnitEdit extends Backbone.View click: (view) => view.hide() deleting = new CMS.Views.Notification.Mini - title: gettext('Deleting') + '…', + title: gettext('Deleting…'), deleting.show() $component = $(event.currentTarget).parents('.component') $.post('/delete_item', { diff --git a/cms/static/js/base.js b/cms/static/js/base.js index 9ccac6f602..cfa4b750e6 100644 --- a/cms/static/js/base.js +++ b/cms/static/js/base.js @@ -395,7 +395,7 @@ function _deleteItem($el, type) { }); var deleting = new CMS.Views.Notification.Mini({ - title: gettext('Deleting') + '…' + title: gettext('Deleting…') }); deleting.show(); @@ -840,7 +840,7 @@ function saveSetSectionScheduleDate(e) { }); var saving = new CMS.Views.Notification.Mini({ - title: gettext("Saving") + "…" + title: gettext("Saving…") }); saving.show(); // call into server to commit the new order diff --git a/cms/static/js/models/section.js b/cms/static/js/models/section.js index 38871a1e5f..475f66e4c5 100644 --- a/cms/static/js/models/section.js +++ b/cms/static/js/models/section.js @@ -23,7 +23,7 @@ CMS.Models.Section = Backbone.Model.extend({ showNotification: function() { if(!this.msg) { this.msg = new CMS.Views.Notification.Mini({ - title: gettext("Saving") + "…" + title: gettext("Saving…") }); } this.msg.show(); diff --git a/cms/static/js/views/course_info_edit.js b/cms/static/js/views/course_info_edit.js index 4d19d8870f..a50a3c5d4d 100644 --- a/cms/static/js/views/course_info_edit.js +++ b/cms/static/js/views/course_info_edit.js @@ -118,7 +118,7 @@ CMS.Views.ClassInfoUpdateView = Backbone.View.extend({ targetModel.set({ date : this.dateEntry(event).val(), content : this.$codeMirror.getValue() }); // push change to display, hide the editor, submit the change var saving = new CMS.Views.Notification.Mini({ - title: gettext('Saving') + '…' + title: gettext('Saving…') }); saving.show(); var ele = this.modelDom(event); @@ -183,7 +183,7 @@ CMS.Views.ClassInfoUpdateView = Backbone.View.extend({ }); self.modelDom(event).remove(); var deleting = new CMS.Views.Notification.Mini({ - title: gettext('Deleting') + '…' + title: gettext('Deleting…') }); deleting.show(); targetModel.destroy({ @@ -327,7 +327,7 @@ CMS.Views.ClassInfoHandoutsView = Backbone.View.extend({ onSave: function(event) { this.model.set('data', this.$codeMirror.getValue()); var saving = new CMS.Views.Notification.Mini({ - title: gettext('Saving') + '…' + title: gettext('Saving…') }); saving.show(); this.model.save({}, { diff --git a/cms/static/js/views/grader-select-view.js b/cms/static/js/views/grader-select-view.js index 389ffa926e..d2a4f5b05f 100644 --- a/cms/static/js/views/grader-select-view.js +++ b/cms/static/js/views/grader-select-view.js @@ -54,7 +54,7 @@ CMS.Views.OverviewAssignmentGrader = Backbone.View.extend({ e.preventDefault(); cachethis.$el.removeClass('is-active'); $(document).off('click', cachethis.removeMenu); - } + }; this.hideSymbol = this.options['hideSymbol']; this.render(); }, @@ -82,7 +82,7 @@ CMS.Views.OverviewAssignmentGrader = Backbone.View.extend({ this.removeMenu(e); var saving = new CMS.Views.Notification.Mini({ - title: gettext('Saving') + '…' + title: gettext('Saving…') }); saving.show(); @@ -96,4 +96,4 @@ CMS.Views.OverviewAssignmentGrader = Backbone.View.extend({ this.render(); } -}) +}); diff --git a/cms/static/js/views/overview.js b/cms/static/js/views/overview.js index 4ce0d3688e..f2435ea20f 100644 --- a/cms/static/js/views/overview.js +++ b/cms/static/js/views/overview.js @@ -226,7 +226,7 @@ function _handleReorder(event, ui, parentIdField, childrenSelector) { children.push(ui.draggable.data('id')); } var saving = new CMS.Views.Notification.Mini({ - title: gettext('Saving') + '…' + title: gettext('Saving…') }); saving.show(); $.ajax({ diff --git a/cms/static/js/views/textbook.js b/cms/static/js/views/textbook.js index 780deff85d..6c578251d2 100644 --- a/cms/static/js/views/textbook.js +++ b/cms/static/js/views/textbook.js @@ -35,7 +35,7 @@ CMS.Views.ShowTextbook = Backbone.View.extend({ click: function(view) { view.hide(); var delmsg = new CMS.Views.Notification.Mini({ - title: gettext("Deleting") + "…" + title: gettext("Deleting…") }).show(); textbook.destroy({ complete: function() { @@ -122,7 +122,7 @@ CMS.Views.EditTextbook = Backbone.View.extend({ this.setValues(); if(!this.model.isValid()) { return; } var saving = new CMS.Views.Notification.Mini({ - title: gettext("Saving") + "…" + title: gettext("Saving…") }).show(); var that = this; this.model.save({}, {