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
793a4726
Commit
793a4726
authored
Feb 17, 2015
by
Sarina Canelake
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #6962 from Stanford-Online/giulio/course-price-bugfix
BUGFIX: shopping_cart_enabled + cosmetic price
parents
cec34841
6a037d05
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
4 deletions
+19
-4
lms/djangoapps/courseware/tests/test_about.py
+14
-0
lms/djangoapps/courseware/views.py
+2
-1
lms/templates/courseware/course_about.html
+3
-3
No files found.
lms/djangoapps/courseware/tests/test_about.py
View file @
793a4726
...
...
@@ -544,3 +544,17 @@ class AboutPurchaseCourseTestCase(LoginEnrollmentTestCase, ModuleStoreTestCase):
self
.
assertEqual
(
resp
.
status_code
,
200
)
self
.
assertIn
(
"Course is full"
,
resp
.
content
)
self
.
assertNotIn
(
"Add buyme to Cart ($10)"
,
resp
.
content
)
def
test_free_course_display
(
self
):
"""
Make sure other courses that don't have shopping cart enabled don't display the add-to-cart button
and don't display the course_price field if Cosmetic Price is disabled.
"""
course
=
CourseFactory
.
create
(
org
=
'MITx'
,
number
=
'free'
,
display_name
=
'Course For Free'
)
self
.
setup_user
()
url
=
reverse
(
'about_course'
,
args
=
[
course
.
id
.
to_deprecated_string
()])
resp
=
self
.
client
.
get
(
url
)
self
.
assertEqual
(
resp
.
status_code
,
200
)
self
.
assertNotIn
(
"Add free to Cart (Free)"
,
resp
.
content
)
self
.
assertNotIn
(
'<p class="important-dates-item-title">Price</p>'
,
resp
.
content
)
lms/djangoapps/courseware/views.py
View file @
793a4726
...
...
@@ -815,6 +815,7 @@ def course_about(request, course_id):
reg_url
=
reverse
(
'register_user'
),
course_id
=
course
.
id
.
to_deprecated_string
())
course_price
=
get_cosmetic_display_price
(
course
,
registration_price
)
can_add_course_to_cart
=
_is_shopping_cart_enabled
and
registration_price
# Used to provide context to message to student if enrollment not allowed
can_enroll
=
has_access
(
request
.
user
,
'enroll'
,
course
)
...
...
@@ -851,7 +852,7 @@ def course_about(request, course_id):
# We do not want to display the internal courseware header, which is used when the course is found in the
# context. This value is therefor explicitly set to render the appropriate header.
'disable_courseware_header'
:
True
,
'
is_shopping_cart_enabled'
:
_is_shopping_cart_enabled
,
'
can_add_course_to_cart'
:
can_add_course_to_cart
,
'cart_link'
:
reverse
(
'shoppingcart.views.show_cart'
),
'pre_requisite_courses'
:
pre_requisite_courses
})
...
...
lms/templates/courseware/course_about.html
View file @
793a4726
...
...
@@ -37,7 +37,7 @@ from edxmako.shortcuts import marketing_link
event
.
preventDefault
();
});
%
if
is_shopping_cart_enabled
:
%
if
can_add_course_to_cart
:
add_course_complete_handler
=
function
(
jqXHR
,
textStatus
)
{
if
(
jqXHR
.
status
==
200
)
{
location
.
href
=
"${cart_link}"
;
...
...
@@ -157,7 +157,7 @@ from edxmako.shortcuts import marketing_link
## so that they can register and become a real user that can enroll.
% elif not is_shib_course and not can_enroll:
<span
class=
"register disabled"
>
${_("Enrollment is Closed")}
</span>
%elif
is_shopping_cart_enabled and course_price
:
%elif
can_add_course_to_cart
:
<
%
if
user
.
is_authenticated
()
:
reg_href =
"#"
...
...
@@ -310,7 +310,7 @@ from edxmako.shortcuts import marketing_link
##
<li
class=
"important-dates-item"
><i
class=
"icon fa fa-clock-o"
></i><p
class=
"important-dates-item-title"
>
${_('Course Length')}
</p><span
class=
"important-dates-item-text course-length"
>
${_('{number} weeks').format(number=15)}
</span></li>
%if course_price and (
is_shopping_cart_enabled
or is_cosmetic_price_enabled):
%if course_price and (
can_add_course_to_cart
or is_cosmetic_price_enabled):
<li
class=
"important-dates-item"
>
<i
class=
"icon fa fa-money"
></i>
<p
class=
"important-dates-item-title"
>
${_("Price")}
</p>
...
...
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