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
8730da0e
Commit
8730da0e
authored
Mar 21, 2017
by
Waheed Ahmed
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't show history widget for single object.
ECOM-7501
parent
2e556a19
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
47 additions
and
16 deletions
+47
-16
course_discovery/apps/publisher/tests/test_views.py
+33
-8
course_discovery/static/sass/publisher/publisher.scss
+4
-0
course_discovery/templates/publisher/_history_widget.html
+2
-5
course_discovery/templates/publisher/course_detail/_widgets.html
+8
-3
No files found.
course_discovery/apps/publisher/tests/test_views.py
View file @
8730da0e
...
...
@@ -1584,14 +1584,6 @@ class CourseDetailViewTests(TestCase):
self
.
assertContains
(
response
,
'STUDIO URL -'
)
self
.
assertContains
(
response
,
'Not yet created'
)
self
.
assertContains
(
response
,
reverse
(
'publisher:publisher_course_run_detail'
,
kwargs
=
{
'pk'
:
course_run
.
id
}))
self
.
assertContains
(
response
,
'REVISION HISTORY'
)
revision_url
=
reverse
(
'publisher:publisher_course_revision'
,
args
=
[
self
.
course
.
id
,
self
.
course
.
history
.
first
()
.
history_id
]
)
self
.
assertContains
(
response
,
'<option value="{revision_url}">Latest version</option>'
.
format
(
revision_url
=
revision_url
)
)
def
test_detail_page_data
(
self
):
"""
...
...
@@ -1657,6 +1649,9 @@ class CourseDetailViewTests(TestCase):
""" Verify that user will see the history widget when
'publisher_history_widget_feature' is enabled.
"""
# Update course to create multiple history objects.
self
.
course
.
title
=
'Updated Test Title'
self
.
course
.
save
()
self
.
user
.
groups
.
add
(
Group
.
objects
.
get
(
name
=
INTERNAL_USER_GROUP_NAME
))
toggle_switch
(
'publisher_history_widget_feature'
,
True
)
response
=
self
.
client
.
get
(
self
.
detail_page_url
)
...
...
@@ -1666,6 +1661,9 @@ class CourseDetailViewTests(TestCase):
""" Verify that user will not see the history widget when
'publisher_history_widget_feature' is disabled.
"""
# Update course to create multiple history objects.
self
.
course
.
title
=
'Updated Test Title'
self
.
course
.
save
()
self
.
user
.
groups
.
add
(
Group
.
objects
.
get
(
name
=
INTERNAL_USER_GROUP_NAME
))
toggle_switch
(
'publisher_history_widget_feature'
,
False
)
response
=
self
.
client
.
get
(
self
.
detail_page_url
)
...
...
@@ -1823,6 +1821,33 @@ class CourseDetailViewTests(TestCase):
self
.
assertContains
(
response
,
'<strong>MARKETING</strong>'
)
self
.
assertNotContains
(
response
,
'<strong>PUBLISHER</strong>'
)
def
test_detail_page_with_history_widget
(
self
):
"""
Test that user can see history widget on detail page if history exists.
"""
self
.
user
.
groups
.
add
(
self
.
organization_extension
.
group
)
assign_perm
(
OrganizationExtension
.
VIEW_COURSE
,
self
.
organization_extension
.
group
,
self
.
organization_extension
)
response
=
self
.
client
.
get
(
self
.
detail_page_url
)
# Verify that user cannot see history widget if there is only one history object.
self
.
assertEqual
(
self
.
course
.
history
.
count
(),
1
)
self
.
assertNotContains
(
response
,
'REVISION HISTORY'
)
# Update course to create multiple history objects.
self
.
course
.
title
=
'Updated Test Title'
self
.
course
.
save
()
response
=
self
.
client
.
get
(
self
.
detail_page_url
)
self
.
assertContains
(
response
,
'REVISION HISTORY'
)
revision_url
=
reverse
(
'publisher:publisher_course_revision'
,
args
=
[
self
.
course
.
id
,
self
.
course
.
history
.
first
()
.
history_id
]
)
self
.
assertContains
(
response
,
'<option value="{revision_url}">Latest version</option>'
.
format
(
revision_url
=
revision_url
)
)
class
CourseEditViewTests
(
TestCase
):
""" Tests for the course edit view. """
...
...
course_discovery/static/sass/publisher/publisher.scss
View file @
8730da0e
...
...
@@ -630,3 +630,7 @@
padding-bottom
:
20px
;
font-size
:
14px
;
}
#id_select_revisions
{
max-width
:
50%
;
}
course_discovery/templates/publisher/_history_widget.html
View file @
8730da0e
{% load i18n %}
<div
class=
"margin-top20"
>
<h5
class=
"hd-5 emphasized course-runs-heading"
>
{% trans "REVISION HISTORY" %}
</h5>
<br>
{% with object.history.all as history_list %}
<h5
class=
"hd-5 emphasized course-runs-heading"
>
{% trans "REVISION HISTORY" %}
</h5>
<br>
<select
id=
"id_select_revisions"
>
{% for history in history_list %}
{% if forloop.first %}
...
...
@@ -17,6 +16,4 @@
{% endfor %}
</select>
<a
id=
"id_open_revision"
class=
"btn btn-brand btn-small btn-courserun-add"
href=
"{% url 'publisher:publisher_course_revision' course.id history_list.first.history_id %}"
target=
"_blank"
>
{% trans "Open Selected Version" %}
</a>
{% endwith %}
</div>
course_discovery/templates/publisher/course_detail/_widgets.html
View file @
8730da0e
...
...
@@ -40,9 +40,14 @@
</div>
{% endfor %}
</div>
<div
class=
"history-widget {% if not publisher_history_widget_feature %}hidden{% endif %}"
>
{% include 'publisher/_history_widget.html' %}
</div>
{% with object.history.all as history_list %}
{% if history_list.count > 1 %}
<div
class=
"history-widget {% if not publisher_history_widget_feature %}hidden{% endif %}"
>
{% include 'publisher/_history_widget.html' %}
</div>
{% endif %}
{% endwith %}
<div
class=
"approval-widget {% if not publisher_approval_widget_feature %}hidden{% endif %}"
>
{% include 'publisher/_approval_widget.html' %}
</div>
...
...
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