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
7ecebff2
Commit
7ecebff2
authored
Feb 13, 2017
by
tasawernawaz
Committed by
Bill DeRusha
Feb 13, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feature switches added for history and workflow widgets ECOM-7143
parent
0ab5d420
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
120 additions
and
5 deletions
+120
-5
course_discovery/apps/publisher/migrations/0033_auto_20170213_0914.py
+29
-0
course_discovery/apps/publisher/migrations/0034_auto_20170213_0918.py
+29
-0
course_discovery/apps/publisher/tests/test_views.py
+54
-2
course_discovery/apps/publisher/views.py
+3
-1
course_discovery/templates/publisher/course_detail/_widgets.html
+4
-1
course_discovery/templates/publisher/course_run_detail.html
+1
-1
No files found.
course_discovery/apps/publisher/migrations/0033_auto_20170213_0914.py
0 → 100644
View file @
7ecebff2
# -*- coding: utf-8 -*-
# Generated by Django 1.9.12 on 2017-02-13 09:14
from
__future__
import
unicode_literals
from
django.db
import
migrations
def
create_switch
(
apps
,
schema_editor
):
"""Create the publisher_history_widget_feature switch if it does not already exist."""
Switch
=
apps
.
get_model
(
'waffle'
,
'Switch'
)
Switch
.
objects
.
get_or_create
(
name
=
'publisher_history_widget_feature'
,
defaults
=
{
'active'
:
False
})
def
delete_switch
(
apps
,
schema_editor
):
"""Delete the publisher_history_widget_feature switch."""
Switch
=
apps
.
get_model
(
'waffle'
,
'Switch'
)
Switch
.
objects
.
filter
(
name
=
'publisher_history_widget_feature'
)
.
delete
()
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'publisher'
,
'0032_create_switch_for_comments'
),
(
'waffle'
,
'0001_initial'
),
]
operations
=
[
migrations
.
RunPython
(
create_switch
,
delete_switch
),
]
course_discovery/apps/publisher/migrations/0034_auto_20170213_0918.py
0 → 100644
View file @
7ecebff2
# -*- coding: utf-8 -*-
# Generated by Django 1.9.12 on 2017-02-13 09:18
from
__future__
import
unicode_literals
from
django.db
import
migrations
def
create_switch
(
apps
,
schema_editor
):
"""Create the publisher_approval_widget_feature switch if it does not already exist."""
Switch
=
apps
.
get_model
(
'waffle'
,
'Switch'
)
Switch
.
objects
.
get_or_create
(
name
=
'publisher_approval_widget_feature'
,
defaults
=
{
'active'
:
False
})
def
delete_switch
(
apps
,
schema_editor
):
"""Delete the publisher_approval_widget_feature switch."""
Switch
=
apps
.
get_model
(
'waffle'
,
'Switch'
)
Switch
.
objects
.
filter
(
name
=
'publisher_approval_widget_feature'
)
.
delete
()
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'publisher'
,
'0033_auto_20170213_0914'
),
(
'waffle'
,
'0001_initial'
),
]
operations
=
[
migrations
.
RunPython
(
create_switch
,
delete_switch
),
]
course_discovery/apps/publisher/tests/test_views.py
View file @
7ecebff2
...
@@ -984,7 +984,6 @@ class CourseRunDetailTests(TestCase):
...
@@ -984,7 +984,6 @@ class CourseRunDetailTests(TestCase):
toggle_switch
(
'publisher_hide_features_for_pilot'
,
True
)
toggle_switch
(
'publisher_hide_features_for_pilot'
,
True
)
response
=
self
.
client
.
get
(
self
.
page_url
)
response
=
self
.
client
.
get
(
self
.
page_url
)
self
.
assertContains
(
response
,
'<div id="approval-widget" class="hidden">'
)
self
.
assertContains
(
response
,
'<div class="non-studio-fields hidden">'
)
self
.
assertContains
(
response
,
'<div class="non-studio-fields hidden">'
)
def
test_page_disable_waffle_switch_pilot
(
self
):
def
test_page_disable_waffle_switch_pilot
(
self
):
...
@@ -992,7 +991,6 @@ class CourseRunDetailTests(TestCase):
...
@@ -992,7 +991,6 @@ class CourseRunDetailTests(TestCase):
toggle_switch
(
'publisher_hide_features_for_pilot'
,
False
)
toggle_switch
(
'publisher_hide_features_for_pilot'
,
False
)
response
=
self
.
client
.
get
(
self
.
page_url
)
response
=
self
.
client
.
get
(
self
.
page_url
)
self
.
assertContains
(
response
,
'<div id="approval-widget" class="">'
)
self
.
assertContains
(
response
,
'<div class="non-studio-fields ">'
)
self
.
assertContains
(
response
,
'<div class="non-studio-fields ">'
)
def
test_comments_with_enable_switch
(
self
):
def
test_comments_with_enable_switch
(
self
):
...
@@ -1012,6 +1010,24 @@ class CourseRunDetailTests(TestCase):
...
@@ -1012,6 +1010,24 @@ class CourseRunDetailTests(TestCase):
response
=
self
.
client
.
get
(
self
.
page_url
)
response
=
self
.
client
.
get
(
self
.
page_url
)
self
.
assertContains
(
response
,
'<div id="comments-widget" class="comment-container hidden">'
)
self
.
assertContains
(
response
,
'<div id="comments-widget" class="comment-container hidden">'
)
def
test_approval_widget_with_enable_switch
(
self
):
""" Verify that user will see the history widget when
'publisher_approval_widget_feature' is enabled.
"""
self
.
user
.
groups
.
add
(
Group
.
objects
.
get
(
name
=
INTERNAL_USER_GROUP_NAME
))
toggle_switch
(
'publisher_approval_widget_feature'
,
True
)
response
=
self
.
client
.
get
(
self
.
page_url
)
self
.
assertContains
(
response
,
'<div id="approval-widget" class="approval-widget ">'
)
def
test_approval_widget_with_disable_switch
(
self
):
""" Verify that user will not see the history widget when
'publisher_approval_widget_feature' is disabled.
"""
self
.
user
.
groups
.
add
(
Group
.
objects
.
get
(
name
=
INTERNAL_USER_GROUP_NAME
))
toggle_switch
(
'publisher_approval_widget_feature'
,
False
)
response
=
self
.
client
.
get
(
self
.
page_url
)
self
.
assertContains
(
response
,
'<div id="approval-widget" class="approval-widget hidden">'
)
class
ChangeStateViewTests
(
TestCase
):
class
ChangeStateViewTests
(
TestCase
):
""" Tests for the `ChangeStateView`. """
""" Tests for the `ChangeStateView`. """
...
@@ -1587,6 +1603,42 @@ class CourseDetailViewTests(TestCase):
...
@@ -1587,6 +1603,42 @@ class CourseDetailViewTests(TestCase):
response
=
self
.
client
.
get
(
self
.
detail_page_url
)
response
=
self
.
client
.
get
(
self
.
detail_page_url
)
self
.
assertContains
(
response
,
'<div id="comments-widget" class="comment-container hidden">'
)
self
.
assertContains
(
response
,
'<div id="comments-widget" class="comment-container hidden">'
)
def
test_history_with_enable_switch
(
self
):
""" Verify that user will see the history widget when
'publisher_history_widget_feature' is enabled.
"""
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
)
self
.
assertContains
(
response
,
'<div class="history-widget ">'
)
def
test_history_with_disable_switch
(
self
):
""" Verify that user will not see the history widget when
'publisher_history_widget_feature' is disabled.
"""
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
)
self
.
assertContains
(
response
,
'<div class="history-widget hidden">'
)
def
test_approval_widget_with_enable_switch
(
self
):
""" Verify that user will see the history widget when
'publisher_approval_widget_feature' is enabled.
"""
self
.
user
.
groups
.
add
(
Group
.
objects
.
get
(
name
=
INTERNAL_USER_GROUP_NAME
))
toggle_switch
(
'publisher_approval_widget_feature'
,
True
)
response
=
self
.
client
.
get
(
self
.
detail_page_url
)
self
.
assertContains
(
response
,
'<div class="approval-widget ">'
)
def
test_approval_widget_with_disable_switch
(
self
):
""" Verify that user will not see the history widget when
'publisher_approval_widget_feature' is disabled.
"""
self
.
user
.
groups
.
add
(
Group
.
objects
.
get
(
name
=
INTERNAL_USER_GROUP_NAME
))
toggle_switch
(
'publisher_approval_widget_feature'
,
False
)
response
=
self
.
client
.
get
(
self
.
detail_page_url
)
self
.
assertContains
(
response
,
'<div class="approval-widget hidden">'
)
def
test_course_approval_widget
(
self
):
def
test_course_approval_widget
(
self
):
"""
"""
Verify that user can see approval widget on course detail page.
Verify that user can see approval widget on course detail page.
...
...
course_discovery/apps/publisher/views.py
View file @
7ecebff2
...
@@ -170,6 +170,7 @@ class CourseRunDetailView(mixins.LoginRequiredMixin, mixins.PublisherPermissionM
...
@@ -170,6 +170,7 @@ class CourseRunDetailView(mixins.LoginRequiredMixin, mixins.PublisherPermissionM
context
[
'can_view_all_tabs'
]
=
mixins
.
check_roles_access
(
self
.
request
.
user
)
context
[
'can_view_all_tabs'
]
=
mixins
.
check_roles_access
(
self
.
request
.
user
)
context
[
'publisher_hide_features_for_pilot'
]
=
waffle
.
switch_is_active
(
'publisher_hide_features_for_pilot'
)
context
[
'publisher_hide_features_for_pilot'
]
=
waffle
.
switch_is_active
(
'publisher_hide_features_for_pilot'
)
context
[
'publisher_comment_widget_feature'
]
=
waffle
.
switch_is_active
(
'publisher_comment_widget_feature'
)
context
[
'publisher_comment_widget_feature'
]
=
waffle
.
switch_is_active
(
'publisher_comment_widget_feature'
)
context
[
'publisher_approval_widget_feature'
]
=
waffle
.
switch_is_active
(
'publisher_approval_widget_feature'
)
return
context
return
context
...
@@ -379,7 +380,8 @@ class CourseDetailView(mixins.LoginRequiredMixin, mixins.PublisherPermissionMixi
...
@@ -379,7 +380,8 @@ class CourseDetailView(mixins.LoginRequiredMixin, mixins.PublisherPermissionMixi
context
[
'post_back_url'
]
=
reverse
(
'publisher:publisher_course_detail'
,
kwargs
=
{
'pk'
:
self
.
object
.
id
})
context
[
'post_back_url'
]
=
reverse
(
'publisher:publisher_course_detail'
,
kwargs
=
{
'pk'
:
self
.
object
.
id
})
context
[
'publisher_hide_features_for_pilot'
]
=
waffle
.
switch_is_active
(
'publisher_hide_features_for_pilot'
)
context
[
'publisher_hide_features_for_pilot'
]
=
waffle
.
switch_is_active
(
'publisher_hide_features_for_pilot'
)
context
[
'publisher_comment_widget_feature'
]
=
waffle
.
switch_is_active
(
'publisher_comment_widget_feature'
)
context
[
'publisher_comment_widget_feature'
]
=
waffle
.
switch_is_active
(
'publisher_comment_widget_feature'
)
context
[
'publisher_history_widget_feature'
]
=
waffle
.
switch_is_active
(
'publisher_history_widget_feature'
)
context
[
'publisher_approval_widget_feature'
]
=
waffle
.
switch_is_active
(
'publisher_approval_widget_feature'
)
context
[
'role_widgets'
]
=
self
.
get_role_widgets_data
()
context
[
'role_widgets'
]
=
self
.
get_role_widgets_data
()
return
context
return
context
...
...
course_discovery/templates/publisher/course_detail/_widgets.html
View file @
7ecebff2
...
@@ -39,7 +39,10 @@
...
@@ -39,7 +39,10 @@
</div>
</div>
{% endfor %}
{% endfor %}
</div>
</div>
<div
class=
"history-widget {% if not publisher_history_widget_feature %}hidden{% endif %}"
>
{% include 'publisher/_history_widget.html' %}
{% include 'publisher/_history_widget.html' %}
</div>
<div
class=
"approval-widget {% if not publisher_approval_widget_feature %}hidden{% endif %}"
>
{% include 'publisher/course_detail/_approval_widget.html' %}
{% include 'publisher/course_detail/_approval_widget.html' %}
</div>
</div>
</div>
course_discovery/templates/publisher/course_run_detail.html
View file @
7ecebff2
...
@@ -67,7 +67,7 @@
...
@@ -67,7 +67,7 @@
</main>
</main>
<aside
id=
"right-panel"
class=
"layout-col layout-col-a layout-col-a-custom"
>
<aside
id=
"right-panel"
class=
"layout-col layout-col-a layout-col-a-custom"
>
<div
id=
"approval-widget"
class=
"
{% if publisher_hide_features_for_pilot
%}hidden{% endif %}"
>
<div
id=
"approval-widget"
class=
"
approval-widget {% if not publisher_approval_widget_feature
%}hidden{% endif %}"
>
{% include 'publisher/course_run_detail/_approval_widget.html' %}
{% include 'publisher/course_run_detail/_approval_widget.html' %}
</div>
</div>
<div
id=
"comments-widget"
class=
"comment-container {% if not publisher_comment_widget_feature %}hidden{% endif %}"
>
<div
id=
"comments-widget"
class=
"comment-container {% if not publisher_comment_widget_feature %}hidden{% endif %}"
>
...
...
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