Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
3d30bb11
Commit
3d30bb11
authored
Jan 07, 2016
by
Matt Drayer
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #11161 from edx/asadiqbal08/WL-270
WL-270 used gettext in javascript files
parents
388a5dc7
7f38c1a3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
9 deletions
+9
-9
cms/static/js/models/chapter.js
+4
-4
cms/static/js/models/textbook.js
+5
-5
No files found.
cms/static/js/models/chapter.js
View file @
3d30bb11
define
([
"backbone"
,
"
backbone.associations"
],
function
(
Backbone
)
{
define
([
"backbone"
,
"
gettext"
,
"backbone.associations"
],
function
(
Backbone
,
gettext
)
{
var
Chapter
=
Backbone
.
AssociatedModel
.
extend
({
defaults
:
function
()
{
return
{
...
...
@@ -32,17 +32,17 @@ define(["backbone", "backbone.associations"], function(Backbone) {
validate
:
function
(
attrs
,
options
)
{
if
(
!
attrs
.
name
&&
!
attrs
.
asset_path
)
{
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
}
};
}
else
if
(
!
attrs
.
name
)
{
return
{
message
:
"Chapter name is required"
,
message
:
gettext
(
"Chapter name is required"
)
,
attributes
:
{
name
:
true
}
};
}
else
if
(
!
attrs
.
asset_path
)
{
return
{
message
:
"asset_path is required"
,
message
:
gettext
(
"asset_path is required"
)
,
attributes
:
{
asset_path
:
true
}
};
}
...
...
cms/static/js/models/textbook.js
View file @
3d30bb11
define
([
"backbone"
,
"underscore"
,
"js/models/chapter"
,
"js/collections/chapter"
,
define
([
"backbone"
,
"underscore"
,
"
gettext"
,
"
js/models/chapter"
,
"js/collections/chapter"
,
"backbone.associations"
,
"coffee/src/main"
],
function
(
Backbone
,
_
,
ChapterModel
,
ChapterCollection
)
{
function
(
Backbone
,
_
,
gettext
,
ChapterModel
,
ChapterCollection
)
{
var
Textbook
=
Backbone
.
AssociatedModel
.
extend
({
defaults
:
function
()
{
...
...
@@ -60,13 +60,13 @@ define(["backbone", "underscore", "js/models/chapter", "js/collections/chapter",
validate
:
function
(
attrs
,
options
)
{
if
(
!
attrs
.
name
)
{
return
{
message
:
"Textbook name is required"
,
message
:
gettext
(
"Textbook name is required"
)
,
attributes
:
{
name
:
true
}
};
}
if
(
attrs
.
chapters
.
length
===
0
)
{
return
{
message
:
"Please add at least one chapter"
,
message
:
gettext
(
"Please add at least one chapter"
)
,
attributes
:
{
chapters
:
true
}
};
}
else
{
...
...
@@ -79,7 +79,7 @@ define(["backbone", "underscore", "js/models/chapter", "js/collections/chapter",
});
if
(
!
_
.
isEmpty
(
invalidChapters
))
{
return
{
message
:
"All chapters must have a name and asset"
,
message
:
gettext
(
"All chapters must have a name and asset"
)
,
attributes
:
{
chapters
:
invalidChapters
}
};
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment