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
0fe31fa9
Commit
0fe31fa9
authored
Aug 28, 2017
by
Alex Dusenbery
Committed by
Alex Dusenbery
Aug 29, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
EDUCATOR-1251 | cert available date validation should take course pacing into account.
parent
03abf94a
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
5 deletions
+28
-5
cms/static/js/models/settings/course_details.js
+6
-4
cms/static/js/spec/views/settings/main_spec.js
+12
-1
cms/templates/js/mock/mock-settings-page.underscore
+10
-0
No files found.
cms/static/js/models/settings/course_details.js
View file @
0fe31fa9
...
...
@@ -31,7 +31,8 @@ define(['backbone', 'underscore', 'gettext', 'js/models/validation_helpers', 'js
entrance_exam_enabled
:
''
,
entrance_exam_minimum_score_pct
:
'50'
,
learning_info
:
[],
instructor_info
:
{}
instructor_info
:
{},
self_paced
:
null
},
validate
:
function
(
newattrs
)
{
...
...
@@ -39,8 +40,9 @@ define(['backbone', 'underscore', 'gettext', 'js/models/validation_helpers', 'js
// A bit funny in that the video key validation is asynchronous; so, it won't stop the validation.
var
errors
=
{};
newattrs
=
DateUtils
.
convertDateStringsToObjects
(
newattrs
,
[
'start_date'
,
'end_date'
,
'certificate_available_date'
,
'enrollment_start'
,
'enrollment_end'
]
);
newattrs
,
[
'start_date'
,
'end_date'
,
'certificate_available_date'
,
'enrollment_start'
,
'enrollment_end'
]
);
if
(
newattrs
.
start_date
===
null
)
{
errors
.
start_date
=
gettext
(
'The course must have an assigned start date.'
);
...
...
@@ -58,7 +60,7 @@ define(['backbone', 'underscore', 'gettext', 'js/models/validation_helpers', 'js
if
(
newattrs
.
end_date
&&
newattrs
.
enrollment_end
&&
newattrs
.
end_date
<
newattrs
.
enrollment_end
)
{
errors
.
enrollment_end
=
gettext
(
'The enrollment end date cannot be after the course end date.'
);
}
if
(
newattrs
.
end_date
&&
newattrs
.
certificate_available_date
&&
if
(
!
this
.
get
(
'self_paced'
)
&&
newattrs
.
end_date
&&
newattrs
.
certificate_available_date
&&
newattrs
.
certificate_available_date
<
newattrs
.
end_date
)
{
errors
.
certificate_available_date
=
gettext
(
'The certificate available date must be later than the course end date.'
...
...
cms/static/js/spec/views/settings/main_spec.js
View file @
0fe31fa9
...
...
@@ -48,7 +48,8 @@ define([
learning_info
:
[
''
],
instructor_info
:
{
'instructors'
:
[{
'name'
:
''
,
'title'
:
''
,
'organization'
:
''
,
'image'
:
''
,
'bio'
:
''
}]
}
},
self_paced
:
false
},
mockSettingsPage
=
readFixtures
(
'mock/mock-settings-page.underscore'
),
...
...
@@ -348,5 +349,15 @@ define([
);
AjaxHelpers
.
respondWithJson
(
requests
,
expectedJson
);
});
it
(
'should disallow save with a certificate available date before end date'
,
function
()
{
$
(
'#course-end-date'
).
val
(
'01/01/2030'
).
trigger
(
'change'
);
expect
(
this
.
view
.
$
(
'.message-error'
)).
toExist
();
});
it
(
'should allow save with a certificate available date before end date for self-paced course'
,
function
()
{
this
.
model
.
set
(
'self_paced'
,
true
);
$
(
'#course-end-date'
).
val
(
'01/01/2030'
).
trigger
(
'change'
);
expect
(
this
.
view
.
$
(
'.message-error'
)).
not
.
toExist
();
this
.
model
.
set
(
'self_paced'
,
false
);
});
});
});
cms/templates/js/mock/mock-settings-page.underscore
View file @
0fe31fa9
...
...
@@ -35,6 +35,16 @@
</ol>
<ol class="list-input">
<li class="field-group field-group-certificate-available" id="certificate-available">
<div class="field date" id="field-certificate-available-date">
<label for="certificate-available-date">Certificates Available Date</label>
<input type="text" class="certificate-available-date date start datepicker" id="certificate-available-date" placeholder="MM/DD/YYYY" autocomplete="off" />
<span class="tip tip-stacked">By default, 48 hours after course end date</span>
</div>
</li>
</ol>
<ol class="list-input">
<li class="field-group field-group-enrollment-start" id="enrollment-start">
<div class="field date" id="field-enrollment-start-date">
<label for="course-enrollment-start-date">Enrollment Start Date</label>
...
...
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