Merge pull request #11161 from edx/asadiqbal08/WL-270
WL-270 used gettext in javascript files
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
define(["backbone", "backbone.associations"], function(Backbone) {
|
define(["backbone", "gettext", "backbone.associations"], function(Backbone, gettext) {
|
||||||
var Chapter = Backbone.AssociatedModel.extend({
|
var Chapter = Backbone.AssociatedModel.extend({
|
||||||
defaults: function() {
|
defaults: function() {
|
||||||
return {
|
return {
|
||||||
@@ -32,17 +32,17 @@ define(["backbone", "backbone.associations"], function(Backbone) {
|
|||||||
validate: function(attrs, options) {
|
validate: function(attrs, options) {
|
||||||
if(!attrs.name && !attrs.asset_path) {
|
if(!attrs.name && !attrs.asset_path) {
|
||||||
return {
|
return {
|
||||||
message: "Chapter name and asset_path are both required",
|
message: gettext("Chapter name and asset_path are both required"),
|
||||||
attributes: {name: true, asset_path: true}
|
attributes: {name: true, asset_path: true}
|
||||||
};
|
};
|
||||||
} else if(!attrs.name) {
|
} else if(!attrs.name) {
|
||||||
return {
|
return {
|
||||||
message: "Chapter name is required",
|
message: gettext("Chapter name is required"),
|
||||||
attributes: {name: true}
|
attributes: {name: true}
|
||||||
};
|
};
|
||||||
} else if (!attrs.asset_path) {
|
} else if (!attrs.asset_path) {
|
||||||
return {
|
return {
|
||||||
message: "asset_path is required",
|
message: gettext("asset_path is required"),
|
||||||
attributes: {asset_path: true}
|
attributes: {asset_path: true}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
define(["backbone", "underscore", "js/models/chapter", "js/collections/chapter",
|
define(["backbone", "underscore", "gettext", "js/models/chapter", "js/collections/chapter",
|
||||||
"backbone.associations", "coffee/src/main"],
|
"backbone.associations", "coffee/src/main"],
|
||||||
function(Backbone, _, ChapterModel, ChapterCollection) {
|
function(Backbone, _, gettext, ChapterModel, ChapterCollection) {
|
||||||
|
|
||||||
var Textbook = Backbone.AssociatedModel.extend({
|
var Textbook = Backbone.AssociatedModel.extend({
|
||||||
defaults: function() {
|
defaults: function() {
|
||||||
@@ -60,13 +60,13 @@ define(["backbone", "underscore", "js/models/chapter", "js/collections/chapter",
|
|||||||
validate: function(attrs, options) {
|
validate: function(attrs, options) {
|
||||||
if (!attrs.name) {
|
if (!attrs.name) {
|
||||||
return {
|
return {
|
||||||
message: "Textbook name is required",
|
message: gettext("Textbook name is required"),
|
||||||
attributes: {name: true}
|
attributes: {name: true}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
if (attrs.chapters.length === 0) {
|
if (attrs.chapters.length === 0) {
|
||||||
return {
|
return {
|
||||||
message: "Please add at least one chapter",
|
message: gettext("Please add at least one chapter"),
|
||||||
attributes: {chapters: true}
|
attributes: {chapters: true}
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
@@ -79,7 +79,7 @@ define(["backbone", "underscore", "js/models/chapter", "js/collections/chapter",
|
|||||||
});
|
});
|
||||||
if(!_.isEmpty(invalidChapters)) {
|
if(!_.isEmpty(invalidChapters)) {
|
||||||
return {
|
return {
|
||||||
message: "All chapters must have a name and asset",
|
message: gettext("All chapters must have a name and asset"),
|
||||||
attributes: {chapters: invalidChapters}
|
attributes: {chapters: invalidChapters}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user