Commit aabf4fcd by Asad Azam Committed by AsadAzam

Cleanup the approvals section on the course run detail page

parent 85109386
......@@ -1032,6 +1032,9 @@ class CourseRunDetailTests(TestCase):
factories.CourseUserRoleFactory(
course=self.course, user=self.user, role=PublisherUserRole.CourseTeam
)
factories.CourseUserRoleFactory(
course=self.course, user=UserFactory(), role=PublisherUserRole.Publisher
)
self.course_run_state.name = CourseStateChoices.Approved
self.course_run_state.save()
......
......@@ -694,11 +694,11 @@ class CourseRevisionView(mixins.LoginRequiredMixin, DetailView):
def get_course_role_widgets_data(user, course, state_object, change_state_url, parent_course=False):
""" Create role widgets list for course user roles. """
role_widgets = []
course_roles = course.course_user_roles
course_roles = course.course_user_roles.exclude(role=PublisherUserRole.MarketingReviewer)
roles = [PublisherUserRole.CourseTeam, PublisherUserRole.ProjectCoordinator]
if parent_course:
roles = [PublisherUserRole.CourseTeam, PublisherUserRole.MarketingReviewer]
course_roles = course_roles.filter(role__in=roles)
course_roles = course.course_user_roles.filter(role__in=roles)
for course_role in course_roles.order_by('role'):
role_widget = {
......
......@@ -7,14 +7,14 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-04-20 14:13+0500\n"
"POT-Creation-Date: 2017-04-20 16:51+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
......@@ -486,8 +486,7 @@ msgstr ""
msgid "Review"
msgstr ""
#: apps/publisher/choices.py
#: templates/publisher/course_run_detail/_widgets.html
#: apps/publisher/choices.py templates/publisher/_approval_widget.html
#: templates/publisher/dashboard/_in_preview.html
msgid "Approved"
msgstr ""
......@@ -967,7 +966,7 @@ msgid "Edit Comment"
msgstr ""
#: templates/comments/edit_comment.html
#: templates/publisher/course_run_detail/_widgets.html
#: templates/publisher/_approval_widget.html
#: templates/publisher/seat_form.html
msgid "Save"
msgstr ""
......@@ -1075,6 +1074,46 @@ msgid ""
msgstr ""
#: templates/publisher/_approval_widget.html
msgid "Decline"
msgstr ""
#: templates/publisher/_approval_widget.html
msgid "Accept"
msgstr ""
#: templates/publisher/_approval_widget.html
msgid "Publish"
msgstr ""
#: templates/publisher/_approval_widget.html
msgid "Submitted for review"
msgstr ""
#: templates/publisher/_approval_widget.html
#: templates/publisher/course_detail/_edit_warning_popup.html
#: templates/publisher/course_run_detail/_edit_warning.html
#: templates/publisher/courses.html
msgid "Edit"
msgstr ""
#: templates/publisher/_approval_widget.html
msgid "COURSE PREVIEW"
msgstr ""
#: templates/publisher/_approval_widget.html
#: templates/publisher/dashboard/_in_preview.html
msgid "Preview URL"
msgstr ""
#: templates/publisher/_approval_widget.html
msgid "View course preview live"
msgstr ""
#: templates/publisher/_approval_widget.html
msgid "Not available"
msgstr ""
#: templates/publisher/_approval_widget.html
msgid "Reviewed"
msgstr ""
......@@ -1941,13 +1980,6 @@ msgid ""
" "
msgstr ""
#: templates/publisher/course_detail/_edit_warning_popup.html
#: templates/publisher/course_run_detail/_edit_warning.html
#: templates/publisher/course_run_detail/_widgets.html
#: templates/publisher/courses.html
msgid "Edit"
msgstr ""
#: templates/publisher/course_detail/_widgets.html
#: templates/publisher/course_run_detail/_widgets.html
msgid "EDIT"
......@@ -2459,39 +2491,6 @@ msgid "Pacing Type"
msgstr ""
#: templates/publisher/course_run_detail/_widgets.html
msgid "Decline"
msgstr ""
#: templates/publisher/course_run_detail/_widgets.html
msgid "Accept"
msgstr ""
#: templates/publisher/course_run_detail/_widgets.html
msgid "Publish"
msgstr ""
#: templates/publisher/course_run_detail/_widgets.html
msgid "Submitted for review"
msgstr ""
#: templates/publisher/course_run_detail/_widgets.html
msgid "COURSE PREVIEW"
msgstr ""
#: templates/publisher/course_run_detail/_widgets.html
#: templates/publisher/dashboard/_in_preview.html
msgid "Preview URL"
msgstr ""
#: templates/publisher/course_run_detail/_widgets.html
msgid "View course preview live"
msgstr ""
#: templates/publisher/course_run_detail/_widgets.html
msgid "Not available"
msgstr ""
#: templates/publisher/course_run_detail/_widgets.html
msgid "Reason for declining preview"
msgstr ""
......
......@@ -7,14 +7,14 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-04-20 14:13+0500\n"
"POT-Creation-Date: 2017-04-20 16:51+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"
......
......@@ -7,14 +7,14 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-04-20 14:13+0500\n"
"POT-Creation-Date: 2017-04-20 16:51+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
......@@ -600,8 +600,7 @@ msgstr "Dräft Ⱡ'σяєм ιρѕ#"
msgid "Review"
msgstr "Révïéw Ⱡ'σяєм ιρѕυ#"
#: apps/publisher/choices.py
#: templates/publisher/course_run_detail/_widgets.html
#: apps/publisher/choices.py templates/publisher/_approval_widget.html
#: templates/publisher/dashboard/_in_preview.html
msgid "Approved"
msgstr "Àpprövéd Ⱡ'σяєм ιρѕυм ∂#"
......@@ -1126,7 +1125,7 @@ msgid "Edit Comment"
msgstr "Édït Çömmént Ⱡ'σяєм ιρѕυм ∂σłσя ѕ#"
#: templates/comments/edit_comment.html
#: templates/publisher/course_run_detail/_widgets.html
#: templates/publisher/_approval_widget.html
#: templates/publisher/seat_form.html
msgid "Save"
msgstr "Sävé Ⱡ'σяєм ι#"
......@@ -1243,6 +1242,46 @@ msgstr ""
"ηση ρяσι∂єηт, ѕυηт ιη #"
#: templates/publisher/_approval_widget.html
msgid "Decline"
msgstr "Déçlïné Ⱡ'σяєм ιρѕυм #"
#: templates/publisher/_approval_widget.html
msgid "Accept"
msgstr "Àççépt Ⱡ'σяєм ιρѕυ#"
#: templates/publisher/_approval_widget.html
msgid "Publish"
msgstr "Püßlïsh Ⱡ'σяєм ιρѕυм #"
#: templates/publisher/_approval_widget.html
msgid "Submitted for review"
msgstr "Süßmïttéd för révïéw Ⱡ'σяєм ιρѕυм ∂σłσя ѕιт αмєт, #"
#: templates/publisher/_approval_widget.html
#: templates/publisher/course_detail/_edit_warning_popup.html
#: templates/publisher/course_run_detail/_edit_warning.html
#: templates/publisher/courses.html
msgid "Edit"
msgstr "Édït Ⱡ'σяєм ι#"
#: templates/publisher/_approval_widget.html
msgid "COURSE PREVIEW"
msgstr "ÇÖÛRSÉ PRÉVÌÉW Ⱡ'σяєм ιρѕυм ∂σłσя ѕιт#"
#: templates/publisher/_approval_widget.html
#: templates/publisher/dashboard/_in_preview.html
msgid "Preview URL"
msgstr "Prévïéw ÛRL Ⱡ'σяєм ιρѕυм ∂σłσя #"
#: templates/publisher/_approval_widget.html
msgid "View course preview live"
msgstr "Vïéw çöürsé prévïéw lïvé Ⱡ'σяєм ιρѕυм ∂σłσя ѕιт αмєт, ¢ση#"
#: templates/publisher/_approval_widget.html
msgid "Not available"
msgstr "Nöt äväïläßlé Ⱡ'σяєм ιρѕυм ∂σłσя ѕι#"
#: templates/publisher/_approval_widget.html
msgid "Reviewed"
msgstr "Révïéwéd Ⱡ'σяєм ιρѕυм ∂#"
......@@ -2311,13 +2350,6 @@ msgstr ""
" Thé %(current_team_name)s téäm ïs çürréntlý révïéwïng thïs çöürsé. Ìf ýöü édït çöürsé ïnförmätïön, ýöü mïght övérwrïté thé téäm’s çhängés, änd ýöü wïll hävé tö sénd thé çöürsé tö thé %(team_name)s téäm för révïéw ägäïn.\n"
" Ⱡ'σяєм ιρѕυм ∂σłσя ѕιт αмєт, ¢σηѕє¢тєтυя α∂ιριѕι¢ιηg єłιт, ѕє∂ ∂σ єιυѕмσ∂ тємρσя ιη¢ι∂ι∂υηт υт łαвσяє єт ∂σłσяє мαgηα αłιqυα. υт єηιм α∂ мιηιм νєηιαм, qυιѕ ησѕтяυ∂ єχєя¢ιтαтιση υłłαм¢σ łαвσяιѕ ηιѕι υт αłιqυιρ єχ єα ¢σммσ∂σ ¢σηѕєqυαт. ∂υιѕ αυтє ιяυяє ∂σłσя ιη яєρяєнєη∂єяιт ιη νσłυρтαтє νєłιт єѕѕє ¢ιłłυм ∂σłσяє єυ ƒυgιαт ηυłłα#"
#: templates/publisher/course_detail/_edit_warning_popup.html
#: templates/publisher/course_run_detail/_edit_warning.html
#: templates/publisher/course_run_detail/_widgets.html
#: templates/publisher/courses.html
msgid "Edit"
msgstr "Édït Ⱡ'σяєм ι#"
#: templates/publisher/course_detail/_widgets.html
#: templates/publisher/course_run_detail/_widgets.html
msgid "EDIT"
......@@ -2893,39 +2925,6 @@ msgid "Pacing Type"
msgstr "Päçïng Týpé Ⱡ'σяєм ιρѕυм ∂σłσя #"
#: templates/publisher/course_run_detail/_widgets.html
msgid "Decline"
msgstr "Déçlïné Ⱡ'σяєм ιρѕυм #"
#: templates/publisher/course_run_detail/_widgets.html
msgid "Accept"
msgstr "Àççépt Ⱡ'σяєм ιρѕυ#"
#: templates/publisher/course_run_detail/_widgets.html
msgid "Publish"
msgstr "Püßlïsh Ⱡ'σяєм ιρѕυм #"
#: templates/publisher/course_run_detail/_widgets.html
msgid "Submitted for review"
msgstr "Süßmïttéd för révïéw Ⱡ'σяєм ιρѕυм ∂σłσя ѕιт αмєт, #"
#: templates/publisher/course_run_detail/_widgets.html
msgid "COURSE PREVIEW"
msgstr "ÇÖÛRSÉ PRÉVÌÉW Ⱡ'σяєм ιρѕυм ∂σłσя ѕιт#"
#: templates/publisher/course_run_detail/_widgets.html
#: templates/publisher/dashboard/_in_preview.html
msgid "Preview URL"
msgstr "Prévïéw ÛRL Ⱡ'σяєм ιρѕυм ∂σłσя #"
#: templates/publisher/course_run_detail/_widgets.html
msgid "View course preview live"
msgstr "Vïéw çöürsé prévïéw lïvé Ⱡ'σяєм ιρѕυм ∂σłσя ѕιт αмєт, ¢ση#"
#: templates/publisher/course_run_detail/_widgets.html
msgid "Not available"
msgstr "Nöt äväïläßlé Ⱡ'σяєм ιρѕυм ∂σłσя ѕι#"
#: templates/publisher/course_run_detail/_widgets.html
msgid "Reason for declining preview"
msgstr "Réäsön för déçlïnïng prévïéw Ⱡ'σяєм ιρѕυм ∂σłσя ѕιт αмєт, ¢σηѕє¢#"
......
......@@ -7,14 +7,14 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-04-20 14:13+0500\n"
"POT-Creation-Date: 2017-04-20 16:51+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
......
......@@ -14,6 +14,61 @@
{% endif %}
{% for role_widget in role_widgets %}
{% if role_widget.course_role.role == 'publisher' %}
<div class="preview-widget">
<div class="preview-container">
<div class="layout-1q3q layout-reversed">
<div class="layout-col layout-col-a">
{% if object.preview_url %}
{% if object.preview_url and object.course.course_team_admin == request.user and object.course_run_state.is_approved and not object.course_run_state.is_preview_accepted %}
<button class="btn btn-neutral btn-preview btn-preview-decline" type="button">
{% trans "Decline" %}
</button>
<button class="btn btn-neutral btn-preview btn-preview-accept" type="button">
{% trans "Accept" %}
</button>
{% elif preview_accepted_date %}
<span class="state-status">
<span class="icon fa fa-check" aria-hidden="true"></span>
{% trans "Approved" %}<br>
{{ preview_accepted_date|date:'m/d/y H:i a' }}
</span>
{% if object.course_run_state.is_ready_to_publish and object.course.publisher == request.user %}
<button class="btn-brand btn-base btn-publish" data-change-state-url="{% url 'publisher:api:change_course_run_state' object.course_run_state.id %}" data-state-name="{{ publish_state_name }}" type="button">
{% trans "Publish" %}
</button>
{% endif %}
{% elif object.course.publisher == request.user %}
<span class="preview-status">{% trans "Submitted for review" %}</span>
<button data-url="{% url 'publisher:api:update_course_run' object.id %}" class="btn btn-neutral btn-edit-preview-url">{% trans "Edit" %}</button>
{% endif %}
{% elif object.course.publisher == request.user %}
<button data-url="{% url 'publisher:api:update_course_run' object.id %}" class="btn btn-neutral btn-save-preview-url">{% trans "Save" %}</button>
{% endif %}
</div>
<div class="layout-col layout-col-b">
<span class="preview-heading">
<strong>{% trans "COURSE PREVIEW" %}</strong>
</span>
<div class="preview-url">
{% if object.preview_url %}
<span class="preview-url-heading">{% trans "Preview URL" %} - </span>
<a href="{{ object.preview_url }}" target="_blank">{% trans "View course preview live" %}</a>
{% else %}
{% if object.course.publisher == request.user %}
<input id="id-review-url" type="text">
<span class="error-message"></span>
{% else %}
<span>{% trans "Not available" %}</span>
{% endif %}
{% endif %}
</div>
</div>
</div>
</div>
</div>
<hr>
{% endif %}
<div class="role-widget">
<div class="role-assignment-container">
<div class="layout-1q3q layout-reversed">
......
......@@ -11,59 +11,6 @@
<div class="approval-widget {% if not publisher_approval_widget_feature %}hidden{% endif %}">
{% include 'publisher/_approval_widget.html' %}
<div class="preview-widget">
<div class="preview-container">
<div class="layout-1q3q layout-reversed">
<div class="layout-col layout-col-a">
{% if object.preview_url %}
{% if object.preview_url and object.course.course_team_admin == request.user and object.course_run_state.is_approved and not object.course_run_state.is_preview_accepted %}
<button class="btn btn-neutral btn-preview btn-preview-decline" type="button">
{% trans "Decline" %}
</button>
<button class="btn btn-neutral btn-preview btn-preview-accept" type="button">
{% trans "Accept" %}
</button>
{% elif preview_accepted_date %}
<span class="state-status">
<span class="icon fa fa-check" aria-hidden="true"></span>
{% trans "Approved" %}<br>
{{ preview_accepted_date|date:'m/d/y H:i a' }}
</span>
{% if object.course_run_state.is_ready_to_publish and object.course.publisher == request.user %}
<button class="btn-brand btn-base btn-publish" data-change-state-url="{% url 'publisher:api:change_course_run_state' object.course_run_state.id %}" data-state-name="{{ publish_state_name }}" type="button">
{% trans "Publish" %}
</button>
{% endif %}
{% elif object.course.publisher == request.user %}
<span class="preview-status">{% trans "Submitted for review" %}</span>
<button data-url="{% url 'publisher:api:update_course_run' object.id %}" class="btn btn-neutral btn-edit-preview-url">{% trans "Edit" %}</button>
{% endif %}
{% elif object.course.publisher == request.user %}
<button data-url="{% url 'publisher:api:update_course_run' object.id %}" class="btn btn-neutral btn-save-preview-url">{% trans "Save" %}</button>
{% endif %}
</div>
<div class="layout-col layout-col-b">
<span class="preview-heading">
<strong>{% trans "COURSE PREVIEW" %}</strong>
</span>
<div class="preview-url">
{% if object.preview_url %}
<span class="preview-url-heading">{% trans "Preview URL" %} - </span>
<a href="{{ object.preview_url }}" target="_blank">{% trans "View course preview live" %}</a>
{% else %}
{% if object.course.publisher == request.user %}
<input id="id-review-url" type="text">
<span class="error-message"></span>
{% else %}
<span>{% trans "Not available" %}</span>
{% endif %}
{% endif %}
</div>
</div>
</div>
</div>
</div>
<hr>
<div id="decline-comment" class="hidden clearfix">
{% trans 'Reason for declining preview' as decline_reason %}
{% trans 'Submit' as submit %}
......
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