TNL-772: Fix course time settings.

This commit is contained in:
polesye
2014-11-17 14:58:05 +02:00
parent 4a3700c151
commit b6d8291996
5 changed files with 136 additions and 20 deletions

View File

@@ -1,4 +1,4 @@
define(["backbone", "underscore", "gettext", "date"], function(Backbone, _, gettext, date) {
define(["backbone", "underscore", "gettext"], function(Backbone, _, gettext) {
var CourseDetails = Backbone.Model.extend({
defaults: {
@@ -18,23 +18,6 @@ var CourseDetails = Backbone.Model.extend({
course_image_asset_path: '' // the full URL (/c4x/org/course/num/asset/filename)
},
// When init'g from html script, ensure you pass {parse: true} as an option (2nd arg to reset)
parse: function(attributes) {
if (attributes['start_date']) {
attributes.start_date = date.parse(attributes.start_date);
}
if (attributes['end_date']) {
attributes.end_date = date.parse(attributes.end_date);
}
if (attributes['enrollment_start']) {
attributes.enrollment_start = date.parse(attributes.enrollment_start);
}
if (attributes['enrollment_end']) {
attributes.enrollment_end = date.parse(attributes.enrollment_end);
}
return attributes;
},
validate: function(newattrs) {
// Returns either nothing (no return call) so that validate works or an object of {field: errorstring} pairs
// A bit funny in that the video key validation is asynchronous; so, it won't stop the validation.