Commit 54343881 by David Baumgold

Merge pull request #875 from edx/db/translate-hellip

Translate …
parents 0958a275 fd8b375f
...@@ -60,8 +60,8 @@ class CMS.Views.ModuleEdit extends Backbone.View ...@@ -60,8 +60,8 @@ class CMS.Views.ModuleEdit extends Backbone.View
payload.parent_location = parent payload.parent_location = parent
$.post( $.post(
"/create_item" "/create_item"
payload payload
(data) => (data) =>
@model.set(id: data.id) @model.set(id: data.id)
@$el.data('id', data.id) @$el.data('id', data.id)
@render() @render()
...@@ -85,7 +85,7 @@ class CMS.Views.ModuleEdit extends Backbone.View ...@@ -85,7 +85,7 @@ class CMS.Views.ModuleEdit extends Backbone.View
data.metadata = _.extend(data.metadata || {}, @changedMetadata()) data.metadata = _.extend(data.metadata || {}, @changedMetadata())
@hideModal() @hideModal()
saving = new CMS.Views.Notification.Mini saving = new CMS.Views.Notification.Mini
title: gettext('Saving') + '…' title: gettext('Saving…')
saving.show() saving.show()
@model.save(data).done( => @model.save(data).done( =>
# # showToastMessage("Your changes have been saved.", null, 3) # # showToastMessage("Your changes have been saved.", null, 3)
......
...@@ -21,7 +21,7 @@ class CMS.Views.TabsEdit extends Backbone.View ...@@ -21,7 +21,7 @@ class CMS.Views.TabsEdit extends Backbone.View
forcePlaceholderSize: true forcePlaceholderSize: true
axis: 'y' axis: 'y'
items: '> .component' items: '> .component'
) )
tabMoved: (event, ui) => tabMoved: (event, ui) =>
tabs = [] tabs = []
...@@ -34,7 +34,7 @@ class CMS.Views.TabsEdit extends Backbone.View ...@@ -34,7 +34,7 @@ class CMS.Views.TabsEdit extends Backbone.View
$.ajax({ $.ajax({
type:'POST', type:'POST',
url: '/reorder_static_tabs', url: '/reorder_static_tabs',
data: JSON.stringify({ data: JSON.stringify({
tabs : tabs tabs : tabs
}), }),
...@@ -78,7 +78,7 @@ class CMS.Views.TabsEdit extends Backbone.View ...@@ -78,7 +78,7 @@ class CMS.Views.TabsEdit extends Backbone.View
course: course_location_analytics course: course_location_analytics
id: $component.data('id') id: $component.data('id')
deleting = new CMS.Views.Notification.Mini deleting = new CMS.Views.Notification.Mini
title: gettext('Deleting') + '…' title: gettext('Deleting…')
deleting.show() deleting.show()
$.post('/delete_item', { $.post('/delete_item', {
id: $component.data('id') id: $component.data('id')
......
...@@ -42,7 +42,7 @@ class CMS.Views.UnitEdit extends Backbone.View ...@@ -42,7 +42,7 @@ class CMS.Views.UnitEdit extends Backbone.View
payload = children : @components() payload = children : @components()
saving = new CMS.Views.Notification.Mini saving = new CMS.Views.Notification.Mini
title: gettext('Saving') + '…' title: gettext('Saving…')
saving.show() saving.show()
options = success : => options = success : =>
@model.unset('children') @model.unset('children')
...@@ -130,7 +130,7 @@ class CMS.Views.UnitEdit extends Backbone.View ...@@ -130,7 +130,7 @@ class CMS.Views.UnitEdit extends Backbone.View
click: (view) => click: (view) =>
view.hide() view.hide()
deleting = new CMS.Views.Notification.Mini deleting = new CMS.Views.Notification.Mini
title: gettext('Deleting') + '…', title: gettext('Deleting…'),
deleting.show() deleting.show()
$component = $(event.currentTarget).parents('.component') $component = $(event.currentTarget).parents('.component')
$.post('/delete_item', { $.post('/delete_item', {
......
...@@ -395,7 +395,7 @@ function _deleteItem($el, type) { ...@@ -395,7 +395,7 @@ function _deleteItem($el, type) {
}); });
var deleting = new CMS.Views.Notification.Mini({ var deleting = new CMS.Views.Notification.Mini({
title: gettext('Deleting') + '…' title: gettext('Deleting…')
}); });
deleting.show(); deleting.show();
...@@ -840,7 +840,7 @@ function saveSetSectionScheduleDate(e) { ...@@ -840,7 +840,7 @@ function saveSetSectionScheduleDate(e) {
}); });
var saving = new CMS.Views.Notification.Mini({ var saving = new CMS.Views.Notification.Mini({
title: gettext("Saving") + "…" title: gettext("Saving…")
}); });
saving.show(); saving.show();
// call into server to commit the new order // call into server to commit the new order
......
...@@ -23,7 +23,7 @@ CMS.Models.Section = Backbone.Model.extend({ ...@@ -23,7 +23,7 @@ CMS.Models.Section = Backbone.Model.extend({
showNotification: function() { showNotification: function() {
if(!this.msg) { if(!this.msg) {
this.msg = new CMS.Views.Notification.Mini({ this.msg = new CMS.Views.Notification.Mini({
title: gettext("Saving") + "…" title: gettext("Saving…")
}); });
} }
this.msg.show(); this.msg.show();
......
...@@ -118,7 +118,7 @@ CMS.Views.ClassInfoUpdateView = Backbone.View.extend({ ...@@ -118,7 +118,7 @@ CMS.Views.ClassInfoUpdateView = Backbone.View.extend({
targetModel.set({ date : this.dateEntry(event).val(), content : this.$codeMirror.getValue() }); 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
var saving = new CMS.Views.Notification.Mini({ var saving = new CMS.Views.Notification.Mini({
title: gettext('Saving') + '…' title: gettext('Saving…')
}); });
saving.show(); saving.show();
var ele = this.modelDom(event); var ele = this.modelDom(event);
...@@ -183,7 +183,7 @@ CMS.Views.ClassInfoUpdateView = Backbone.View.extend({ ...@@ -183,7 +183,7 @@ CMS.Views.ClassInfoUpdateView = Backbone.View.extend({
}); });
self.modelDom(event).remove(); self.modelDom(event).remove();
var deleting = new CMS.Views.Notification.Mini({ var deleting = new CMS.Views.Notification.Mini({
title: gettext('Deleting') + '…' title: gettext('Deleting…')
}); });
deleting.show(); deleting.show();
targetModel.destroy({ targetModel.destroy({
...@@ -327,7 +327,7 @@ CMS.Views.ClassInfoHandoutsView = Backbone.View.extend({ ...@@ -327,7 +327,7 @@ CMS.Views.ClassInfoHandoutsView = Backbone.View.extend({
onSave: function(event) { onSave: function(event) {
this.model.set('data', this.$codeMirror.getValue()); this.model.set('data', this.$codeMirror.getValue());
var saving = new CMS.Views.Notification.Mini({ var saving = new CMS.Views.Notification.Mini({
title: gettext('Saving') + '…' title: gettext('Saving…')
}); });
saving.show(); saving.show();
this.model.save({}, { this.model.save({}, {
......
CMS.Models.AssignmentGrade = Backbone.Model.extend({ CMS.Models.AssignmentGrade = Backbone.Model.extend({
defaults : { defaults : {
graderType : null, // the type label (string). May be "Not Graded" which implies None. I'd like to use id but that's ephemeral 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 location : null // A location object
}, },
initialize : function(attrs) { initialize : function(attrs) {
if (attrs['assignmentUrl']) { if (attrs['assignmentUrl']) {
this.set('location', new CMS.Models.Location(attrs['assignmentUrl'], {parse: true})); this.set('location', new CMS.Models.Location(attrs['assignmentUrl'], {parse: true}));
} }
}, },
parse : function(attrs) { parse : function(attrs) {
if (attrs && attrs['location']) { if (attrs && attrs['location']) {
attrs.location = new CMS.Models.Location(attrs['location'], {parse: true}); attrs.location = new CMS.Models.Location(attrs['location'], {parse: true});
} }
}, },
urlRoot : function() { urlRoot : function() {
if (this.has('location')) { if (this.has('location')) {
var location = this.get('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/'; + location.get('name') + '/gradeas/';
} }
else return ""; else return "";
} }
}); });
CMS.Views.OverviewAssignmentGrader = Backbone.View.extend({ CMS.Views.OverviewAssignmentGrader = Backbone.View.extend({
// instantiate w/ { graders : CourseGraderCollection, el : <the gradable-status div> } // instantiate w/ { graders : CourseGraderCollection, el : <the gradable-status div> }
events : { events : {
"click .menu-toggle" : "showGradeMenu", "click .menu-toggle" : "showGradeMenu",
"click .menu li" : "selectGradeType" "click .menu li" : "selectGradeType"
}, },
initialize : function() { initialize : function() {
// call template w/ {assignmentType : formatname, graders : CourseGraderCollection instance } // call template w/ {assignmentType : formatname, graders : CourseGraderCollection instance }
this.template = _.template( this.template = _.template(
// TODO move to a template file // TODO move to a template file
'<h4 class="status-label"><%= assignmentType %></h4>' + '<h4 class="status-label"><%= assignmentType %></h4>' +
'<a data-tooltip="Mark/unmark this subsection as graded" class="menu-toggle" href="#">' + '<a data-tooltip="Mark/unmark this subsection as graded" class="menu-toggle" href="#">' +
'<% if (!hideSymbol) {%><i class="icon-ok"></i><%};%>' + '<% if (!hideSymbol) {%><i class="icon-ok"></i><%};%>' +
'</a>' + '</a>' +
'<ul class="menu">' + '<ul class="menu">' +
'<% graders.each(function(option) { %>' + '<% graders.each(function(option) { %>' +
'<li><a <% if (option.get("type") == assignmentType) {%>class="is-selected" <%}%> href="#"><%= option.get("type") %></a></li>' + '<li><a <% if (option.get("type") == assignmentType) {%>class="is-selected" <%}%> href="#"><%= option.get("type") %></a></li>' +
'<% }) %>' + '<% }) %>' +
'<li><a class="gradable-status-notgraded" href="#">Not Graded</a></li>' + '<li><a class="gradable-status-notgraded" href="#">Not Graded</a></li>' +
'</ul>'); '</ul>');
this.assignmentGrade = new CMS.Models.AssignmentGrade({ this.assignmentGrade = new CMS.Models.AssignmentGrade({
assignmentUrl : this.$el.closest('.id-holder').data('id'), assignmentUrl : this.$el.closest('.id-holder').data('id'),
graderType : this.$el.data('initial-status')}); graderType : this.$el.data('initial-status')});
// TODO throw exception if graders is null // TODO throw exception if graders is null
this.graders = this.options['graders']; this.graders = this.options['graders'];
var cachethis = this; var cachethis = this;
// defining here to get closure around this // defining here to get closure around this
this.removeMenu = function(e) { this.removeMenu = function(e) {
e.preventDefault(); e.preventDefault();
cachethis.$el.removeClass('is-active'); cachethis.$el.removeClass('is-active');
$(document).off('click', cachethis.removeMenu); $(document).off('click', cachethis.removeMenu);
} };
this.hideSymbol = this.options['hideSymbol']; this.hideSymbol = this.options['hideSymbol'];
this.render(); this.render();
}, },
render : function() { render : function() {
this.$el.html(this.template({ assignmentType : this.assignmentGrade.get('graderType'), graders : this.graders, this.$el.html(this.template({ assignmentType : this.assignmentGrade.get('graderType'), graders : this.graders,
hideSymbol : this.hideSymbol })); hideSymbol : this.hideSymbol }));
if (this.assignmentGrade.has('graderType') && this.assignmentGrade.get('graderType') != "Not Graded") { if (this.assignmentGrade.has('graderType') && this.assignmentGrade.get('graderType') != "Not Graded") {
this.$el.addClass('is-set'); this.$el.addClass('is-set');
} }
else { else {
this.$el.removeClass('is-set'); this.$el.removeClass('is-set');
} }
}, },
showGradeMenu : function(e) { showGradeMenu : function(e) {
e.preventDefault(); e.preventDefault();
// I sure hope this doesn't break anything but it's needed to keep the removeMenu from activating // I sure hope this doesn't break anything but it's needed to keep the removeMenu from activating
e.stopPropagation(); e.stopPropagation();
// nasty global event trap :-( // nasty global event trap :-(
$(document).on('click', this.removeMenu); $(document).on('click', this.removeMenu);
this.$el.addClass('is-active'); this.$el.addClass('is-active');
}, },
selectGradeType : function(e) { selectGradeType : function(e) {
e.preventDefault(); e.preventDefault();
this.removeMenu(e); this.removeMenu(e);
var saving = new CMS.Views.Notification.Mini({ var saving = new CMS.Views.Notification.Mini({
title: gettext('Saving') + '&hellip;' title: gettext('Saving&hellip;')
}); });
saving.show(); 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 // 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) // of the CourseGradingPolicy model or null for Not Graded (NOTE, change template's if check for is-selected accordingly)
this.assignmentGrade.save( this.assignmentGrade.save(
'graderType', 'graderType',
$(e.target).text(), $(e.target).text(),
{success: function () { saving.hide(); }} {success: function () { saving.hide(); }}
); );
this.render(); this.render();
} }
}) });
...@@ -226,7 +226,7 @@ function _handleReorder(event, ui, parentIdField, childrenSelector) { ...@@ -226,7 +226,7 @@ function _handleReorder(event, ui, parentIdField, childrenSelector) {
children.push(ui.draggable.data('id')); children.push(ui.draggable.data('id'));
} }
var saving = new CMS.Views.Notification.Mini({ var saving = new CMS.Views.Notification.Mini({
title: gettext('Saving') + '&hellip;' title: gettext('Saving&hellip;')
}); });
saving.show(); saving.show();
$.ajax({ $.ajax({
......
...@@ -35,7 +35,7 @@ CMS.Views.ShowTextbook = Backbone.View.extend({ ...@@ -35,7 +35,7 @@ CMS.Views.ShowTextbook = Backbone.View.extend({
click: function(view) { click: function(view) {
view.hide(); view.hide();
var delmsg = new CMS.Views.Notification.Mini({ var delmsg = new CMS.Views.Notification.Mini({
title: gettext("Deleting") + "&hellip;" title: gettext("Deleting&hellip;")
}).show(); }).show();
textbook.destroy({ textbook.destroy({
complete: function() { complete: function() {
...@@ -122,7 +122,7 @@ CMS.Views.EditTextbook = Backbone.View.extend({ ...@@ -122,7 +122,7 @@ CMS.Views.EditTextbook = Backbone.View.extend({
this.setValues(); this.setValues();
if(!this.model.isValid()) { return; } if(!this.model.isValid()) { return; }
var saving = new CMS.Views.Notification.Mini({ var saving = new CMS.Views.Notification.Mini({
title: gettext("Saving") + "&hellip;" title: gettext("Saving&hellip;")
}).show(); }).show();
var that = this; var that = this;
this.model.save({}, { this.model.save({}, {
......
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