Commit 4936ed72 by tasawernawaz Committed by Tasawer Nawaz

Course run and course metadata widget

ECOM-6072
parent b9775b30
......@@ -799,7 +799,7 @@ class CourseRunDetailTests(TestCase):
self.wrapped_course_run.xseries_name, self.wrapped_course_run.min_effort,
self.wrapped_course_run.pacing_type, self.wrapped_course_run.persons,
self.wrapped_course_run.max_effort, self.wrapped_course_run.language.name,
self.wrapped_course_run.video_languages, self.wrapped_course_run.level_type,
self.wrapped_course_run.transcript_languages, self.wrapped_course_run.level_type,
self.wrapped_course_run.full_description, self.wrapped_course_run.expected_learnings,
self.wrapped_course_run.prerequisites, self.wrapped_course_run.keywords
]
......@@ -979,20 +979,6 @@ class CourseRunDetailTests(TestCase):
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_pilot(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, '<div class="non-studio-fields hidden">')
def test_page_disable_waffle_switch_pilot(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)
self.assertContains(response, '<div class="non-studio-fields ">')
def test_comments_with_enable_switch(self):
""" Verify that user will see the comments widget when
'publisher_comment_widget_feature' is enabled.
......
......@@ -5,8 +5,9 @@ from unittest import mock
import ddt
from django.test import TestCase
from course_discovery.apps.core.tests.helpers import make_image_file
from course_discovery.apps.course_metadata.choices import CourseRunPacing
from course_discovery.apps.course_metadata.tests.factories import OrganizationFactory
from course_discovery.apps.course_metadata.tests.factories import OrganizationFactory, PersonFactory, PositionFactory
from course_discovery.apps.publisher.models import Seat, State
from course_discovery.apps.publisher.tests import factories
from course_discovery.apps.publisher.wrappers import CourseRunWrapper
......@@ -164,3 +165,42 @@ class CourseRunWrapperTests(TestCase):
self.wrapped_course_run.is_seo_review,
self.course.is_seo_review
)
def test_course_team_admin(self):
""" Verify that the wrapper return the course team admin. """
self.assertEqual(self.wrapped_course_run.course_team_admin, self.course.course_team_admin)
def test_course_image(self):
""" Verify that the wrapper return the url fo thumbnail course image if exists. """
self.assertIsNone(self.wrapped_course_run.course_image)
self.course.image = make_image_file('test_banner1.jpg')
self.course.save()
self.assertEqual(self.wrapped_course_run.course_image, self.course.image.thumbnail.url)
def test_course_staff(self):
"""Verify that the wrapper return staff list."""
staff = PersonFactory()
# another staff with position
staff_2 = PersonFactory()
position = PositionFactory(person=staff_2)
self.course_run.staff = [staff, staff_2]
self.course_run.save()
expected = [
{
'full_name': staff.full_name,
'image_url': staff.get_profile_image_url,
},
{
'full_name': staff_2.full_name,
'image_url': staff_2.get_profile_image_url,
'position': position.title,
'organization': position.organization_name
}
]
self.assertEqual(self.wrapped_course_run.course_staff, expected)
......@@ -50,7 +50,7 @@ class CourseRunWrapper(BaseWrapper):
return [seat for seat in self.wrapped_obj.seats.all() if seat.type != Seat.CREDIT]
@property
def video_languages(self):
def transcript_languages(self):
return ', '.join([lang.name for lang in self.wrapped_obj.transcript_languages.all()])
@property
......@@ -190,3 +190,31 @@ class CourseRunWrapper(BaseWrapper):
@property
def is_seo_review(self):
return self.wrapped_obj.course.is_seo_review
@property
def course_team_admin(self):
return self.wrapped_obj.course.course_team_admin
@property
def course_image(self):
if self.wrapped_obj.course.image:
return self.wrapped_obj.course.image.thumbnail.url
@property
def course_staff(self):
staff_list = []
for staff in self.wrapped_obj.staff.all():
staff_dict = {
'full_name': staff.full_name,
'image_url': staff.get_profile_image_url,
}
if hasattr(staff, 'position'):
staff_dict.update({
'position': staff.position.title,
'organization': staff.position.organization_name,
})
staff_list.append(staff_dict)
return staff_list
......@@ -7,14 +7,14 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-02-15 15:52+0500\n"
"POT-Creation-Date: 2017-02-16 14:33+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
......@@ -524,12 +524,14 @@ msgstr ""
#: apps/publisher/forms.py apps/publisher/models.py
#: templates/publisher/course_detail.html
#: templates/publisher/course_revision_history.html
#: templates/publisher/course_run_detail/_all.html
msgid "Brief Description"
msgstr ""
#: apps/publisher/forms.py apps/publisher/models.py
#: templates/publisher/course_detail.html
#: templates/publisher/course_revision_history.html
#: templates/publisher/course_run_detail/_all.html
msgid "Full Description"
msgstr ""
......@@ -556,11 +558,11 @@ msgstr ""
msgid "Tertiary (optional)"
msgstr ""
#: apps/publisher/forms.py templates/publisher/course_run_detail/_all.html
#: apps/publisher/forms.py
msgid "Course Start Date"
msgstr ""
#: apps/publisher/forms.py templates/publisher/course_run_detail/_all.html
#: apps/publisher/forms.py
msgid "Course End Date"
msgstr ""
......@@ -648,7 +650,7 @@ msgstr ""
msgid "Course number"
msgstr ""
#: apps/publisher/models.py templates/publisher/course_run_detail/_all.html
#: apps/publisher/models.py
msgid "Partner Name"
msgstr ""
......@@ -658,6 +660,7 @@ msgstr ""
#: apps/publisher/models.py templates/publisher/course_detail.html
#: templates/publisher/course_revision_history.html
#: templates/publisher/course_run_detail/_all.html
msgid "Expected Learnings"
msgstr ""
......@@ -907,7 +910,6 @@ msgid "Title"
msgstr ""
#: templates/publisher/_add_instructor_popup.html
#: 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
......@@ -1671,31 +1673,38 @@ msgstr ""
msgid "Course Detail"
msgstr ""
#: templates/publisher/course_detail.html templates/publisher/courses.html
#: templates/publisher/course_detail.html
#: templates/publisher/course_run_detail/_all.html
#: templates/publisher/courses.html
#: templates/publisher/dashboard/_in_progress.html
msgid "Institution"
msgstr ""
#: templates/publisher/course_detail.html
#: templates/publisher/course_run_detail/_all.html
msgid "Course Team Admin"
msgstr ""
#: templates/publisher/course_detail.html
#: templates/publisher/course_revision_history.html
#: templates/publisher/course_run_detail/_all.html
msgid "Primary Subject"
msgstr ""
#: templates/publisher/course_detail.html
#: templates/publisher/course_revision_history.html
#: templates/publisher/course_run_detail/_all.html
msgid "Secondary Subject"
msgstr ""
#: templates/publisher/course_detail.html
#: templates/publisher/course_revision_history.html
#: templates/publisher/course_run_detail/_all.html
msgid "Tertiary Subject"
msgstr ""
#: templates/publisher/course_detail.html
#: templates/publisher/course_run_detail/_all.html
msgid "Course Image"
msgstr ""
......@@ -1818,75 +1827,44 @@ msgid "Number"
msgstr ""
#: templates/publisher/course_run_detail/_all.html
#: templates/publisher/course_run_detail/_studio.html
msgid "Pacing Type"
msgid "Studio instance"
msgstr ""
#: templates/publisher/course_run_detail/_all.html
msgid "Contracted Partner"
#: templates/publisher/course_run_detail/_render_field.html
msgid "empty"
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"
msgstr ""
#: templates/publisher/course_run_detail/_all.html
msgid "Is Re-run?"
msgstr ""
#: templates/publisher/course_run_detail/_all.html
msgid "Course Subtitle"
msgstr ""
#: templates/publisher/course_run_detail/_all.html
msgid "Subjects"
msgstr ""
#: templates/publisher/course_run_detail/_all.html
msgid "Part of an Xseries?"
msgstr ""
#: templates/publisher/course_run_detail/_all.html
msgid "Xseries Name"
msgstr ""
#: templates/publisher/course_run_detail/_all.html
msgid "Part of a Micromasters?"
msgstr ""
#: templates/publisher/course_run_detail/_all.html
msgid "Micromasters Name"
msgstr ""
#: templates/publisher/course_run_detail/_all.html
msgid "Enrollment Type"
#: templates/publisher/course_run_detail/_salesforce.html
#: templates/publisher/course_run_detail/_studio.html
#: templates/publisher/dashboard/_studio_requests.html
msgid "Start Date"
msgstr ""
#: templates/publisher/course_run_detail/_all.html
#: templates/publisher/course_run_detail/_credit_seat.html
#: templates/publisher/course_run_detail/_drupal.html
#: templates/publisher/course_run_detail/_seats.html
msgid "Price"
#: templates/publisher/course_run_detail/_salesforce.html
#: templates/publisher/course_run_detail/_studio.html
msgid "End Date"
msgstr ""
#: templates/publisher/course_run_detail/_all.html
msgid "Certificate Generation Date Exception Request"
msgid "Certificate type"
msgstr ""
#: templates/publisher/course_run_detail/_all.html
msgid "Course Length (weeks)"
msgid "Certificate Price"
msgstr ""
#: templates/publisher/course_run_detail/_all.html
#: templates/publisher/course_run_detail/_drupal.html
msgid "Estimated Effort"
msgid "Course Staff"
msgstr ""
#: templates/publisher/course_run_detail/_all.html
#: templates/publisher/course_run_detail/_drupal.html
msgid "to"
msgid "Estimated Effort"
msgstr ""
#: templates/publisher/course_run_detail/_all.html
......@@ -1895,48 +1873,19 @@ msgid "hours per week"
msgstr ""
#: templates/publisher/course_run_detail/_all.html
msgid "Course Languages"
msgstr ""
#: templates/publisher/course_run_detail/_all.html
msgid "Video Translation Languages"
msgstr ""
#: templates/publisher/course_run_detail/_all.html
msgid "About This Course"
msgstr ""
#: templates/publisher/course_run_detail/_all.html
msgid "What You'll Learn"
msgstr ""
#: templates/publisher/course_run_detail/_all.html
msgid "Learner Testimonial"
msgstr ""
#: templates/publisher/course_run_detail/_all.html
msgid "Syllabus"
msgstr ""
#: templates/publisher/course_run_detail/_all.html
msgid "Search Engine Optimization Review"
msgid "Course content language"
msgstr ""
#: templates/publisher/course_run_detail/_all.html
msgid "Top 10 Keywords"
msgid "Video Language Transcript"
msgstr ""
#: templates/publisher/course_run_detail/_all.html
msgid "edX Username or email address of Course Team Admin(s)"
msgid "Language spoken in course videos"
msgstr ""
#: templates/publisher/course_run_detail/_all.html
msgid ""
"edX Username or email address of additional course team members (Staff)"
msgstr ""
#: templates/publisher/course_run_detail/_all.html
msgid "Additional Notes"
msgid "Course Length (Weeks)"
msgstr ""
#: templates/publisher/course_run_detail/_approval_widget.html
......@@ -1948,6 +1897,11 @@ msgid "CHANGE"
msgstr ""
#: templates/publisher/course_run_detail/_cat.html
#: templates/publisher/course_run_detail/_drupal.html
msgid "Course ID"
msgstr ""
#: templates/publisher/course_run_detail/_cat.html
msgid "Course Type"
msgstr ""
......@@ -1960,6 +1914,12 @@ msgid "Credit Provider"
msgstr ""
#: templates/publisher/course_run_detail/_credit_seat.html
#: templates/publisher/course_run_detail/_drupal.html
#: templates/publisher/course_run_detail/_seats.html
msgid "Price"
msgstr ""
#: templates/publisher/course_run_detail/_credit_seat.html
#: templates/publisher/course_run_detail/_seats.html
msgid "Currency"
msgstr ""
......@@ -1994,24 +1954,15 @@ msgid "XSeries"
msgstr ""
#: templates/publisher/course_run_detail/_drupal.html
#: templates/publisher/course_run_detail/_salesforce.html
#: templates/publisher/course_run_detail/_studio.html
#: templates/publisher/dashboard/_studio_requests.html
msgid "Start Date"
msgstr ""
#: templates/publisher/course_run_detail/_drupal.html
#: templates/publisher/course_run_detail/_salesforce.html
#: templates/publisher/course_run_detail/_studio.html
msgid "End Date"
msgid "Self Paced"
msgstr ""
#: templates/publisher/course_run_detail/_drupal.html
msgid "Self Paced"
msgid "Staff"
msgstr ""
#: templates/publisher/course_run_detail/_drupal.html
msgid "Staff"
msgid "to"
msgstr ""
#: templates/publisher/course_run_detail/_drupal.html
......@@ -2159,6 +2110,10 @@ msgstr ""
msgid "Enrollment End Date"
msgstr ""
#: templates/publisher/course_run_detail/_studio.html
msgid "Pacing Type"
msgstr ""
#: templates/publisher/course_runs_list.html
msgid "Course Run List"
msgstr ""
......
......@@ -7,14 +7,14 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-02-15 15:52+0500\n"
"POT-Creation-Date: 2017-02-16 14:33+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-02-15 15:52+0500\n"
"POT-Creation-Date: 2017-02-16 14:33+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
......
......@@ -572,3 +572,24 @@
}
}
}
.course-staff {
display: inline-block;
margin-top: 10px;
img {
@include float(left);
@include margin-right(10px);
width: 70px;
height: 70px;
}
.staff-detail {
@include float(left);
}
.name {
color: #169BD5;
}
.organization{
font-weight: 600;
}
}
......@@ -102,7 +102,7 @@
{% trans "Video Translations" %}
{% include "publisher/course_run_detail/_clipboard.html" %}
</div>
<div class="copy">{{ object.video_languages }}</div>
<div class="copy">{{ object.transcript_languages }}</div>
</div>
<div class="info-item">
<div class="heading">
......
{% load i18n %}
{% if field %}
{{ field }}
{% else %}
{% trans "empty" %}
{% 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