Commit 27d97022 by Waheed Ahmed

Added course details on detail page.

ECOM-6044
parent ceca1da3
......@@ -186,6 +186,13 @@ class Course(TimeStampedModel, ChangedByMixin):
def course_runs(self):
return self.publisher_course_runs.order_by('-created')
@property
def course_team_admin(self):
try:
return self.course_user_roles.get(role=PublisherUserRole.CourseTeam).user
except CourseUserRole.DoesNotExist:
return None
class CourseRun(TimeStampedModel, ChangedByMixin):
""" Publisher CourseRun model. It contains fields related to the course run intake form."""
......
......@@ -210,6 +210,16 @@ class CourseTests(TestCase):
self.assertEqual(self.course.course_runs.count(), 1)
def test_course_team_admin(self):
""" Verify that the course_team_admin property returns user if exist. """
self.assertIsNone(self.course2.course_team_admin)
factories.CourseUserRoleFactory(
course=self.course2, user=self.user1, role=PublisherUserRole.CourseTeam
)
self.assertEqual(self.user1, self.course2.course_team_admin)
class SeatTests(TestCase):
""" Tests for the publisher `Seat` model. """
......
......@@ -1614,6 +1614,24 @@ class CourseDetailViewTests(TestCase):
self.assertContains(response, 'Not yet created')
self.assertContains(response, reverse('publisher:publisher_course_run_detail', kwargs={'pk': course_run.id}))
def test_detail_page_data(self):
"""
Verify that user can see course details on detail page.
"""
factories.CourseUserRoleFactory(
course=self.course, user=self.user, role=PublisherUserRole.CourseTeam
)
self.user.groups.add(self.organization_extension.group)
assign_perm(OrganizationExtension.VIEW_COURSE, self.organization_extension.group, self.organization_extension)
response = self.client.get(self.detail_page_url)
self.assertContains(response, self.course.title)
self.assertContains(response, self.course.course_team_admin.full_name)
self.assertContains(response, self.organization_extension.organization.name)
self.assertContains(response, self.course.short_description)
self.assertContains(response, self.course.full_description)
self.assertContains(response, self.course.expected_learnings)
class CourseEditViewTests(TestCase):
""" Tests for the course edit view. """
......
......@@ -295,7 +295,7 @@ class CourseEditView(mixins.PublisherPermissionMixin, mixins.FormValidMixin, Upd
class CourseDetailView(mixins.LoginRequiredMixin, mixins.PublisherPermissionMixin, DetailView):
""" Course Detail View."""
model = Course
template_name = 'publisher/view_course_form.html'
template_name = 'publisher/course_detail.html'
permission = OrganizationExtension.VIEW_COURSE
def get_context_data(self, **kwargs):
......
......@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-01-20 12:41+0500\n"
"POT-Creation-Date: 2017-01-20 16:08+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"
......@@ -461,6 +461,7 @@ msgid "Organization Name"
msgstr ""
#: apps/publisher/forms.py templates/publisher/add_courserun_form.html
#: templates/publisher/course_detail.html
msgid "Course Title"
msgstr ""
......@@ -469,14 +470,17 @@ msgid "Course Number"
msgstr ""
#: apps/publisher/forms.py apps/publisher/models.py
#: templates/publisher/course_detail.html
msgid "Brief Description"
msgstr ""
#: apps/publisher/forms.py apps/publisher/models.py
#: templates/publisher/course_detail.html
msgid "Full Description"
msgstr ""
#: apps/publisher/forms.py apps/publisher/models.py
#: templates/publisher/course_detail.html
#: templates/publisher/course_run_detail/_all.html
msgid "Prerequisites"
msgstr ""
......@@ -593,7 +597,7 @@ msgstr ""
msgid "Level Type"
msgstr ""
#: apps/publisher/models.py
#: apps/publisher/models.py templates/publisher/course_detail.html
msgid "Expected Learnings"
msgstr ""
......@@ -908,8 +912,7 @@ msgid "Sign Out"
msgstr ""
#: templates/publisher/add_course_form.html
#: templates/publisher/course_form.html
#: templates/publisher/view_course_form.html
#: templates/publisher/course_detail.html templates/publisher/course_form.html
msgid "Course Form"
msgstr ""
......@@ -1471,6 +1474,37 @@ msgstr ""
msgid "Courses"
msgstr ""
#: templates/publisher/course_detail.html templates/publisher/courses.html
#: templates/publisher/dashboard/_in_progress.html
msgid "Institution"
msgstr ""
#: templates/publisher/course_detail.html
msgid "Course Team Admin"
msgstr ""
#: templates/publisher/course_detail.html
msgid "Primary Subject"
msgstr ""
#: templates/publisher/course_detail.html
msgid "Secondary Subject"
msgstr ""
#: templates/publisher/course_detail.html
msgid "Tertiary Subject"
msgstr ""
#: templates/publisher/course_detail.html
msgid "Course Image"
msgstr ""
#: templates/publisher/course_detail.html
#: templates/publisher/course_run_detail/_all.html
#: templates/publisher/course_run_detail/_salesforce.html
msgid "Course Level"
msgstr ""
#: templates/publisher/course_detail/_widgets.html
#: templates/publisher/course_run_detail/_approval_widget.html
msgid "EDIT"
......@@ -1630,11 +1664,6 @@ msgid "Video Translation Languages"
msgstr ""
#: templates/publisher/course_run_detail/_all.html
#: templates/publisher/course_run_detail/_salesforce.html
msgid "Course Level"
msgstr ""
#: templates/publisher/course_run_detail/_all.html
msgid "About This Course"
msgstr ""
......@@ -1943,11 +1972,6 @@ msgid "Looks like you haven't publish a course yet"
msgstr ""
#: templates/publisher/courses.html
#: templates/publisher/dashboard/_in_progress.html
msgid "Institution"
msgstr ""
#: templates/publisher/courses.html
msgid "Runs"
msgstr ""
......@@ -2228,15 +2252,3 @@ msgstr ""
#: templates/publisher/seat_form.html
msgid "Seat Form"
msgstr ""
#: templates/publisher/view_course_form.html
msgid "Base information"
msgstr ""
#: templates/publisher/view_course_form.html
msgid "INSTITUTION INFORMATION"
msgstr ""
#: templates/publisher/view_course_form.html
msgid "Course information"
msgstr ""
......@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-01-20 12:41+0500\n"
"POT-Creation-Date: 2017-01-20 16:08+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: 2017-01-20 12:41+0500\n"
"POT-Creation-Date: 2017-01-20 16:08+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"
......@@ -573,6 +573,7 @@ msgid "Organization Name"
msgstr "Örgänïzätïön Nämé Ⱡ'σяєм ιρѕυм ∂σłσя ѕιт αмє#"
#: apps/publisher/forms.py templates/publisher/add_courserun_form.html
#: templates/publisher/course_detail.html
msgid "Course Title"
msgstr "Çöürsé Tïtlé Ⱡ'σяєм ιρѕυм ∂σłσя ѕ#"
......@@ -581,14 +582,17 @@ msgid "Course Number"
msgstr "Çöürsé Nümßér Ⱡ'σяєм ιρѕυм ∂σłσя ѕι#"
#: apps/publisher/forms.py apps/publisher/models.py
#: templates/publisher/course_detail.html
msgid "Brief Description"
msgstr "Brïéf Désçrïptïön Ⱡ'σяєм ιρѕυм ∂σłσя ѕιт αмє#"
#: apps/publisher/forms.py apps/publisher/models.py
#: templates/publisher/course_detail.html
msgid "Full Description"
msgstr "Füll Désçrïptïön Ⱡ'σяєм ιρѕυм ∂σłσя ѕιт αм#"
#: apps/publisher/forms.py apps/publisher/models.py
#: templates/publisher/course_detail.html
#: templates/publisher/course_run_detail/_all.html
msgid "Prerequisites"
msgstr "Préréqüïsïtés Ⱡ'σяєм ιρѕυм ∂σłσя ѕι#"
......@@ -707,7 +711,7 @@ msgstr "Pärtnér Nämé Ⱡ'σяєм ιρѕυм ∂σłσя ѕ#"
msgid "Level Type"
msgstr "Lévél Týpé Ⱡ'σяєм ιρѕυм ∂σłσ#"
#: apps/publisher/models.py
#: apps/publisher/models.py templates/publisher/course_detail.html
msgid "Expected Learnings"
msgstr "Éxpéçtéd Léärnïngs Ⱡ'σяєм ιρѕυм ∂σłσя ѕιт αмєт#"
......@@ -1058,8 +1062,7 @@ msgid "Sign Out"
msgstr "Sïgn Öüt Ⱡ'σяєм ιρѕυм ∂#"
#: templates/publisher/add_course_form.html
#: templates/publisher/course_form.html
#: templates/publisher/view_course_form.html
#: templates/publisher/course_detail.html templates/publisher/course_form.html
msgid "Course Form"
msgstr "Çöürsé Förm Ⱡ'σяєм ιρѕυм ∂σłσя #"
......@@ -1799,6 +1802,37 @@ msgstr "Däshßöärd Ⱡ'σяєм ιρѕυм ∂σł#"
msgid "Courses"
msgstr "Çöürsés Ⱡ'σяєм ιρѕυм #"
#: templates/publisher/course_detail.html templates/publisher/courses.html
#: templates/publisher/dashboard/_in_progress.html
msgid "Institution"
msgstr "Ìnstïtütïön Ⱡ'σяєм ιρѕυм ∂σłσя #"
#: templates/publisher/course_detail.html
msgid "Course Team Admin"
msgstr "Çöürsé Téäm Àdmïn Ⱡ'σяєм ιρѕυм ∂σłσя ѕιт αмє#"
#: templates/publisher/course_detail.html
msgid "Primary Subject"
msgstr "Prïmärý Süßjéçt Ⱡ'σяєм ιρѕυм ∂σłσя ѕιт α#"
#: templates/publisher/course_detail.html
msgid "Secondary Subject"
msgstr "Séçöndärý Süßjéçt Ⱡ'σяєм ιρѕυм ∂σłσя ѕιт αмє#"
#: templates/publisher/course_detail.html
msgid "Tertiary Subject"
msgstr "Tértïärý Süßjéçt Ⱡ'σяєм ιρѕυм ∂σłσя ѕιт αм#"
#: templates/publisher/course_detail.html
msgid "Course Image"
msgstr "Çöürsé Ìmägé Ⱡ'σяєм ιρѕυм ∂σłσя ѕ#"
#: templates/publisher/course_detail.html
#: templates/publisher/course_run_detail/_all.html
#: templates/publisher/course_run_detail/_salesforce.html
msgid "Course Level"
msgstr "Çöürsé Lévél Ⱡ'σяєм ιρѕυм ∂σłσя ѕ#"
#: templates/publisher/course_detail/_widgets.html
#: templates/publisher/course_run_detail/_approval_widget.html
msgid "EDIT"
......@@ -1963,11 +1997,6 @@ msgid "Video Translation Languages"
msgstr "Vïdéö Tränslätïön Längüägés Ⱡ'σяєм ιρѕυм ∂σłσя ѕιт αмєт, ¢σηѕє#"
#: templates/publisher/course_run_detail/_all.html
#: templates/publisher/course_run_detail/_salesforce.html
msgid "Course Level"
msgstr "Çöürsé Lévél Ⱡ'σяєм ιρѕυм ∂σłσя ѕ#"
#: templates/publisher/course_run_detail/_all.html
msgid "About This Course"
msgstr "Àßöüt Thïs Çöürsé Ⱡ'σяєм ιρѕυм ∂σłσя ѕιт αмє#"
......@@ -2290,11 +2319,6 @@ msgstr ""
"¢σηѕє¢тєтυя #"
#: templates/publisher/courses.html
#: templates/publisher/dashboard/_in_progress.html
msgid "Institution"
msgstr "Ìnstïtütïön Ⱡ'σяєм ιρѕυм ∂σłσя #"
#: templates/publisher/courses.html
msgid "Runs"
msgstr "Rüns Ⱡ'σяєм ι#"
......@@ -2645,15 +2669,3 @@ msgstr ""
#: templates/publisher/seat_form.html
msgid "Seat Form"
msgstr "Séät Förm Ⱡ'σяєм ιρѕυм ∂σł#"
#: templates/publisher/view_course_form.html
msgid "Base information"
msgstr "Bäsé ïnförmätïön Ⱡ'σяєм ιρѕυм ∂σłσя ѕιт αм#"
#: templates/publisher/view_course_form.html
msgid "INSTITUTION INFORMATION"
msgstr "ÌNSTÌTÛTÌÖN ÌNFÖRMÀTÌÖN Ⱡ'σяєм ιρѕυм ∂σłσя ѕιт αмєт, ¢σ#"
#: templates/publisher/view_course_form.html
msgid "Course information"
msgstr "Çöürsé ïnförmätïön Ⱡ'σяєм ιρѕυм ∂σłσя ѕιт αмєт#"
......@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-01-20 12:41+0500\n"
"POT-Creation-Date: 2017-01-20 16:08+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"
......
......@@ -519,7 +519,7 @@ select {
}
.info-item {
margin-bottom: 15px;
margin-bottom: 20px;
.heading {
font-weight: bold;
......@@ -561,8 +561,7 @@ select {
}
.breadcrumb {
@include padding-left(0);
@include padding(8px, 15px, 8px, 15px);
@include padding(8px, 5px, 8px, 5px);
@include margin(0, 0, 0, 0);
list-style: none;
background: white;
......@@ -814,3 +813,12 @@ select {
.studio-link, .courserun-detail-link {
text-decoration: underline;
}
.course-image-heading {
margin-bottom: 10px;
}
.course-image {
width: 480px;
height: 200px;
}
{% extends 'publisher/base.html' %}
{% load i18n %}
{% block title %}
{% trans "Course Form" %}
{% endblock title %}
{% block page_content %}
{% include 'alert_messages.html' %}
<div class="layout-1t2t layout-flush publisher-container course-detail">
<main class="layout-col layout-col-b layout-col-b-custom">
<div class="course-information">
<div class="info-item">
<div class="heading">
{% trans "Institution" %}
{% include "publisher/course_run_detail/_clipboard.html" %}
</div>
<div class="copy">{{ object.organizations.first.name }}</div>
</div>
<div class="info-item">
<div class="heading">
{% trans "Course Team Admin" %}
{% include "publisher/course_run_detail/_clipboard.html" %}
</div>
<div class="copy">{{ object.course_team_admin.full_name }}</div>
</div>
<div class="info-item">
<div class="heading">
{% trans "Course Title" %}
{% include "publisher/course_run_detail/_clipboard.html" %}
</div>
<div class="copy">{{ object.title }}</div>
</div>
<div class="info-item">
<div class="heading">
{% trans "Brief Description" %}
{% include "publisher/course_run_detail/_clipboard.html" %}
</div>
<div class="copy">{{ object.short_description }}</div>
</div>
<div class="info-item">
<div class="heading">
{% trans "Full Description" %}
{% include "publisher/course_run_detail/_clipboard.html" %}
</div>
<div class="copy">{{ object.full_description }}</div>
</div>
<div class="info-item">
<div class="heading">
{% trans "Expected Learnings" %}
{% include "publisher/course_run_detail/_clipboard.html" %}
</div>
<div class="copy">{{ object.expected_learnings }}</div>
</div>
<div class="info-item">
<div class="heading">
{% trans "Primary Subject" %}
{% include "publisher/course_run_detail/_clipboard.html" %}
</div>
<div class="copy">{{ object.primary_subject }}</div>
</div>
<div class="info-item">
<div class="heading">
{% trans "Secondary Subject" %}
{% include "publisher/course_run_detail/_clipboard.html" %}
</div>
<div class="copy">{{ object.secondary_subject }}</div>
</div>
<div class="info-item">
<div class="heading">
{% trans "Tertiary Subject" %}
{% include "publisher/course_run_detail/_clipboard.html" %}
</div>
<div class="copy">{{ object.tertiary_subject }}</div>
</div>
<div class="info-item">
<div class="heading course-image-heading">
{% trans "Course Image" %}
</div>
{% if object.image %}
<img class="course-image" src="{{ object.image.url }}" alt="{% trans 'Course Image' %}">
{% endif %}
</div>
<div class="info-item">
<div class="heading">
{% trans "Prerequisites" %}
{% include "publisher/course_run_detail/_clipboard.html" %}
</div>
<div class="copy">{{ object.prerequisites }}</div>
</div>
<div class="info-item">
<div class="heading">{% trans "Course Level" %}
{% include "publisher/course_run_detail/_clipboard.html" %}
</div>
<div class="copy">{{ object.level_type }}</div>
</div>
</div>
</main>
<aside class="layout-col layout-col-a layout-col-a-custom">
{% include 'publisher/course_detail/_widgets.html' %}
</aside>
</div>
{% endblock %}
......@@ -30,7 +30,7 @@
<div class="studio-url">
<span class="studio-url-heading">{% trans "STUDIO URL" %} - </span>
{% if course_run.lms_course_id %}
<a class="studio-link" href="">{{ course_run.lms_course_id }}</a>
<a class="studio-link" href="#" target="_blank">{{ course_run.lms_course_id }}</a>
{% else %}
{% trans "Not yet created" %}
{% endif %}
......
{% extends 'publisher/base.html' %}
{% load i18n %}
{% block title %}
{% trans "Course Form" %}
{% endblock title %}
{% block page_content %}
{% include 'alert_messages.html' %}
<div class="layout-1t2t layout-flush publisher-container course-detail">
<main class="layout-col layout-col-b layout-col-b-custom">
<div class="layout-full layout">
<h2 class="layout-title">{% trans "Base information" %}</h2>
<div class="card course-form">
<div class="course-information">
<h4 class="hd-4">{% trans "Course Form" %}</h4>
<fieldset class="form-group grid-container grid-manual">
<div class="field-title">{% trans "INSTITUTION INFORMATION" %}</div>
<div class="row">
<div class="col col-6">
{{ object.get_group_institution }}
</div>
</div>
</fieldset>
</div>
</div>
</div>
<div class="layout-full layout">
<h2 class="layout-title">{% trans "Course information" %}</h2>
<div class="card course-form">
<div class="course-information">
<fieldset class="form-group">
<div class="field-row">
<div class="field-col">
<label class="field-label " for="title">{{ course_form.title.label }}</label>
{{ object.title }}
</div>
</div>
</fieldset>
</div>
</div>
</div>
</main>
<aside class="layout-col layout-col-a layout-col-a-custom">
{% include 'publisher/course_detail/_widgets.html' %}
</aside>
</div>
{% endblock %}
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