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
3c385e69
Commit
3c385e69
authored
Jan 11, 2017
by
tasawernawaz
Committed by
Tasawer Nawaz
Jan 13, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed course listing page for pilot demo ECOM-6796
parent
cf869746
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
1 deletions
+33
-1
course_discovery/apps/publisher/tests/test_views.py
+19
-0
course_discovery/apps/publisher/views.py
+5
-0
course_discovery/templates/publisher/courses.html
+9
-1
No files found.
course_discovery/apps/publisher/tests/test_views.py
View file @
3c385e69
...
@@ -1527,6 +1527,25 @@ class CourseListViewTests(TestCase):
...
@@ -1527,6 +1527,25 @@ class CourseListViewTests(TestCase):
self
.
assertContains
(
response
,
'Add Course'
)
self
.
assertContains
(
response
,
'Add Course'
)
if
course_count
>
0
:
if
course_count
>
0
:
self
.
assertContains
(
response
,
self
.
course
.
title
)
self
.
assertContains
(
response
,
self
.
course
.
title
)
def
test_page_with_enable_waffle_switch
(
self
):
"""
Verify that edit button will not be shown if 'publisher_hide_features_for_pilot' activated.
"""
self
.
user
.
groups
.
add
(
Group
.
objects
.
get
(
name
=
INTERNAL_USER_GROUP_NAME
))
factories
.
CourseUserRoleFactory
(
course
=
self
.
course
,
user
=
self
.
user
)
toggle_switch
(
'publisher_hide_features_for_pilot'
,
True
)
response
=
self
.
client
.
get
(
self
.
courses_url
)
self
.
assertNotIn
(
response
.
content
.
decode
(
'UTF-8'
),
'Edit'
)
def
test_page_with_disable_waffle_switch
(
self
):
"""
Verify that edit button will be shown if 'publisher_hide_features_for_pilot' dectivated.
"""
self
.
user
.
groups
.
add
(
Group
.
objects
.
get
(
name
=
INTERNAL_USER_GROUP_NAME
))
factories
.
CourseUserRoleFactory
(
course
=
self
.
course
,
user
=
self
.
user
)
toggle_switch
(
'publisher_hide_features_for_pilot'
,
False
)
response
=
self
.
client
.
get
(
self
.
courses_url
)
self
.
assertContains
(
response
,
'Edit'
)
self
.
assertContains
(
response
,
'Edit'
)
...
...
course_discovery/apps/publisher/views.py
View file @
3c385e69
...
@@ -492,3 +492,8 @@ class CourseListView(mixins.LoginRequiredMixin, ListView):
...
@@ -492,3 +492,8 @@ class CourseListView(mixins.LoginRequiredMixin, ListView):
courses
=
Course
.
objects
.
filter
(
organizations__in
=
organizations
)
courses
=
Course
.
objects
.
filter
(
organizations__in
=
organizations
)
return
courses
return
courses
def
get_context_data
(
self
,
**
kwargs
):
context
=
super
(
CourseListView
,
self
)
.
get_context_data
(
**
kwargs
)
context
[
'publisher_hide_features_for_pilot'
]
=
waffle
.
switch_is_active
(
'publisher_hide_features_for_pilot'
)
return
context
course_discovery/templates/publisher/courses.html
View file @
3c385e69
...
@@ -33,7 +33,13 @@
...
@@ -33,7 +33,13 @@
{% for course in object_list %}
{% for course in object_list %}
<tr>
<tr>
<td>
<td>
<a
href=
"{% url 'publisher:publisher_course_detail' course.id %}"
>
{{ course.title }}
</a>
{% if publisher_hide_features_for_pilot %}
{{ course.title }}
{% else %}
<a
href=
"{% url 'publisher:publisher_course_detail' course.id %}"
>
{{ course.title }}
</a>
{% endif %}
</td>
</td>
<td>
<td>
{% if course.organizations.first %}{{ course.organizations.first.name }}{% endif %}
{% if course.organizations.first %}{{ course.organizations.first.name }}{% endif %}
...
@@ -44,11 +50,13 @@
...
@@ -44,11 +50,13 @@
<td>
<td>
{{ course.publisher_course_runs.count }}
{{ course.publisher_course_runs.count }}
</td>
</td>
{% if not publisher_hide_features_for_pilot %}
<td>
<td>
<a
href=
"{% url 'publisher:publisher_courses_edit' course.id %}"
class=
"btn btn-brand btn-small btn-course-edit"
>
<a
href=
"{% url 'publisher:publisher_courses_edit' course.id %}"
class=
"btn btn-brand btn-small btn-course-edit"
>
{% trans "Edit" %}
{% trans "Edit" %}
</a>
</a>
</td>
</td>
{% endif %}
</tr>
</tr>
{% endfor %}
{% endfor %}
</tbody>
</tbody>
...
...
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