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
d572f8b8
Commit
d572f8b8
authored
Apr 06, 2017
by
Waheed Ahmed
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added filters on dashboard.
ECOM-7649
parent
d6d27cbb
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
147 additions
and
11 deletions
+147
-11
course_discovery/apps/publisher/tests/test_views.py
+29
-0
course_discovery/apps/publisher/views.py
+8
-1
course_discovery/conf/locale/en/LC_MESSAGES/django.mo
+0
-0
course_discovery/conf/locale/en/LC_MESSAGES/django.po
+15
-2
course_discovery/conf/locale/en/LC_MESSAGES/djangojs.mo
+0
-0
course_discovery/conf/locale/en/LC_MESSAGES/djangojs.po
+2
-2
course_discovery/conf/locale/eo/LC_MESSAGES/django.mo
+0
-0
course_discovery/conf/locale/eo/LC_MESSAGES/django.po
+15
-2
course_discovery/conf/locale/eo/LC_MESSAGES/djangojs.mo
+0
-0
course_discovery/conf/locale/eo/LC_MESSAGES/djangojs.po
+2
-2
course_discovery/static/js/publisher/views/dashboard.js
+24
-1
course_discovery/static/sass/publisher/buttons-links.scss
+37
-0
course_discovery/static/sass/publisher/dashboard.scss
+3
-1
course_discovery/templates/publisher/dashboard/_in_progress.html
+12
-0
No files found.
course_discovery/apps/publisher/tests/test_views.py
View file @
d572f8b8
...
...
@@ -1415,6 +1415,35 @@ class DashboardTests(TestCase):
site
=
Site
.
objects
.
first
()
self
.
assertEqual
(
response
.
context
[
'site_name'
],
site
.
name
)
def
test_filters
(
self
):
"""
Verify that filters available on dashboard.
"""
course_team_user
=
UserFactory
()
course_run
=
self
.
_create_course_assign_role
(
CourseRunStateChoices
.
Review
,
self
.
user1
,
PublisherUserRole
.
ProjectCoordinator
)
factories
.
CourseUserRoleFactory
(
course
=
course_run
.
course
,
role
=
PublisherUserRole
.
CourseTeam
,
user
=
course_team_user
)
course_run
.
course_run_state
.
owner_role
=
PublisherUserRole
.
CourseTeam
course_run
.
course_run_state
.
save
()
response
=
self
.
client
.
get
(
self
.
page_url
)
site
=
Site
.
objects
.
first
()
self
.
_assert_filter_counts
(
response
,
'All'
,
3
)
self
.
_assert_filter_counts
(
response
,
'With Course Team'
,
2
)
self
.
_assert_filter_counts
(
response
,
'With {site_name}'
.
format
(
site_name
=
site
.
name
),
1
)
def
_assert_filter_counts
(
self
,
response
,
expected_label
,
count
):
"""
Assert label and course run count for filters.
"""
self
.
assertContains
(
response
,
expected_label
,
count
=
1
)
expected_count
=
'<span class="filter-count">{count}</span>'
.
format
(
count
=
count
)
self
.
assertContains
(
response
,
expected_count
,
count
=
1
)
class
ToggleEmailNotificationTests
(
TestCase
):
""" Tests for `ToggleEmailNotification` view. """
...
...
course_discovery/apps/publisher/views.py
View file @
d572f8b8
...
...
@@ -118,7 +118,14 @@ class Dashboard(mixins.LoginRequiredMixin, ListView):
context
[
'is_project_coordinator'
]
=
is_project_coordinator_user
(
self
.
request
.
user
)
site
=
Site
.
objects
.
first
()
context
[
'site_name'
]
=
'edX'
if
'edx'
in
site
.
name
else
site
.
name
context
[
'site_name'
]
=
'edX'
if
'edx'
in
site
.
name
.
lower
()
else
site
.
name
context
[
'course_team_count'
]
=
in_progress_course_runs
.
filter
(
course_run_state__owner_role
=
PublisherUserRole
.
CourseTeam
)
.
count
()
context
[
'internal_user_count'
]
=
in_progress_course_runs
.
exclude
(
course_run_state__owner_role
=
PublisherUserRole
.
CourseTeam
)
.
count
()
return
context
...
...
course_discovery/conf/locale/en/LC_MESSAGES/django.mo
View file @
d572f8b8
No preview for this file type
course_discovery/conf/locale/en/LC_MESSAGES/django.po
View file @
d572f8b8
...
...
@@ -7,14 +7,14 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-04-
08 22:45
+0500\n"
"POT-Creation-Date: 2017-04-
10 13:14
+0500\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: \n"
#: apps/api/filters.py
#, python-brace-format
...
...
@@ -2508,6 +2508,7 @@ msgid ""
msgstr ""
#: templates/publisher/course_run_detail/course_run_detail.html
#: templates/publisher/dashboard/_in_progress.html
msgid "All"
msgstr ""
...
...
@@ -2592,6 +2593,18 @@ msgid "There are no in progress course runs."
msgstr ""
#: templates/publisher/dashboard/_in_progress.html
msgid "Filter by"
msgstr ""
#: templates/publisher/dashboard/_in_progress.html
msgid "With Course Team"
msgstr ""
#: templates/publisher/dashboard/_in_progress.html
msgid "With"
msgstr ""
#: templates/publisher/dashboard/_in_progress.html
#: templates/publisher/dashboard/_published.html
msgid "Start"
msgstr ""
...
...
course_discovery/conf/locale/en/LC_MESSAGES/djangojs.mo
View file @
d572f8b8
No preview for this file type
course_discovery/conf/locale/en/LC_MESSAGES/djangojs.po
View file @
d572f8b8
...
...
@@ -7,14 +7,14 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-04-
08 22:45
+0500\n"
"POT-Creation-Date: 2017-04-
10 13:14
+0500\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: \n"
#: static/js/catalogs-change-form.js
msgid "Preview"
...
...
course_discovery/conf/locale/eo/LC_MESSAGES/django.mo
View file @
d572f8b8
No preview for this file type
course_discovery/conf/locale/eo/LC_MESSAGES/django.po
View file @
d572f8b8
...
...
@@ -7,14 +7,14 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-04-
08 22:45
+0500\n"
"POT-Creation-Date: 2017-04-
10 13:14
+0500\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: \n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: apps/api/filters.py
...
...
@@ -2948,6 +2948,7 @@ msgstr ""
"Ⱡ'σяєм ιρѕυм ∂σłσя ѕιт αмєт, ¢σηѕє¢тєтυя α#"
#: templates/publisher/course_run_detail/course_run_detail.html
#: templates/publisher/dashboard/_in_progress.html
msgid "All"
msgstr "Àll Ⱡ'σяєм#"
...
...
@@ -3051,6 +3052,18 @@ msgstr ""
"¢σηѕє¢тєтυ#"
#: templates/publisher/dashboard/_in_progress.html
msgid "Filter by"
msgstr "Fïltér ßý Ⱡ'σяєм ιρѕυм ∂σł#"
#: templates/publisher/dashboard/_in_progress.html
msgid "With Course Team"
msgstr "Wïth Çöürsé Téäm Ⱡ'σяєм ιρѕυм ∂σłσя ѕιт αм#"
#: templates/publisher/dashboard/_in_progress.html
msgid "With"
msgstr "Wïth Ⱡ'σяєм ι#"
#: templates/publisher/dashboard/_in_progress.html
#: templates/publisher/dashboard/_published.html
msgid "Start"
msgstr "Stärt Ⱡ'σяєм ιρѕ#"
...
...
course_discovery/conf/locale/eo/LC_MESSAGES/djangojs.mo
View file @
d572f8b8
No preview for this file type
course_discovery/conf/locale/eo/LC_MESSAGES/djangojs.po
View file @
d572f8b8
...
...
@@ -7,14 +7,14 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-04-
08 22:45
+0500\n"
"POT-Creation-Date: 2017-04-
10 13:14
+0500\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: \n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: static/js/catalogs-change-form.js
...
...
course_discovery/static/js/publisher/views/dashboard.js
View file @
d572f8b8
...
...
@@ -62,8 +62,31 @@ $(document).ready(function() {
"oLanguage"
:
{
"sEmptyTable"
:
gettext
(
"No course run previews are currently available."
)
}
});
$
(
'.data-table-in-progress'
).
DataTable
({
var
inProgressTable
=
$
(
'.data-table-in-progress'
).
DataTable
({
"autoWidth"
:
false
});
$
(
'.btn-filter'
).
click
(
function
(
e
)
{
var
searchValue
=
'In Review|In Draft'
,
currentFilterColumn
=
$
(
this
).
data
(
'filter-column'
),
oldFilterColumn
=
$
(
'.btn-filter.active'
).
data
(
'filter-column'
);
e
.
preventDefault
();
$
(
'.btn-filter'
).
removeClass
(
'active'
);
$
(
this
).
addClass
(
'active'
);
if
(
currentFilterColumn
==
-
1
)
{
applyCustomFilter
(
inProgressTable
,
oldFilterColumn
,
''
);
}
else
{
if
(
oldFilterColumn
!=
-
1
)
{
// Clear previous filter if applied otherwise search will return no record.
applyCustomFilter
(
inProgressTable
,
oldFilterColumn
,
''
);
}
applyCustomFilter
(
inProgressTable
,
currentFilterColumn
,
searchValue
);
}
});
});
function
applyCustomFilter
(
dataTable
,
columnIndex
,
value
)
{
dataTable
.
columns
(
columnIndex
).
search
(
value
,
true
,
false
).
draw
();
}
course_discovery/static/sass/publisher/buttons-links.scss
View file @
d572f8b8
...
...
@@ -60,3 +60,40 @@
border-radius
:
5px
;
margin-top
:
10px
;
}
$btn-filter-active-color
:
rgba
(
54
,
54
,
54
,
1
);
$btn-filter-color
:
rgba
(
228
,
228
,
228
,
1
);
.btn-filter
{
@include
margin-right
(
5px
);
border-color
:
$btn-filter-color
;
background
:
$btn-filter-color
;
padding-bottom
:
5px
;
padding-top
:
5px
;
color
:
black
;
.filter-count
{
@include
padding
(
1px
,
6px
,
1px
,
6px
);
@include
margin-left
(
5px
);
background
:
white
;
border-radius
:
4px
;
color
:
black
;
}
&
:hover
,
&
.is-hovered
,
&
:focus
,
&
.is-focused
{
border-color
:
$btn-filter-color
;
background
:
$btn-filter-color
;
color
:
black
;
}
&
.active
,
&
.is-pressed
,
&
.is-active
{
border-color
:
$btn-filter-active-color
;
background
:
$btn-filter-active-color
;
color
:
white
;
}
}
course_discovery/static/sass/publisher/dashboard.scss
View file @
d572f8b8
...
...
@@ -14,5 +14,7 @@
margin-bottom
:
20px
;
}
.filters
{
margin-bottom
:
10px
;
}
}
course_discovery/templates/publisher/dashboard/_in_progress.html
View file @
d572f8b8
...
...
@@ -3,6 +3,18 @@
<p>
{% trans "There are no in progress course runs." %}
</p>
{% else %}
<table
class=
"data-table-in-progress display"
cellspacing=
"0"
width=
"100%"
>
<div
class=
"filters"
>
<strong>
{% trans "Filter by" %}:
</strong>
<button
type=
"button"
class=
"btn-neutral btn-small btn-filter active"
data-filter-column=
"-1"
>
{% trans "All" %}
<span
class=
"filter-count"
>
{{ in_progress_count }}
</span>
</button>
<button
type=
"button"
class=
"btn-neutral btn-small btn-filter"
data-filter-column=
"5"
>
{% trans "With Course Team" %}
<span
class=
"filter-count"
>
{{ course_team_count }}
</span>
</button>
<button
type=
"button"
class=
"btn-neutral btn-small btn-filter"
data-filter-column=
"6"
>
{% trans "With" %} {{ site_name }}
<span
class=
"filter-count"
>
{{ internal_user_count }}
</span>
</button>
</div>
<thead>
<tr>
<th
role=
"button"
>
...
...
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