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
7f673604
Commit
7f673604
authored
Oct 08, 2015
by
Peter Fogg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow setting self-paced on schedule & details page.
Currently unstyled. ECOM-2462
parent
0107525d
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
94 additions
and
5 deletions
+94
-5
cms/djangoapps/contentstore/tests/test_course_settings.py
+5
-0
cms/static/js/views/settings/main.js
+12
-0
cms/templates/settings.html
+18
-0
common/test/acceptance/pages/studio/settings.py
+21
-0
common/test/acceptance/tests/studio/test_studio_settings_details.py
+38
-5
No files found.
cms/djangoapps/contentstore/tests/test_course_settings.py
View file @
7f673604
...
...
@@ -135,6 +135,11 @@ class CourseDetailsTestCase(CourseTestCase):
jsondetails
.
self_paced
)
@override_settings
(
FEATURES
=
dict
(
settings
.
FEATURES
,
ENABLE_SELF_PACED_COURSES
=
False
))
def
test_enable_self_paced
(
self
):
details
=
CourseDetails
.
fetch
(
self
.
course
.
id
)
self
.
assertNotIn
(
'self_paced'
,
details
.
__dict__
)
@override_settings
(
MKTG_URLS
=
{
'ROOT'
:
'dummy-root'
})
def
test_marketing_site_fetch
(
self
):
settings_details_url
=
get_url
(
self
.
course
.
id
)
...
...
cms/static/js/views/settings/main.js
View file @
7f673604
...
...
@@ -99,6 +99,13 @@ var DetailsView = ValidatingView.extend({
}
this
.
$
(
'#'
+
this
.
fieldToSelectorMap
[
'entrance_exam_minimum_score_pct'
]).
val
(
this
.
model
.
get
(
'entrance_exam_minimum_score_pct'
));
if
(
this
.
model
.
get
(
'self_paced'
))
{
this
.
$
(
'#course-pace-self-paced'
).
attr
(
'checked'
,
true
);
}
else
{
this
.
$
(
'#course-pace-instructor-led'
).
attr
(
'checked'
,
true
);
}
this
.
licenseView
.
render
()
return
this
;
...
...
@@ -236,6 +243,11 @@ var DetailsView = ValidatingView.extend({
}
},
this
),
1000
);
break
;
case
'course-pace-self-paced'
:
// Fallthrough to handle both radio buttons
case
'course-pace-instructor-led'
:
this
.
model
.
set
(
'self_paced'
,
JSON
.
parse
(
event
.
currentTarget
.
value
));
break
;
default
:
// Everything else is handled by datepickers and CodeMirror.
break
;
}
...
...
cms/templates/settings.html
View file @
7f673604
...
...
@@ -412,6 +412,24 @@ CMS.URL.UPLOAD_ASSET = '${upload_asset_url}';
</section>
% endif
% if settings.FEATURES.get("ENABLE_SELF_PACED_COURSES", False):
<hr
class=
"divide"
/>
<section
class=
"group-settings pacing"
>
<header>
<h2
class=
"title-2"
>
${_("Course Pacing")}
</h2>
<span
class=
"tip"
>
${_("Set the pacing for this course")}
</span>
</header>
<input
type=
"radio"
name=
"self-paced"
id=
"course-pace-self-paced"
value=
"true"
/>
<label
for=
"course-pace-self-paced"
>
Self-Paced
</label>
<input
type=
"radio"
name=
"self-paced"
id=
"course-pace-instructor-led"
value=
"false"
/>
<label
for=
"course-pace-instructor-led"
>
Instructor Led
</label>
</section>
% endif
% if settings.FEATURES.get("LICENSING", False):
<hr
class=
"divide"
/>
...
...
common/test/acceptance/pages/studio/settings.py
View file @
7f673604
...
...
@@ -131,6 +131,27 @@ class SettingsPage(CoursePage):
raise
Exception
(
"Invalid license name: {name}"
.
format
(
name
=
license_name
))
button
.
click
()
pacing_css
=
'section.pacing input[type=radio]:checked'
@property
def
course_pacing
(
self
):
"""
Returns the label text corresponding to the checked pacing radio button.
"""
self
.
wait_for_element_presence
(
self
.
pacing_css
,
'course pacing controls present and rendered'
)
checked
=
self
.
q
(
css
=
self
.
pacing_css
)
.
results
[
0
]
checked_id
=
checked
.
get_attribute
(
'id'
)
return
self
.
q
(
css
=
'label[for={checked_id}]'
.
format
(
checked_id
=
checked_id
))
.
results
[
0
]
.
text
@course_pacing.setter
def
course_pacing
(
self
,
pacing
):
"""
Sets the course to either self-paced or instructor-led by checking
the appropriate radio button.
"""
self
.
wait_for_element_presence
(
self
.
pacing_css
,
'course pacing controls present'
)
self
.
q
(
xpath
=
"//label[contains(text(), '{pacing}')]"
.
format
(
pacing
=
pacing
))
.
click
()
################
# Waits
################
...
...
common/test/acceptance/tests/studio/test_studio_settings_details.py
View file @
7f673604
...
...
@@ -16,12 +16,11 @@ from ..helpers import (
)
class
SettingsMilestonesTest
(
StudioCourseTest
):
"""
Tests for milestones feature in Studio's settings tab
"""
class
StudioSettingsDetailsTest
(
StudioCourseTest
):
"""Base class for settings and details page tests."""
def
setUp
(
self
,
is_staff
=
True
):
super
(
S
ettingsMilestone
sTest
,
self
)
.
setUp
(
is_staff
=
is_staff
)
super
(
S
tudioSettingsDetail
sTest
,
self
)
.
setUp
(
is_staff
=
is_staff
)
self
.
settings_detail
=
SettingsPage
(
self
.
browser
,
self
.
course_info
[
'org'
],
...
...
@@ -33,6 +32,11 @@ class SettingsMilestonesTest(StudioCourseTest):
self
.
settings_detail
.
visit
()
self
.
assertTrue
(
self
.
settings_detail
.
is_browser_on_page
())
class
SettingsMilestonesTest
(
StudioSettingsDetailsTest
):
"""
Tests for milestones feature in Studio's settings tab
"""
def
test_page_has_prerequisite_field
(
self
):
"""
Test to make sure page has pre-requisite course field if milestones app is enabled.
...
...
@@ -193,3 +197,32 @@ class SettingsMilestonesTest(StudioCourseTest):
css_selector
=
'.add-item a.button-new'
,
text
=
'New Subsection'
))
class
CoursePacingTest
(
StudioSettingsDetailsTest
):
"""Tests for setting a course to self-paced."""
def
test_default_instructor_led
(
self
):
"""
Test that the 'instructor led' button is checked by default.
"""
self
.
assertEqual
(
self
.
settings_detail
.
course_pacing
,
'Instructor Led'
)
def
test_self_paced
(
self
):
"""
Test that the 'self-paced' button is checked for a self-paced
course.
"""
self
.
course_fixture
.
add_course_details
({
'self_paced'
:
True
})
self
.
course_fixture
.
configure_course
()
self
.
settings_detail
.
refresh_page
()
self
.
assertEqual
(
self
.
settings_detail
.
course_pacing
,
'Self-Paced'
)
def
test_set_self_paced
(
self
):
"""
Test that the self-paced option is persisted correctly.
"""
self
.
settings_detail
.
course_pacing
=
'Self-Paced'
self
.
settings_detail
.
save_changes
()
self
.
settings_detail
.
refresh_page
()
self
.
assertEqual
(
self
.
settings_detail
.
course_pacing
,
'Self-Paced'
)
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