Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
edx-platform-release
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Hsin-Yu Chien
edx-platform-release
Commits
ded0885c
Commit
ded0885c
authored
8 years ago
by
Renzo Lucioni
Committed by
GitHub
8 years ago
Browse files
Options
Downloads
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
Loading
Loading
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lms/static/js/spec/learner_dashboard/course_enroll_view_spec.js
+37
-18
37 additions, 18 deletions
...atic/js/spec/learner_dashboard/course_enroll_view_spec.js
lms/templates/learner_dashboard/course_enroll.underscore
+9
-9
9 additions, 9 deletions
lms/templates/learner_dashboard/course_enroll.underscore
with
46 additions
and
27 deletions
lms/static/js/spec/learner_dashboard/course_enroll_view_spec.js
+
37
−
18
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
'
);
...
...
This diff is collapsed.
Click to expand it.
lms/templates/learner_dashboard/course_enroll.underscore
+
9
−
9
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"
<% }%>
>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment