Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
edx-platform-release
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Admin message
code.vt.edu will be down for maintenance from 0530-0630 EDT Wednesday, March 26th
Show more breadcrumbs
Hsin-Yu Chien
edx-platform-release
Commits
dc0e3d04
Commit
dc0e3d04
authored
11 years ago
by
Diana Huang
Browse files
Options
Downloads
Patches
Plain Diff
Determine which mode was selected more intelligently.
LMS-1384
parent
9f104eb6
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
common/djangoapps/course_modes/views.py
+9
-11
9 additions, 11 deletions
common/djangoapps/course_modes/views.py
common/templates/course_modes/choose.html
+3
-3
3 additions, 3 deletions
common/templates/course_modes/choose.html
with
12 additions
and
14 deletions
common/djangoapps/course_modes/views.py
+
9
−
11
View file @
dc0e3d04
...
...
@@ -82,9 +82,7 @@ class ChooseModeView(View):
upgrade
=
request
.
GET
.
get
(
'
upgrade
'
,
False
)
requested_mode
=
self
.
get_requested_mode
(
request
.
POST
.
get
(
"
mode
"
))
if
requested_mode
==
"
verified
"
and
request
.
POST
.
get
(
"
honor-code
"
):
requested_mode
=
"
honor
"
requested_mode
=
self
.
get_requested_mode
(
request
.
POST
)
allowed_modes
=
CourseMode
.
modes_for_course_dict
(
course_id
)
if
requested_mode
not
in
allowed_modes
:
...
...
@@ -125,14 +123,14 @@ class ChooseModeView(View):
reverse
(
'
verify_student_show_requirements
'
,
kwargs
=
{
'
course_id
'
:
course_id
})
+
"
?upgrade={}
"
.
format
(
upgrade
))
def
get_requested_mode
(
self
,
user_cho
ic
e
):
def
get_requested_mode
(
self
,
request_d
ic
t
):
"""
Given the
tex
t of `user_choice`, return the
Given the
request objec
t of `user_choice`, return the
corresponding course mode slug
"""
choices
=
{
"
Select Audit
"
:
"
audit
"
,
"
Select Certificate
"
:
"
verified
"
,
"
Upgrade Your Registration
"
:
"
verified
"
}
return
choices
.
get
(
user_choice
)
if
'
audit_mode
'
in
request_dict
:
return
'
audit
'
if
'
certificate_mode
'
and
request_dict
.
get
(
"
honor-code
"
):
return
'
honor
'
if
'
certificate_mode
'
in
request_dict
:
return
'
verified
'
This diff is collapsed.
Click to expand it.
common/templates/course_modes/choose.html
+
3
−
3
View file @
dc0e3d04
...
...
@@ -134,9 +134,9 @@ $(document).ready(function() {
<ul
class=
"list-actions"
>
<li
class=
"action action-select"
>
%if upgrade:
<input
type=
"submit"
name=
"mode"
value=
"Upgrade Your Registration"
/>
<input
type=
"submit"
name=
"
certificate_
mode"
value=
"
${_('
Upgrade Your Registration
')}
"
/>
%else:
<input
type=
"submit"
name=
"mode"
value=
"Select Certificate"
/>
<input
type=
"submit"
name=
"
certificate_
mode"
value=
"
${_('
Select Certificate
')}
"
/>
%endif
</li>
...
...
@@ -179,7 +179,7 @@ $(document).ready(function() {
<ul
class=
"list-actions"
>
<li
class=
"action action-select"
>
<input
type=
"submit"
name=
"mode"
value=
"Select Audit"
/>
<input
type=
"submit"
name=
"
audit_
mode"
value=
"
${_('
Select Audit
')}
"
/>
</li>
</ul>
</div>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
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