Commit 6b0d9bd1 by tasawernawaz Committed by Tasawer Nawaz

Address Pilot Gaps: Course Listing Page

ECOM-6798
parent f6ac85f0
......@@ -19,6 +19,7 @@ from testfixtures import LogCapture
from course_discovery.apps.core.models import User
from course_discovery.apps.core.tests.factories import UserFactory, USER_PASSWORD
from course_discovery.apps.core.tests.helpers import make_image_file
from course_discovery.apps.course_metadata.tests import toggle_switch
from course_discovery.apps.course_metadata.tests.factories import OrganizationFactory
from course_discovery.apps.publisher.choices import PublisherUserRole
from course_discovery.apps.publisher.constants import (
......@@ -1073,6 +1074,33 @@ class CourseRunDetailTests(TestCase):
return user
def test_tabs_for_course_team_user(self):
"""Verify that internal/admin user will see only one tab. """
response = self.client.get(self.page_url)
self.assertContains(response, '<button class="selected" data-tab="#tab-1">All</button>')
response_string = response.content.decode('UTF-8')
self.assertNotIn(response_string, '<button data-tab="#tab-2">STUDIO</button>')
self.assertNotIn(response_string, '<button data-tab="#tab-3">CAT</button>')
self.assertNotIn(response_string, '<button data-tab="#tab-4">DRUPAL</button>')
self.assertNotIn(response_string, '<button data-tab="#tab-5">Salesforce</button>')
def test_page_enable_waffle_switch(self):
""" Verify that user will see only studio fields when 'publisher_hide_features_for_pilot' is activated. """
toggle_switch('publisher_hide_features_for_pilot', True)
response = self.client.get(self.page_url)
self.assertContains(response, '<aside class="layout-col layout-col-a hidden">')
self.assertContains(response, '<div class="non-studio-fields hidden">')
def test_page_disable_waffle_switch(self):
""" Verify that user will see whole page when 'publisher_hide_features_for_pilot' is deactivated. """
toggle_switch('publisher_hide_features_for_pilot', False)
response = self.client.get(self.page_url)
response_string = response.content.decode('UTF-8')
self.assertNotIn(response_string, '<aside class="layout-col layout-col-a hidden">')
self.assertNotIn(response_string, '<div class="non-studio-fields hidden">')
class ChangeStateViewTests(TestCase):
""" Tests for the `ChangeStateView`. """
......
......@@ -14,8 +14,9 @@ from django.utils.translation import ugettext_lazy as _
from django.views.generic import View, CreateView, UpdateView, DetailView, ListView
from django_fsm import TransitionNotAllowed
from guardian.shortcuts import get_objects_for_user
from course_discovery.apps.core.models import User
import waffle
from course_discovery.apps.core.models import User
from course_discovery.apps.publisher.choices import PublisherUserRole
from course_discovery.apps.publisher.forms import (
CourseForm, CourseRunForm, SeatForm, CustomCourseForm, CustomCourseRunForm,
......@@ -160,6 +161,10 @@ class CourseRunDetailView(mixins.LoginRequiredMixin, mixins.PublisherPermissionM
)
}
]
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')
return context
......@@ -229,9 +234,11 @@ class CreateCourseView(mixins.LoginRequiredMixin, mixins.PublisherUserRequiredMi
CourseUserRole.add_course_roles(course=course, role=PublisherUserRole.CourseTeam,
user=User.objects.get(id=course_form.data['team_admin']))
messages.success(
request, _('Course created successfully.')
)
# pylint: disable=no-member
messages.success(request, _(
'EdX will create a Studio instance for this course. You will receive a notification message at '
'{email} when the Studio instance has been created.').format(email=request.user.email))
return HttpResponseRedirect(self.get_success_url(run_course.id))
except Exception as e: # pylint: disable=broad-except
# pylint: disable=no-member
......
......@@ -7,14 +7,14 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-01-11 19:39+0500\n"
"POT-Creation-Date: 2017-01-12 12:07+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
......@@ -631,7 +631,10 @@ msgid "PUBLISHER"
msgstr ""
#: apps/publisher/views.py
msgid "Course created successfully."
#, python-brace-format
msgid ""
"EdX will create a Studio instance for this course. You will receive a "
"notification message at {email} when the Studio instance has been created."
msgstr ""
#: apps/publisher/views.py
......@@ -1337,6 +1340,31 @@ msgid "Number"
msgstr ""
#: templates/publisher/course_run_detail/_all.html
#: templates/publisher/course_run_detail/_studio.html
#: templates/publisher/dashboard/_preview_ready.html
#: templates/publisher/dashboard/_published.html
#: templates/publisher/dashboard/_studio_requests.html
msgid "Organization"
msgstr ""
#: templates/publisher/course_run_detail/_all.html
msgid "Course Start Date"
msgstr ""
#: templates/publisher/course_run_detail/_all.html
msgid "Course End Date"
msgstr ""
#: templates/publisher/course_run_detail/_all.html
#: templates/publisher/course_run_detail/_studio.html
msgid "Pacing Type"
msgstr ""
#: templates/publisher/course_run_detail/_all.html
msgid "Contracted Partner"
msgstr ""
#: templates/publisher/course_run_detail/_all.html
#: templates/publisher/course_run_detail/_cat.html
#: templates/publisher/course_run_detail/_drupal.html
msgid "Course ID"
......@@ -1382,14 +1410,6 @@ msgid "Price"
msgstr ""
#: templates/publisher/course_run_detail/_all.html
msgid "Course Start Date"
msgstr ""
#: templates/publisher/course_run_detail/_all.html
msgid "Course End Date"
msgstr ""
#: templates/publisher/course_run_detail/_all.html
msgid "Certificate Generation Date Exception Request"
msgstr ""
......@@ -1398,11 +1418,6 @@ msgid "Course Length (weeks)"
msgstr ""
#: templates/publisher/course_run_detail/_all.html
#: templates/publisher/course_run_detail/_studio.html
msgid "Pacing Type"
msgstr ""
#: templates/publisher/course_run_detail/_all.html
#: templates/publisher/course_run_detail/_drupal.html
msgid "Estimated Effort"
msgstr ""
......@@ -1680,13 +1695,6 @@ msgid "Course Name"
msgstr ""
#: templates/publisher/course_run_detail/_studio.html
#: templates/publisher/dashboard/_preview_ready.html
#: templates/publisher/dashboard/_published.html
#: templates/publisher/dashboard/_studio_requests.html
msgid "Organization"
msgstr ""
#: templates/publisher/course_run_detail/_studio.html
msgid "Enrollment Start Date"
msgstr ""
......
......@@ -7,14 +7,14 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-01-11 19:39+0500\n"
"POT-Creation-Date: 2017-01-12 12:07+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-01-11 19:39+0500\n"
"POT-Creation-Date: 2017-01-12 12:07+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
......@@ -753,8 +753,19 @@ msgid "PUBLISHER"
msgstr "PÛBLÌSHÉR Ⱡ'σяєм ιρѕυм ∂σł#"
#: apps/publisher/views.py
msgid "Course created successfully."
msgstr "Çöürsé çréätéd süççéssfüllý. Ⱡ'σяєм ιρѕυм ∂σłσя ѕιт αмєт, ¢σηѕє¢#"
#, python-brace-format
msgid ""
"EdX will create a Studio instance for this course. You will receive a "
"notification message at {email} when the Studio instance has been created."
msgstr ""
"ÉdX wïll çréäté ä Stüdïö ïnstänçé för thïs çöürsé. Ýöü wïll réçéïvé ä "
"nötïfïçätïön méssägé ät {email} whén thé Stüdïö ïnstänçé häs ßéén çréätéd. "
"Ⱡ'σяєм ιρѕυм ∂σłσя ѕιт αмєт, ¢σηѕє¢тєтυя α∂ιριѕι¢ιηg єłιт, ѕє∂ ∂σ єιυѕмσ∂ "
"тємρσя ιη¢ι∂ι∂υηт υт łαвσяє єт ∂σłσяє мαgηα αłιqυα. υт єηιм α∂ мιηιм νєηιαм,"
" qυιѕ ησѕтяυ∂ єχєя¢ιтαтιση υłłαм¢σ łαвσяιѕ ηιѕι υт αłιqυιρ єχ єα ¢σммσ∂σ "
"¢σηѕєqυαт. ∂υιѕ αυтє ιяυяє ∂σłσя ιη яєρяєнєη∂єяιт ιη νσłυρтαтє νєłιт єѕѕє "
"¢ιłłυм ∂σłσяє єυ ƒυgιαт ηυłłα ραяιαтυя. єχ¢єρтєυя ѕιηт σ¢¢αє¢αт ¢υρι∂αтαт "
"ηση ρяσι∂єηт, ѕυηт ιη ¢υłρα qυι σƒƒι¢ια ∂єѕєяυηт мσłłιт αηιм ι∂ єѕт ł#"
#: apps/publisher/views.py
#, python-brace-format
......@@ -1611,6 +1622,31 @@ msgid "Number"
msgstr "Nümßér Ⱡ'σяєм ιρѕυ#"
#: templates/publisher/course_run_detail/_all.html
#: templates/publisher/course_run_detail/_studio.html
#: templates/publisher/dashboard/_preview_ready.html
#: templates/publisher/dashboard/_published.html
#: templates/publisher/dashboard/_studio_requests.html
msgid "Organization"
msgstr "Örgänïzätïön Ⱡ'σяєм ιρѕυм ∂σłσя ѕ#"
#: templates/publisher/course_run_detail/_all.html
msgid "Course Start Date"
msgstr "Çöürsé Stärt Däté Ⱡ'σяєм ιρѕυм ∂σłσя ѕιт αмє#"
#: templates/publisher/course_run_detail/_all.html
msgid "Course End Date"
msgstr "Çöürsé Énd Däté Ⱡ'σяєм ιρѕυм ∂σłσя ѕιт α#"
#: templates/publisher/course_run_detail/_all.html
#: templates/publisher/course_run_detail/_studio.html
msgid "Pacing Type"
msgstr "Päçïng Týpé Ⱡ'σяєм ιρѕυм ∂σłσя #"
#: templates/publisher/course_run_detail/_all.html
msgid "Contracted Partner"
msgstr "Çönträçtéd Pärtnér Ⱡ'σяєм ιρѕυм ∂σłσя ѕιт αмєт#"
#: templates/publisher/course_run_detail/_all.html
#: templates/publisher/course_run_detail/_cat.html
#: templates/publisher/course_run_detail/_drupal.html
msgid "Course ID"
......@@ -1656,14 +1692,6 @@ msgid "Price"
msgstr "Prïçé Ⱡ'σяєм ιρѕ#"
#: templates/publisher/course_run_detail/_all.html
msgid "Course Start Date"
msgstr "Çöürsé Stärt Däté Ⱡ'σяєм ιρѕυм ∂σłσя ѕιт αмє#"
#: templates/publisher/course_run_detail/_all.html
msgid "Course End Date"
msgstr "Çöürsé Énd Däté Ⱡ'σяєм ιρѕυм ∂σłσя ѕιт α#"
#: templates/publisher/course_run_detail/_all.html
msgid "Certificate Generation Date Exception Request"
msgstr ""
"Çértïfïçäté Générätïön Däté Éxçéptïön Réqüést Ⱡ'σяєм ιρѕυм ∂σłσя ѕιт αмєт, "
......@@ -1674,11 +1702,6 @@ msgid "Course Length (weeks)"
msgstr "Çöürsé Léngth (wééks) Ⱡ'σяєм ιρѕυм ∂σłσя ѕιт αмєт, #"
#: templates/publisher/course_run_detail/_all.html
#: templates/publisher/course_run_detail/_studio.html
msgid "Pacing Type"
msgstr "Päçïng Týpé Ⱡ'σяєм ιρѕυм ∂σłσя #"
#: templates/publisher/course_run_detail/_all.html
#: templates/publisher/course_run_detail/_drupal.html
msgid "Estimated Effort"
msgstr "Éstïmätéd Éffört Ⱡ'σяєм ιρѕυм ∂σłσя ѕιт αм#"
......@@ -1963,13 +1986,6 @@ msgid "Course Name"
msgstr "Çöürsé Nämé Ⱡ'σяєм ιρѕυм ∂σłσя #"
#: templates/publisher/course_run_detail/_studio.html
#: templates/publisher/dashboard/_preview_ready.html
#: templates/publisher/dashboard/_published.html
#: templates/publisher/dashboard/_studio_requests.html
msgid "Organization"
msgstr "Örgänïzätïön Ⱡ'σяєм ιρѕυм ∂σłσя ѕ#"
#: templates/publisher/course_run_detail/_studio.html
msgid "Enrollment Start Date"
msgstr "Énröllmént Stärt Däté Ⱡ'σяєм ιρѕυм ∂σłσя ѕιт αмєт, #"
......
......@@ -7,14 +7,14 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-01-11 19:39+0500\n"
"POT-Creation-Date: 2017-01-12 12:07+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
......
......@@ -13,6 +13,7 @@
<main class="layout-col layout-col-b">
<nav class="administration-nav">
<div class="tab-container">
{% if can_view_all_tabs %}
<button class="selected" data-tab="#tab-1">{% trans "All" %}</button>
{% comment %}Translators: Studio is an edX tool for course creation.{% endcomment %}
<button data-tab="#tab-2">{% trans "STUDIO" %}</button>
......@@ -21,6 +22,9 @@
{% comment %}Translators: DRUPAL is an edX marketing site.{% endcomment %}
<button data-tab="#tab-4">{% trans "DRUPAL" %}</button>
<button data-tab="#tab-5">Salesforce</button>
{% else %}
<button class="selected" disabled="disabled" data-tab="#tab-1">{% trans "All" %}</button>
{% endif %}
</div>
</nav>
......@@ -46,6 +50,7 @@
<div id="tab-1" class="tab-content active">
{% include 'publisher/course_run_detail/_all.html' %}
</div>
{% if can_view_all_tabs %}
<div id="tab-2" class="tab-content">
{% include 'publisher/course_run_detail/_studio.html' %}
</div>
......@@ -58,11 +63,13 @@
<div id="tab-5" class="tab-content">
{% include 'publisher/course_run_detail/_salesforce.html' %}
</div>
{% endif %}
</div>
</div>
</main>
<aside class="layout-col layout-col-a">
{% include 'publisher/course_run_detail/_approval_widget.html' %}
<aside class="layout-col layout-col-a {% if publisher_hide_features_for_pilot %}hidden{% endif %}">
{% include 'publisher/course_run_detail/_approval_widget.html' %}
</aside>
</div>
{% endblock %}
......
......@@ -15,6 +15,47 @@
</div>
<div class="copy">{{ object.number }}</div>
</div>
<div class="info-item">
<div class="heading">
{% trans "Organization" %}
{% include "publisher/course_run_detail/_clipboard.html" %}
</div>
<div class="copy">{{ object.organization_name }}</div>
</div>
<div class="info-item">
<div class="heading">
{% trans "Course Start Date" %}
{% include "publisher/course_run_detail/_clipboard.html" %}
</div>
<div class="copy">{{ object.start }}</div>
</div>
<div class="info-item">
<div class="heading">
{% trans "Course End Date" %}
{% include "publisher/course_run_detail/_clipboard.html" %}
</div>
<div class="copy">{{ object.end }}</div>
</div>
<div class="info-item">
<div class="heading">
{% trans "Pacing Type" %}
{% include "publisher/course_run_detail/_clipboard.html" %}
</div>
<div class="copy">{{ object.pacing_type }}</div>
</div>
<div class="info-item">
<div class="heading">
{% trans "Contracted Partner" %}
{% include "publisher/course_run_detail/_clipboard.html" %}
</div>
<div class="copy">{{ object.contacted_partner_manager }}</div>
</div>
<div class="non-studio-fields {% if publisher_hide_features_for_pilot %}hidden{% endif %}">
<div class="info-item">
<div class="heading">
{% trans "Course ID" %}
......@@ -103,22 +144,6 @@
<div class="info-item">
<div class="heading">
{% trans "Course Start Date" %}
{% include "publisher/course_run_detail/_clipboard.html" %}
</div>
<div class="copy">{{ object.start }}</div>
</div>
<div class="info-item">
<div class="heading">
{% trans "Course End Date" %}
{% include "publisher/course_run_detail/_clipboard.html" %}
</div>
<div class="copy">{{ object.end }}</div>
</div>
<div class="info-item">
<div class="heading">
{% trans "Certificate Generation Date Exception Request" %}
{% include "publisher/course_run_detail/_clipboard.html" %}
</div>
......@@ -135,14 +160,6 @@
<div class="info-item">
<div class="heading">
{% trans "Pacing Type" %}
{% include "publisher/course_run_detail/_clipboard.html" %}
</div>
<div class="copy">{{ object.pacing_type }}</div>
</div>
<div class="info-item">
<div class="heading">
{% trans "Estimated Effort" %}
{% include "publisher/course_run_detail/_clipboard.html" %}
</div>
......@@ -255,5 +272,6 @@
</div>
<div class="copy">{{ object.notes }}</div>
</div>
</div>
</div>
<div class="clearfix"></div>
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