Commit 873d7543 by Awais

In progress course run tabs.

ECOM-6038
parent f0547b5a
......@@ -1089,6 +1089,21 @@ class DashboardTests(TestCase):
self.assertEqual(len(response.context['preview_course_runs']), 0)
self.assertContains(response, 'There are no course runs marked for preview.')
def test_without_in_progress_course_runs(self):
""" Verify in progress tabs shows a message if no course run available. """
response = self.assert_dashboard_response()
self.assertEqual(len(response.context['in_progress_course_runs']), 0)
self.assertContains(response, 'There are no in progress course runs.')
def test_with_in_progress_course_runs(self):
""" Verify that in progress tabs loads the course runs list. """
self.course_run_2.change_state(target=State.NEEDS_FINAL_APPROVAL)
self.course_run_2.save()
response = self.assert_dashboard_response()
self.assertEqual(len(response.context['in_progress_course_runs']), 1)
self.assertContains(response, self.table_class.format(id='in-progress'))
def assert_dashboard_response(self):
""" Dry method to assert the response."""
response = self.client.get(self.page_url)
......
......@@ -153,3 +153,14 @@ class CourseRunWrapperTests(TestCase):
self.wrapped_course_run.keywords,
self.course.keywords_data
)
@ddt.data(True, False)
def test_is_seo_reviews(self, is_seo_review):
""" Verify that the wrapper return the is_seo_review. """
self.course.is_seo_review = is_seo_review
self.course.save()
self.assertEqual(
self.wrapped_course_run.is_seo_review,
self.course.is_seo_review
)
......@@ -49,11 +49,14 @@ class Dashboard(mixins.LoginRequiredMixin, ListView):
def get_context_data(self, **kwargs):
context = super(Dashboard, self).get_context_data(**kwargs)
course_runs = context.get('object_list')
published_course_runs = course_runs.filter(
state__name=State.PUBLISHED,
state__modified__gt=datetime.today() - timedelta(days=self.default_published_days)
).select_related('state').all().order_by('-state__modified')
).select_related('state').order_by('-state__modified')
unpublished_course_runs = course_runs.exclude(state__name=State.PUBLISHED)
studio_request_courses = unpublished_course_runs.filter(lms_course_id__isnull=True)
context['studio_request_courses'] = [CourseRunWrapper(course_run) for course_run in studio_request_courses]
......@@ -61,10 +64,15 @@ class Dashboard(mixins.LoginRequiredMixin, ListView):
context['published_course_runs'] = [CourseRunWrapper(course_run) for course_run in published_course_runs]
context['default_published_days'] = self.default_published_days
preview_course_runs = course_runs.filter(
state__name=State.NEEDS_FINAL_APPROVAL, preview_url__isnull=False
in_progress_course_runs = course_runs.filter(
state__name=State.NEEDS_FINAL_APPROVAL
).select_related('state').order_by('-state__modified')
preview_course_runs = in_progress_course_runs.filter(
preview_url__isnull=False
).order_by('-state__modified')
context['in_progress_course_runs'] = [CourseRunWrapper(course_run) for course_run in in_progress_course_runs]
context['preview_course_runs'] = [CourseRunWrapper(course_run) for course_run in preview_course_runs]
return context
......
......@@ -186,3 +186,7 @@ class CourseRunWrapper(BaseWrapper):
@property
def keywords(self):
return self.wrapped_obj.course.keywords_data
@property
def is_seo_review(self):
return self.wrapped_obj.course.is_seo_review
......@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-11-18 17:35+0000\n"
"POT-Creation-Date: 2016-11-23 14:30+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"
......@@ -17,6 +17,7 @@ msgstr ""
"Language: \n"
#: apps/api/filters.py
#, python-brace-format
msgid "No user with the username [{username}] exists."
msgstr ""
......@@ -110,6 +111,7 @@ msgstr ""
#. Translators: 'period_choices' is a list of possible values, like ('second',
#. 'minute', 'hour')
#: apps/core/forms.py
#, python-brace-format
msgid "period must be one of {period_choices}."
msgstr ""
......@@ -408,6 +410,7 @@ msgid "JSON string containing an elasticsearch function score config."
msgstr ""
#: apps/publisher/emails.py
#, python-brace-format
msgid "Course Run {title}-{pacing_type}-{start} state has been changed."
msgstr ""
......@@ -565,10 +568,12 @@ msgid "Please fill all required field."
msgstr ""
#: apps/publisher/views.py
#, python-brace-format
msgid "Course run created successfully for course \"{course_title}\"."
msgstr ""
#: apps/publisher/views.py
#, python-brace-format
msgid "There was an error saving course run, {error}"
msgstr ""
......@@ -577,6 +582,7 @@ msgid "Please fill all required fields."
msgstr ""
#: apps/publisher/views.py
#, python-brace-format
msgid "Content moved to `{state}` successfully."
msgstr ""
......@@ -601,10 +607,12 @@ msgid "Publish"
msgstr ""
#: apps/publisher_comments/emails.py
#, python-brace-format
msgid "New comment added in course run: {title}-{pacing_type}-{start}"
msgstr ""
#: apps/publisher_comments/emails.py
#, python-brace-format
msgid "New comment added in Course: {title}"
msgstr ""
......@@ -1539,6 +1547,7 @@ msgid "No Seats Available."
msgstr ""
#: templates/publisher/course_run_detail/_studio.html
#: templates/publisher/dashboard/_in_progress.html
#: templates/publisher/dashboard/_preview_ready.html
#: templates/publisher/dashboard/_published.html
#: templates/publisher/dashboard/_studio_requests.html
......@@ -1631,8 +1640,31 @@ msgstr ""
msgid "PUBLISHED COURSE RUNS"
msgstr ""
#: templates/publisher/dashboard.html
msgid "In Progress"
#: templates/publisher/dashboard/_in_progress.html
msgid "There are no in progress course runs."
msgstr ""
#: templates/publisher/dashboard/_in_progress.html
msgid "Institution"
msgstr ""
#: templates/publisher/dashboard/_in_progress.html
#: templates/publisher/dashboard/_published.html
msgid "Start"
msgstr ""
#: templates/publisher/dashboard/_in_progress.html
#: templates/publisher/dashboard/_published.html
msgid "End"
msgstr ""
#: templates/publisher/dashboard/_in_progress.html
#: templates/publisher/dashboard/_published.html
msgid "Target Content"
msgstr ""
#: templates/publisher/dashboard/_in_progress.html
msgid "SEO Review"
msgstr ""
#: templates/publisher/dashboard/_preview_ready.html
......@@ -1666,21 +1698,9 @@ msgid ""
msgstr ""
#: templates/publisher/dashboard/_published.html
msgid "Start"
msgstr ""
#: templates/publisher/dashboard/_published.html
msgid "End"
msgstr ""
#: templates/publisher/dashboard/_published.html
msgid "Published Date"
msgstr ""
#: templates/publisher/dashboard/_published.html
msgid "Target Content"
msgstr ""
#: templates/publisher/dashboard/_studio_requests.html
msgid ""
"The list below are the courses that need a studio instance to start "
......
......@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-11-18 17:35+0000\n"
"POT-Creation-Date: 2016-11-23 14:30+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"
......
......@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-11-18 17:35+0000\n"
"POT-Creation-Date: 2016-11-23 14:30+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"
......@@ -18,6 +18,7 @@ msgstr ""
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: apps/api/filters.py
#, python-brace-format
msgid "No user with the username [{username}] exists."
msgstr ""
"Nö üsér wïth thé üsérnämé [{username}] éxïsts. Ⱡ'σяєм ιρѕυм ∂σłσя ѕιт αмєт, "
......@@ -138,6 +139,7 @@ msgstr ""
#. Translators: 'period_choices' is a list of possible values, like ('second',
#. 'minute', 'hour')
#: apps/core/forms.py
#, python-brace-format
msgid "period must be one of {period_choices}."
msgstr ""
"pérïöd müst ßé öné öf {period_choices}. Ⱡ'σяєм ιρѕυм ∂σłσя ѕιт αмєт, ¢σηѕ#"
......@@ -512,6 +514,7 @@ msgstr ""
"∂σłσя ѕιт αмєт, ¢σηѕє¢тєтυя α#"
#: apps/publisher/emails.py
#, python-brace-format
msgid "Course Run {title}-{pacing_type}-{start} state has been changed."
msgstr ""
"Çöürsé Rün {title}-{pacing_type}-{start} stäté häs ßéén çhängéd. Ⱡ'σяєм "
......@@ -685,12 +688,14 @@ msgid "Please fill all required field."
msgstr "Pléäsé fïll äll réqüïréd fïéld. Ⱡ'σяєм ιρѕυм ∂σłσя ѕιт αмєт, ¢σηѕє¢т#"
#: apps/publisher/views.py
#, python-brace-format
msgid "Course run created successfully for course \"{course_title}\"."
msgstr ""
"Çöürsé rün çréätéd süççéssfüllý för çöürsé \"{course_title}\". Ⱡ'σяєм ιρѕυм "
"∂σłσя ѕιт αмєт, ¢σηѕє¢тєтυя α#"
#: apps/publisher/views.py
#, python-brace-format
msgid "There was an error saving course run, {error}"
msgstr ""
"Théré wäs än érrör sävïng çöürsé rün, {error} Ⱡ'σяєм ιρѕυм ∂σłσя ѕιт αмєт, "
......@@ -702,6 +707,7 @@ msgstr ""
"Pléäsé fïll äll réqüïréd fïélds. Ⱡ'σяєм ιρѕυм ∂σłσя ѕιт αмєт, ¢σηѕє¢тє#"
#: apps/publisher/views.py
#, python-brace-format
msgid "Content moved to `{state}` successfully."
msgstr ""
"Çöntént mövéd tö `{state}` süççéssfüllý. Ⱡ'σяєм ιρѕυм ∂σłσя ѕιт αмєт, "
......@@ -730,12 +736,14 @@ msgid "Publish"
msgstr "Püßlïsh Ⱡ'σяєм ιρѕυм #"
#: apps/publisher_comments/emails.py
#, python-brace-format
msgid "New comment added in course run: {title}-{pacing_type}-{start}"
msgstr ""
"Néw çömmént äddéd ïn çöürsé rün: {title}-{pacing_type}-{start} Ⱡ'σяєм ιρѕυм "
"∂σłσя ѕιт αмєт, ¢σηѕє¢тєтυя #"
#: apps/publisher_comments/emails.py
#, python-brace-format
msgid "New comment added in Course: {title}"
msgstr ""
"Néw çömmént äddéd ïn Çöürsé: {title} Ⱡ'σяєм ιρѕυм ∂σłσя ѕιт αмєт, ¢σηѕє¢тє#"
......@@ -1811,6 +1819,7 @@ msgid "No Seats Available."
msgstr "Nö Séäts Àväïläßlé. Ⱡ'σяєм ιρѕυм ∂σłσя ѕιт αмєт,#"
#: templates/publisher/course_run_detail/_studio.html
#: templates/publisher/dashboard/_in_progress.html
#: templates/publisher/dashboard/_preview_ready.html
#: templates/publisher/dashboard/_published.html
#: templates/publisher/dashboard/_studio_requests.html
......@@ -1910,9 +1919,34 @@ msgstr "STÛDÌÖ RÉQÛÉST Ⱡ'σяєм ιρѕυм ∂σłσя ѕιт#"
msgid "PUBLISHED COURSE RUNS"
msgstr "PÛBLÌSHÉD ÇÖÛRSÉ RÛNS Ⱡ'σяєм ιρѕυм ∂σłσя ѕιт αмєт, #"
#: templates/publisher/dashboard.html
msgid "In Progress"
msgstr "Ìn Prögréss Ⱡ'σяєм ιρѕυм ∂σłσя #"
#: templates/publisher/dashboard/_in_progress.html
msgid "There are no in progress course runs."
msgstr ""
"Théré äré nö ïn prögréss çöürsé rüns. Ⱡ'σяєм ιρѕυм ∂σłσя ѕιт αмєт, "
"¢σηѕє¢тєтυ#"
#: templates/publisher/dashboard/_in_progress.html
msgid "Institution"
msgstr "Ìnstïtütïön Ⱡ'σяєм ιρѕυм ∂σłσя #"
#: templates/publisher/dashboard/_in_progress.html
#: templates/publisher/dashboard/_published.html
msgid "Start"
msgstr "Stärt Ⱡ'σяєм ιρѕ#"
#: templates/publisher/dashboard/_in_progress.html
#: templates/publisher/dashboard/_published.html
msgid "End"
msgstr "Énd Ⱡ'σяєм#"
#: templates/publisher/dashboard/_in_progress.html
#: templates/publisher/dashboard/_published.html
msgid "Target Content"
msgstr "Tärgét Çöntént Ⱡ'σяєм ιρѕυм ∂σłσя ѕιт#"
#: templates/publisher/dashboard/_in_progress.html
msgid "SEO Review"
msgstr "SÉÖ Révïéw Ⱡ'σяєм ιρѕυм ∂σłσ#"
#: templates/publisher/dashboard/_preview_ready.html
msgid "There are no course runs marked for preview."
......@@ -1959,21 +1993,9 @@ msgstr ""
"%(default_published_days)s däýs. Ⱡ'σяєм ιρѕυм ∂σłσя ѕιт αмєт, ¢σηѕє¢тєтυя#"
#: templates/publisher/dashboard/_published.html
msgid "Start"
msgstr "Stärt Ⱡ'σяєм ιρѕ#"
#: templates/publisher/dashboard/_published.html
msgid "End"
msgstr "Énd Ⱡ'σяєм#"
#: templates/publisher/dashboard/_published.html
msgid "Published Date"
msgstr "Püßlïshéd Däté Ⱡ'σяєм ιρѕυм ∂σłσя ѕιт#"
#: templates/publisher/dashboard/_published.html
msgid "Target Content"
msgstr "Tärgét Çöntént Ⱡ'σяєм ιρѕυм ∂σłσя ѕιт#"
#: templates/publisher/dashboard/_studio_requests.html
msgid ""
"The list below are the courses that need a studio instance to start "
......
......@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-11-18 17:35+0000\n"
"POT-Creation-Date: 2016-11-23 14:30+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"
......
......@@ -53,4 +53,9 @@ $(document).ready(function() {
$('.data-table-preview').DataTable({
"autoWidth": false
});
$('.data-table-in-progress').DataTable({
"autoWidth": false
});
});
.publisher-container {
@include padding(5px, 5px, 5px, 5px);
font-family: "Open Sans", Arial, Helvetica, sans-serif;
.studio-instance-success {
......@@ -18,7 +19,6 @@
@include padding(12px, 20px, 12px, 20px);
@include margin-right(1px);
@include float(left);
outline: none;
background: #f2f2f2;
margin-bottom: 0 !important;
position: relative;
......@@ -28,6 +28,7 @@
color: #949494;
text-transform: capitalize;
text-decoration: none;
z-index: 999;
border: {
width: 2px;
style: solid;
......@@ -45,6 +46,7 @@
cursor: default;
background: white;
color: #169bd5;
z-index: 1001;
border: {
width: 2px;
style: solid;
......@@ -78,10 +80,6 @@
}
}
&:focus {
box-shadow: none;
border:1px solid #169bd5;
}
}
&:before,
......@@ -134,6 +132,8 @@
input {
@include padding-left(6px);
@include padding-right(6px);
padding-top: 0;
padding-bottom: 0;
height: 25px;
border-radius: 0;
border: 1px solid #bebebe;
......
......@@ -7,19 +7,30 @@
{% endblock title %}
{% block content %}
{% with studio_count=studio_request_courses|length published_count=published_course_runs|length preview_count=preview_course_runs|length %}
{% with studio_count=studio_request_courses|length published_count=published_course_runs|length preview_count=preview_course_runs|length in_progress_count=in_progress_course_runs|length %}
<div class="publisher-container">
<h2 class="hd-2 emphasized">{% trans "Course runs" %}</h2>
<ul role="tablist" class="tabs">
<li role="tab" id="tab-progress" class="tab" aria-selected="true" aria-expanded="false" aria-controls="progress" tabindex="0"><span>0</span>{% trans "IN PROGRESS" %}</li>
<li role="tab" id="tab-preview" class="tab" aria-selected="false" aria-expanded="false" aria-controls="preview" tabindex="-1"><span>{{ preview_count }}</span>{% trans "PREVIEW READY" %}</li>
<li role="tab" id="tab-studio" class="tab" aria-selected="false" aria-expanded="true" aria-controls="studio" tabindex="-1" data-studio-count="{{ studio_count }}"><span>{{ studio_count }}</span>{% trans "STUDIO REQUEST" %}</li>
<li role="tab" id="tab-published" class="tab" aria-selected="false" aria-expanded="false" aria-controls="published" tabindex="-1"><span>{{ published_count }}</span>{% trans "PUBLISHED COURSE RUNS" %}</li>
<li role="tab" id="tab-progress" class="tab" aria-selected="true" aria-expanded="false"
aria-controls="progress" tabindex="0">
<span>{{ in_progress_count }}</span>{% trans "IN PROGRESS" %}
</li>
<li role="tab" id="tab-preview" class="tab" aria-selected="false" aria-expanded="false"
aria-controls="preview" tabindex="-1">
<span>{{ preview_count }}</span>{% trans "PREVIEW READY" %}
</li>
<li role="tab" id="tab-studio" class="tab" aria-selected="false" aria-expanded="true"
aria-controls="studio" tabindex="-1" data-studio-count="{{ studio_count }}">
<span>{{ studio_count }}</span>{% trans "STUDIO REQUEST" %}
</li>
<li role="tab" id="tab-published" class="tab" aria-selected="false" aria-expanded="false"
aria-controls="published" tabindex="-1">
<span>{{ published_count }}</span>{% trans "PUBLISHED COURSE RUNS" %}
</li>
</ul>
<div role="tabpanel" id="progress" class="tab-panel" aria-labelledby="tab-progress" aria-hidden="false" tabindex="-1">
<h2>{% trans "In Progress" %}</h2>
<p></p>
{% include "publisher/dashboard/_in_progress.html" %}
</div>
<div role="tabpanel" id="preview" class="tab-panel" aria-labelledby="tab-preview" aria-hidden="true" tabindex="-1">
......
{% load i18n %}
{% if in_progress_count == 0 %}
<p>{% trans "There are no in progress course runs." %}</p>
{% else %}
<table class="data-table-in-progress display nowrap" cellspacing="0" width="100%">
<thead>
<tr>
<th role="button">
{% trans "Course Name" %}
</th>
<th role="button">
{% trans "Institution" %}
</th>
<th role="button">
{% trans "Start" %}
</th>
<th role="button">
{% trans "End" %}
</th>
<th role="button">
{% trans "Target Content" %}
</th>
<th role="button">
{% trans "SEO Review" %}
</th>
</tr>
</thead>
<tbody>
{% for course_run in in_progress_course_runs %}
<tr>
<td>
<a href="{% url 'publisher:publisher_course_run_detail' course_run.id %}">{{ course_run.title }}</a>
</td>
<td>{% if course_run.course.group_institution %}
{{ course_run.course.group_institution }}
{% endif %}
</td>
<td>
{{ course_run.start|date:"Y-m-d" }}
</td>
<td>
{{ course_run.end|date:"Y-m-d" }}
</td>
<td>
{% if course_run.target_content %}Y{% else %}N{% endif %}
</td>
<td>
{% if course_run.is_seo_review %}Y{% else %}N{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endif %}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment