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
ded0885c
Commit
ded0885c
authored
Jul 19, 2016
by
Renzo Lucioni
Committed by
GitHub
Jul 19, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #13025 from edx/renzo/pdp-archived-courses
Allow viewing of archived courses from the program detail page
parents
a653d449
b1f59163
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
27 deletions
+46
-27
lms/static/js/spec/learner_dashboard/course_enroll_view_spec.js
+37
-18
lms/templates/learner_dashboard/course_enroll.underscore
+9
-9
No files found.
lms/static/js/spec/learner_dashboard/course_enroll_view_spec.js
View file @
ded0885c
...
...
@@ -14,6 +14,25 @@ define([
courseEnrollModel
,
urlModel
,
setupView
,
singleRunModeList
,
multiRunModeList
,
context
=
{
display_name
:
'Edx Demo course'
,
key
:
'edX+DemoX+Demo_Course'
,
organization
:
{
display_name
:
'edx.org'
,
key
:
'edX'
}
},
urls
=
{
dashboard_url
:
'/dashboard'
,
id_verification_url
:
'/verify_student/start_flow/'
,
track_selection_url
:
'/select_track/course/'
};
beforeEach
(
function
()
{
// Redefine this data prior to each test case so that tests can't
// break each other by modifying data copied by reference.
singleRunModeList
=
[{
start_date
:
'Apr 25, 2016'
,
end_date
:
'Jun 13, 2016'
,
...
...
@@ -26,7 +45,8 @@ define([
run_key
:
'2T2016'
,
is_enrolled
:
false
,
is_enrollment_open
:
true
}],
}];
multiRunModeList
=
[{
start_date
:
'May 21, 2015'
,
end_date
:
'Sep 21, 2015'
,
...
...
@@ -51,20 +71,8 @@ define([
run_key
:
'2T2015'
,
is_enrolled
:
false
,
is_enrollment_open
:
true
}],
context
=
{
display_name
:
'Edx Demo course'
,
key
:
'edX+DemoX+Demo_Course'
,
organization
:
{
display_name
:
'edx.org'
,
key
:
'edX'
}
},
urls
=
{
dashboard_url
:
'/dashboard'
,
id_verification_url
:
'/verify_student/start_flow/'
,
track_selection_url
:
'/select_track/course/'
};
}];
});
setupView
=
function
(
runModes
,
urls
){
context
.
run_modes
=
runModes
;
...
...
@@ -105,14 +113,26 @@ define([
it
(
'should render the course enroll view based on enrolled data'
,
function
(){
singleRunModeList
[
0
].
is_enrolled
=
true
;
setupView
(
singleRunModeList
);
expect
(
view
.
$
(
'.enrollment-info'
).
html
().
trim
()).
toEqual
(
'enrolled'
);
expect
(
view
.
$
(
'.view-course-link'
).
attr
(
'href'
)).
toEqual
(
context
.
run_modes
[
0
].
course_url
);
expect
(
view
.
$
(
'.view-course-link'
).
attr
(
'href'
)).
toEqual
(
context
.
run_modes
[
0
].
course_url
);
expect
(
view
.
$
(
'.view-course-link'
).
text
().
trim
()).
toEqual
(
'View Course'
);
expect
(
view
.
$
(
'.run-select'
).
length
).
toBe
(
0
);
});
it
(
'should allow the learner to view an archived course'
,
function
(){
// Regression test for ECOM-4974.
singleRunModeList
[
0
].
is_enrolled
=
true
;
singleRunModeList
[
0
].
is_enrollment_open
=
false
;
singleRunModeList
[
0
].
is_course_ended
=
true
;
setupView
(
singleRunModeList
);
expect
(
view
.
$
(
'.view-course-link'
).
text
().
trim
()).
toEqual
(
'View Archived Course'
);
});
it
(
'should not render anything if run modes is empty'
,
function
(){
setupView
([]);
expect
(
view
.
$
(
'.enrollment-info'
).
length
).
toBe
(
0
);
...
...
@@ -140,7 +160,6 @@ define([
});
it
(
'should enroll learner when enroll button clicked'
,
function
(){
singleRunModeList
[
0
].
is_enrolled
=
false
;
setupView
(
singleRunModeList
);
expect
(
view
.
$
(
'.enroll-button'
).
length
).
toBe
(
1
);
spyOn
(
courseEnrollModel
,
'save'
);
...
...
lms/templates/learner_dashboard/course_enroll.underscore
View file @
ded0885c
<% if (is_enrolled){ %>
<% if (is_enrolled)
{ %>
<div class="enrollment-info"><%- gettext('enrolled') %></div>
<% if (is_enrollment_open || is_course_ended){ %>
<% if (is_enrollment_open || is_course_ended)
{ %>
<a href="<%- course_url %>" class="btn-neutral btn view-course-link">
<% if (is_enrollment_open){ %>
<% if (is_enrollment_open)
{ %>
<%- gettext('View Course') %>
<% } else if (
course_ended)
{ %>
<% } else if (
is_course_ended)
{ %>
<%- gettext('View Archived Course') %>
<% } %>
</a>
<% } %>
<% }
else
{ %>
<% if (enrollable_run_modes.length > 0){ %>
<% }
else
{ %>
<% if (enrollable_run_modes.length > 0)
{ %>
<div class="enrollment-info"><%- gettext('not enrolled') %></div>
<% if (enrollable_run_modes.length > 1){ %>
<% if (enrollable_run_modes.length > 1)
{ %>
<div class="run-select-container">
<div class="select-error">
<%- gettext('Please select a course date') %>
...
...
@@ -24,10 +24,10 @@
<option value="" selected="selected">
<%- gettext('Choose Course Date') %>
</option>
<% _.each (enrollable_run_modes, function(runMode){ %>
<% _.each (enrollable_run_modes, function(runMode)
{ %>
<option
value="<%- runMode.run_key %>"
<% if (run_key === runMode.run_key){ %>
<% if (run_key === runMode.run_key)
{ %>
selected="selected"
<% }%>
>
...
...
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