Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
course-discovery
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
course-discovery
Commits
e8847a17
Commit
e8847a17
authored
Jan 27, 2017
by
Awais
Committed by
Awais Qureshi
Jan 28, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding widget for price.
ECOM-6050
parent
e08954b2
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
4 deletions
+38
-4
course_discovery/apps/publisher/tests/test_views.py
+24
-0
course_discovery/static/js/publisher/publisher.js
+10
-0
course_discovery/templates/publisher/add_update_course_form.html
+4
-4
No files found.
course_discovery/apps/publisher/tests/test_views.py
View file @
e8847a17
...
...
@@ -1976,3 +1976,27 @@ class CourseRunEditViewTests(TestCase):
response
=
self
.
client
.
get
(
self
.
edit_page_url
)
self
.
assertContains
(
response
,
self
.
new_course_run
.
lms_course_id
)
def
test_price_hidden_without_seat
(
self
):
"""
Verify that price widget appears if the seat type not audit.
"""
self
.
user
.
groups
.
add
(
Group
.
objects
.
get
(
name
=
INTERNAL_USER_GROUP_NAME
))
response
=
self
.
client
.
get
(
self
.
edit_page_url
)
self
.
assertNotContains
(
response
,
'<div id="SeatPriceBlock" class="col col-6 hidden" style="display: block;">'
)
@ddt.data
(
Seat
.
PROFESSIONAL
,
Seat
.
VERIFIED
)
def
test_price_visible
(
self
,
seat_type
):
"""
Verify that price widget appear if the seat type other than audit.
"""
self
.
user
.
groups
.
add
(
Group
.
objects
.
get
(
name
=
INTERNAL_USER_GROUP_NAME
))
data
=
{
'full_description'
:
'This is testing description.'
,
'image'
:
''
}
updated_dict
=
self
.
_post_data
(
data
,
self
.
new_course
,
self
.
new_course_run
,
None
)
updated_dict
[
'type'
]
=
seat_type
updated_dict
[
'price'
]
=
10.00
self
.
client
.
post
(
self
.
edit_page_url
,
updated_dict
)
response
=
self
.
client
.
get
(
self
.
edit_page_url
)
self
.
assertContains
(
response
,
'<div id="SeatPriceBlock" class="col col-6'
)
course_discovery/static/js/publisher/publisher.js
View file @
e8847a17
...
...
@@ -172,3 +172,13 @@ function toggleXseries(checked) {
// If is-xseries checkbox value true from db then show the x-series block.
$
(
'#xseries_name_group'
).
toggle
(
checked
);
}
$
(
document
).
on
(
'change'
,
'#id_type'
,
function
(
e
)
{
var
$seatBlock
=
$
(
"#SeatPriceBlock"
),
selectedSeatType
=
this
.
value
;
if
(
selectedSeatType
===
'audit'
||
selectedSeatType
===
''
)
{
$seatBlock
.
hide
();
}
else
{
$seatBlock
.
show
();
}
});
course_discovery/templates/publisher/add_update_course_form.html
View file @
e8847a17
...
...
@@ -279,10 +279,10 @@
</label>
{{ seat_form.type}}
</div>
<div
class=
"col col-6
"
>
<label
class=
"field-label "
>
{{ seat_form.price.label_tag }}
</label>
{{ seat_form.price}}
</div>
<div
id=
"SeatPriceBlock"
class=
"col col-6 {% if not seat_form.price.value %}hidden{% endif %}
"
>
<label
class=
"field-label "
>
{{ seat_form.price.label_tag }}
</label>
{{ seat_form.price}}
</div>
</div>
{% if seat_form.price.errors %}
<div
class=
"field-message has-error"
>
...
...
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