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
34272beb
Commit
34272beb
authored
Feb 11, 2013
by
Brian Talbot
Browse files
Options
Browse Files
Download
Plain Diff
studio - merge resolving
parents
77343519
773dfce6
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
14 deletions
+20
-14
cms/static/js/models/settings/course_details.js
+2
-4
cms/static/js/views/settings/main_settings_view.js
+5
-7
cms/static/js/views/validating_view.js
+13
-3
No files found.
cms/static/js/models/settings/course_details.js
View file @
34272beb
...
...
@@ -68,12 +68,10 @@ CMS.Models.Settings.CourseDetails = Backbone.Model.extend({
save_videosource
:
function
(
newsource
)
{
// newsource either is <video youtube="speed:key, *"/> 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
},
{
error
:
CMS
.
ServerError
});
if
(
_
.
isEmpty
(
newsource
)
&&
!
_
.
isEmpty
(
this
.
get
(
'intro_video'
)))
this
.
set
({
'intro_video'
:
null
});
// TODO remove all whitespace w/in string
else
{
if
(
this
.
get
(
'intro_video'
)
!==
newsource
)
this
.
save
(
'intro_video'
,
newsource
,
{
error
:
CMS
.
ServerError
});
if
(
this
.
get
(
'intro_video'
)
!==
newsource
)
this
.
set
(
'intro_video'
,
newsource
);
}
return
this
.
videosourceSample
();
...
...
cms/static/js/views/settings/main_settings_view.js
View file @
34272beb
...
...
@@ -84,8 +84,8 @@ CMS.Views.Settings.Details = CMS.Views.ValidatingView.extend({
setupDatePicker
:
function
(
fieldName
)
{
var
cacheModel
=
this
.
model
;
var
div
=
this
.
$el
.
find
(
'#'
+
this
.
fieldToSelectorMap
[
fieldName
]);
var
datefield
=
$
(
div
).
find
(
".date"
);
var
timefield
=
$
(
div
).
find
(
".time"
);
var
datefield
=
$
(
div
).
find
(
"
input:
.date"
);
var
timefield
=
$
(
div
).
find
(
"
input:
.time"
);
var
cachethis
=
this
;
var
savefield
=
function
()
{
cachethis
.
clearValidationErrors
();
...
...
@@ -97,7 +97,7 @@ CMS.Views.Settings.Details = CMS.Views.ValidatingView.extend({
}
var
newVal
=
new
Date
(
date
.
getTime
()
+
time
*
1000
);
if
(
cacheModel
.
get
(
fieldName
).
getTime
()
!==
newVal
.
getTime
())
{
cacheModel
.
save
(
fieldName
,
newVal
,
{
error
:
CMS
.
ServerError
}
);
cacheModel
.
save
(
fieldName
,
newVal
);
}
}
};
...
...
@@ -149,8 +149,7 @@ CMS.Views.Settings.Details = CMS.Views.ValidatingView.extend({
},
removeSyllabus
:
function
()
{
if
(
this
.
model
.
has
(
'syllabus'
))
this
.
model
.
save
({
'syllabus'
:
null
},
{
error
:
CMS
.
ServerError
});
if
(
this
.
model
.
has
(
'syllabus'
))
this
.
model
.
save
({
'syllabus'
:
null
});
},
assetSyllabus
:
function
()
{
...
...
@@ -184,8 +183,7 @@ CMS.Views.Settings.Details = CMS.Views.ValidatingView.extend({
mirror
.
save
();
cachethis
.
clearValidationErrors
();
var
newVal
=
mirror
.
getValue
();
if
(
cachethis
.
model
.
get
(
field
)
!=
newVal
)
cachethis
.
model
.
save
(
field
,
newVal
,
{
error
:
CMS
.
ServerError
});
if
(
cachethis
.
model
.
get
(
field
)
!=
newVal
)
cachethis
.
model
.
save
(
field
,
newVal
);
}
});
}
...
...
cms/static/js/views/validating_view.js
View file @
34272beb
...
...
@@ -19,9 +19,19 @@ CMS.Views.ValidatingView = Backbone.View.extend({
},
_cacheValidationErrors
:
[],
handleValidationError
:
function
(
model
,
error
)
{
// error triggered either by validation or server error
// error is object w/ fields and error strings
for
(
var
field
in
error
)
{
var
ele
=
this
.
$el
.
find
(
'#'
+
this
.
fieldToSelectorMap
[
field
]);
var
ele
=
this
.
$el
.
find
(
'#'
+
this
.
fieldToSelectorMap
[
field
]);
if
(
ele
.
length
===
0
)
{
// check if it might a server error: note a typo in the field name
// or failure to put in a map may cause this to muffle validation errors
if
(
_
.
has
(
error
,
'error'
)
&&
_
.
has
(
error
,
'responseText'
))
{
CMS
.
ServerError
(
model
,
error
);
return
;
}
else
continue
;
}
this
.
_cacheValidationErrors
.
push
(
ele
);
if
(
$
(
ele
).
is
(
'div'
))
{
// put error on the contained inputs
...
...
@@ -50,9 +60,9 @@ CMS.Views.ValidatingView = Backbone.View.extend({
var
field
=
this
.
selectorToField
[
event
.
currentTarget
.
id
];
var
currentVal
=
this
.
model
.
get
(
field
);
var
newVal
=
$
(
event
.
currentTarget
).
val
();
this
.
clearValidationErrors
();
// curr = new if user reverts manually
if
(
currentVal
!=
newVal
)
{
this
.
clearValidationErrors
();
this
.
model
.
save
(
field
,
newVal
,
{
error
:
CMS
.
ServerError
});
this
.
model
.
save
(
field
,
newVal
);
return
true
;
}
else
return
false
;
...
...
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