Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
course-discovery
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
course-discovery
Commits
b9b9f388
Commit
b9b9f388
authored
Jan 06, 2017
by
Waheed Ahmed
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Course run list widget.
ECOM-6043
parent
57945628
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
248 additions
and
62 deletions
+248
-62
course_discovery/apps/publisher/models.py
+8
-0
course_discovery/apps/publisher/tests/test_model.py
+19
-0
course_discovery/apps/publisher/tests/test_views.py
+14
-0
course_discovery/apps/publisher/views.py
+0
-1
course_discovery/conf/locale/en/LC_MESSAGES/django.mo
+0
-0
course_discovery/conf/locale/en/LC_MESSAGES/django.po
+31
-8
course_discovery/conf/locale/en/LC_MESSAGES/djangojs.mo
+0
-0
course_discovery/conf/locale/en/LC_MESSAGES/djangojs.po
+2
-2
course_discovery/conf/locale/eo/LC_MESSAGES/django.mo
+0
-0
course_discovery/conf/locale/eo/LC_MESSAGES/django.po
+34
-8
course_discovery/conf/locale/eo/LC_MESSAGES/djangojs.mo
+0
-0
course_discovery/conf/locale/eo/LC_MESSAGES/djangojs.po
+2
-2
course_discovery/static/sass/publisher/publisher.scss
+62
-6
course_discovery/templates/publisher/course_detail/_widgets.html
+42
-0
course_discovery/templates/publisher/view_course_form.html
+34
-35
No files found.
course_discovery/apps/publisher/models.py
View file @
b9b9f388
...
...
@@ -182,6 +182,10 @@ class Course(TimeStampedModel, ChangedByMixin):
for
user_role
in
organization
.
organization_user_roles
.
all
():
CourseUserRole
.
add_course_roles
(
self
,
user_role
.
role
,
user_role
.
user
)
@property
def
course_runs
(
self
):
return
self
.
publisher_course_runs
.
order_by
(
'-created'
)
class
CourseRun
(
TimeStampedModel
,
ChangedByMixin
):
""" Publisher CourseRun model. It contains fields related to the course run intake form."""
...
...
@@ -292,6 +296,10 @@ class CourseRun(TimeStampedModel, ChangedByMixin):
def
post_back_url
(
self
):
return
reverse
(
'publisher:publisher_course_runs_edit'
,
kwargs
=
{
'pk'
:
self
.
id
})
@property
def
created_by
(
self
):
return
self
.
history
.
order_by
(
'history_date'
)
.
first
()
.
history_user
# pylint: disable=no-member
class
Seat
(
TimeStampedModel
,
ChangedByMixin
):
""" Seat model. """
...
...
course_discovery/apps/publisher/tests/test_model.py
View file @
b9b9f388
...
...
@@ -59,6 +59,17 @@ class CourseRunTests(TestCase):
with
self
.
assertRaises
(
TransitionNotAllowed
):
self
.
course_run
.
change_state
(
target
=
State
.
PUBLISHED
)
def
test_created_by
(
self
):
""" Verify that property returns created_by. """
self
.
assertIsNone
(
self
.
course_run
.
created_by
)
user
=
UserFactory
()
history_object
=
self
.
course_run
.
history
.
first
()
history_object
.
history_user
=
user
history_object
.
save
()
self
.
assertEqual
(
self
.
course_run
.
created_by
,
user
)
class
CourseTests
(
TestCase
):
""" Tests for the publisher `Course` model. """
...
...
@@ -191,6 +202,14 @@ class CourseTests(TestCase):
self
.
course2
.
assign_organization_role
(
self
.
org_extension_2
.
organization
)
self
.
assertFalse
(
self
.
course2
.
course_user_roles
.
all
())
def
test_course_runs
(
self
):
""" Verify that property returns queryset of course runs. """
self
.
assertEqual
(
self
.
course
.
course_runs
.
count
(),
0
)
factories
.
CourseRunFactory
(
course
=
self
.
course
)
self
.
assertEqual
(
self
.
course
.
course_runs
.
count
(),
1
)
class
SeatTests
(
TestCase
):
""" Tests for the publisher `Seat` model. """
...
...
course_discovery/apps/publisher/tests/test_views.py
View file @
b9b9f388
...
...
@@ -1512,6 +1512,20 @@ class CourseDetailViewTests(TestCase):
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertEqual
(
response
.
context
[
'can_edit'
],
can_edit
)
def
test_details_page_with_course_runs
(
self
):
""" Test that user can see course runs on course detail page. """
self
.
user
.
groups
.
add
(
self
.
organization_extension
.
group
)
assign_perm
(
OrganizationExtension
.
VIEW_COURSE
,
self
.
organization_extension
.
group
,
self
.
organization_extension
)
course_run
=
factories
.
CourseRunFactory
(
course
=
self
.
course
)
response
=
self
.
client
.
get
(
self
.
detail_page_url
)
self
.
assertContains
(
response
,
'COURSE RUNS'
)
self
.
assertContains
(
response
,
'ADD RUN'
)
self
.
assertContains
(
response
,
'STUDIO URL -'
)
self
.
assertContains
(
response
,
'Not yet created'
)
self
.
assertContains
(
response
,
reverse
(
'publisher:publisher_course_run_detail'
,
kwargs
=
{
'pk'
:
course_run
.
id
}))
class
CourseEditViewTests
(
TestCase
):
""" Tests for the course edit view. """
...
...
course_discovery/apps/publisher/views.py
View file @
b9b9f388
...
...
@@ -280,7 +280,6 @@ class CourseDetailView(mixins.LoginRequiredMixin, mixins.PublisherPermissionMixi
def
get_context_data
(
self
,
**
kwargs
):
context
=
super
(
CourseDetailView
,
self
)
.
get_context_data
(
**
kwargs
)
context
[
'comment_object'
]
=
self
context
[
'can_edit'
]
=
mixins
.
check_course_organization_permission
(
self
.
request
.
user
,
self
.
object
,
OrganizationExtension
.
EDIT_COURSE
)
...
...
course_discovery/conf/locale/en/LC_MESSAGES/django.mo
View file @
b9b9f388
No preview for this file type
course_discovery/conf/locale/en/LC_MESSAGES/django.po
View file @
b9b9f388
...
...
@@ -7,14 +7,14 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-01-1
0 13:00
+0500\n"
"POT-Creation-Date: 2017-01-1
1 19:39
+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
...
...
@@ -1254,10 +1254,38 @@ msgid "Dashboard"
msgstr ""
#: templates/publisher/base.html templates/publisher/courses.html
#: templates/publisher/view_course_form.html
msgid "Courses"
msgstr ""
#: templates/publisher/course_detail/_widgets.html
#: templates/publisher/course_run_detail/_approval_widget.html
msgid "EDIT"
msgstr ""
#: templates/publisher/course_detail/_widgets.html
msgid "COURSE RUNS"
msgstr ""
#: templates/publisher/course_detail/_widgets.html
msgid "ADD RUN"
msgstr ""
#: templates/publisher/course_detail/_widgets.html
#, python-format
msgid ""
"\n"
" Created %(created_date)s at %(created_time)s by %(created_by)s\n"
" "
msgstr ""
#: templates/publisher/course_detail/_widgets.html
msgid "STUDIO URL"
msgstr ""
#: templates/publisher/course_detail/_widgets.html
msgid "Not yet created"
msgstr ""
#: templates/publisher/course_form.html
msgid "UPDATE COURSE"
msgstr ""
...
...
@@ -1440,11 +1468,6 @@ msgid "Additional Notes"
msgstr ""
#: templates/publisher/course_run_detail/_approval_widget.html
#: templates/publisher/view_course_form.html
msgid "EDIT"
msgstr ""
#: templates/publisher/course_run_detail/_approval_widget.html
msgid "change owner"
msgstr ""
...
...
course_discovery/conf/locale/en/LC_MESSAGES/djangojs.mo
View file @
b9b9f388
No preview for this file type
course_discovery/conf/locale/en/LC_MESSAGES/djangojs.po
View file @
b9b9f388
...
...
@@ -7,14 +7,14 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-01-1
0 13:00
+0500\n"
"POT-Creation-Date: 2017-01-1
1 19:39
+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"
...
...
course_discovery/conf/locale/eo/LC_MESSAGES/django.mo
View file @
b9b9f388
No preview for this file type
course_discovery/conf/locale/eo/LC_MESSAGES/django.po
View file @
b9b9f388
...
...
@@ -7,14 +7,14 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-01-1
0 13:00
+0500\n"
"POT-Creation-Date: 2017-01-1
1 19:39
+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
...
...
@@ -1525,10 +1525,41 @@ msgid "Dashboard"
msgstr "Däshßöärd Ⱡ'σяєм ιρѕυм ∂σł#"
#: templates/publisher/base.html templates/publisher/courses.html
#: templates/publisher/view_course_form.html
msgid "Courses"
msgstr "Çöürsés Ⱡ'σяєм ιρѕυм #"
#: templates/publisher/course_detail/_widgets.html
#: templates/publisher/course_run_detail/_approval_widget.html
msgid "EDIT"
msgstr "ÉDÌT Ⱡ'σяєм ι#"
#: templates/publisher/course_detail/_widgets.html
msgid "COURSE RUNS"
msgstr "ÇÖÛRSÉ RÛNS Ⱡ'σяєм ιρѕυм ∂σłσя #"
#: templates/publisher/course_detail/_widgets.html
msgid "ADD RUN"
msgstr "ÀDD RÛN Ⱡ'σяєм ιρѕυм #"
#: templates/publisher/course_detail/_widgets.html
#, python-format
msgid ""
"\n"
" Created %(created_date)s at %(created_time)s by %(created_by)s\n"
" "
msgstr ""
"\n"
" Çréätéd %(created_date)s ät %(created_time)s ßý %(created_by)s\n"
" Ⱡ'σяєм ιρѕυм ∂σłσя ѕιт αмєт, ¢σηѕє¢тєтυя#"
#: templates/publisher/course_detail/_widgets.html
msgid "STUDIO URL"
msgstr "STÛDÌÖ ÛRL Ⱡ'σяєм ιρѕυм ∂σłσ#"
#: templates/publisher/course_detail/_widgets.html
msgid "Not yet created"
msgstr "Nöt ýét çréätéd Ⱡ'σяєм ιρѕυм ∂σłσя ѕιт α#"
#: templates/publisher/course_form.html
msgid "UPDATE COURSE"
msgstr "ÛPDÀTÉ ÇÖÛRSÉ Ⱡ'σяєм ιρѕυм ∂σłσя ѕι#"
...
...
@@ -1718,11 +1749,6 @@ msgid "Additional Notes"
msgstr "Àddïtïönäl Nötés Ⱡ'σяєм ιρѕυм ∂σłσя ѕιт αм#"
#: templates/publisher/course_run_detail/_approval_widget.html
#: templates/publisher/view_course_form.html
msgid "EDIT"
msgstr "ÉDÌT Ⱡ'σяєм ι#"
#: templates/publisher/course_run_detail/_approval_widget.html
msgid "change owner"
msgstr "çhängé öwnér Ⱡ'σяєм ιρѕυм ∂σłσя ѕ#"
...
...
course_discovery/conf/locale/eo/LC_MESSAGES/djangojs.mo
View file @
b9b9f388
No preview for this file type
course_discovery/conf/locale/eo/LC_MESSAGES/djangojs.po
View file @
b9b9f388
...
...
@@ -7,14 +7,14 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-01-1
0 13:00
+0500\n"
"POT-Creation-Date: 2017-01-1
1 19:39
+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
...
...
course_discovery/static/sass/publisher/publisher.scss
View file @
b9b9f388
...
...
@@ -241,7 +241,8 @@ $light-gray: rgba(204, 204, 204, 1);
.layout-col-container
{
@include
padding
(
20px
,
20px
,
20px
,
20px
);
width
:
78%
;
@include
margin-right
(
0
);
width
:
80%
;
}
.menu-list
{
...
...
@@ -266,6 +267,16 @@ $light-gray: rgba(204, 204, 204, 1);
}
}
}
.layout-col-a-custom
{
@include
margin-left
(
0
);
width
:
50%
;
}
.layout-col-b-custom
{
@include
margin-right
(
0
);
width
:
50%
;
}
}
.tabs
{
...
...
@@ -646,7 +657,7 @@ select {
display
:
none
;
}
.approval-widget
{
.approval-widget
,
.course-widgets
{
.btn-course-edit
,
.btn-courserun-edit
{
@include
padding
(
2px
,
20px
,
3px
,
20px
);
...
...
@@ -654,6 +665,7 @@ select {
font-weight
:
400
;
font-size
:
14px
;
background
:
white
;
border-color
:
black
;
border-radius
:
5px
;
&
:hover
,
&
:focus
{
...
...
@@ -698,9 +710,11 @@ select {
}
}
.btn-course-edit
{
.btn-course-edit
,
.btn-courserun-edit
{
@include
padding
(
2px
,
20px
,
3px
,
20px
);
@include
float
(
right
);
background-color
:
#169bd5
;
border-color
:
#169bd5
;
font-weight
:
400
;
font-size
:
14px
;
border-radius
:
5px
;
...
...
@@ -709,6 +723,16 @@ select {
.btn-course-add
{
@include
padding
(
4px
,
20px
,
4px
,
20px
);
@include
margin-left
(
12px
);
background-color
:
#169bd5
;
border-color
:
#169bd5
;
border-radius
:
5px
;
}
.btn-courserun-add
{
@include
padding
(
3px
,
16px
,
3px
,
16px
);
@include
margin-left
(
10px
);
background-color
:
#169bd5
;
border-color
:
#169bd5
;
border-radius
:
5px
;
}
...
...
@@ -718,6 +742,10 @@ select {
font-size
:
24px
;
}
.course-runs-heading
{
display
:
inline-block
;
}
.coursesTable
{
@include
padding
(
20px
,
20px
,
20px
,
20px
);
border
:
2px
solid
#169bd5
;
...
...
@@ -742,7 +770,35 @@ select {
}
.btn-save
{
background-color
:
#169BD5
;
border-radius
:
5px
;
padding
:
10px
;
background-color
:
#169BD5
;
border-radius
:
5px
;
padding
:
10px
;
}
.course-run-list
{
.layout-reversed.course-run-item
{
margin-bottom
:
5px
;
font-size
:
14px
;
.created-by
{
@include
margin
(
0
,
0
,
0
,
0
);
width
:
25%
;
font-size
:
12px
;
}
.course-run-details
{
@include
margin
(
0
,
0
,
0
,
0
);
width
:
75%
;
}
}
}
.studio-url-heading
{
color
:
#999999
;
font-weight
:
600
;
}
.studio-link
,
.courserun-detail-link
{
text-decoration
:
underline
;
}
course_discovery/templates/publisher/course_detail/_widgets.html
0 → 100644
View file @
b9b9f388
{% load i18n %}
<div
class=
"course-widgets"
>
{% if can_edit %}
<a
href=
"{% url 'publisher:publisher_courses_edit' pk=object.id %}"
class=
"btn btn-neutral btn-courserun-edit"
>
{% trans "EDIT" %}
</a>
<div
class=
"clearfix"
></div>
{% endif %}
<div
class=
"margin-top20"
>
<h5
class=
"hd-5 emphasized course-runs-heading"
>
{% trans "COURSE RUNS" %}
</h5>
<a
href=
"{% url 'publisher:publisher_course_runs_new' parent_course_id=object.id %}"
class=
"btn btn-brand btn-small btn-courserun-add"
>
{% trans "ADD RUN" %}
</a>
</div>
<div
class=
"course-run-list"
>
{% for course_run in course.course_runs %}
<div
class=
"layout-1t2t layout-reversed course-run-item"
>
<div
class=
"layout-col layout-col-a created-by"
>
{% blocktrans with created_date=course_run.created.date created_time=course_run.created.time created_by=course_run.created_by.full_name %}
Created {{ created_date }} at {{ created_time }} by {{ created_by }}
{% endblocktrans %}
</div>
<div
class=
"layout-col layout-col-b course-run-details"
>
<div
class=
"courserun-details"
>
<a
class=
"courserun-detail-link"
href=
"{% url 'publisher:publisher_course_run_detail' pk=course_run.id %}"
>
{{ course_run.start.date }} - {{ course_run.get_pacing_type_display }}
</a>
</div>
<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>
{% else %}
{% trans "Not yet created" %}
{% endif %}
</div>
</div>
</div>
{% endfor %}
</div>
</div>
course_discovery/templates/publisher/view_course_form.html
View file @
b9b9f388
...
...
@@ -7,45 +7,44 @@
{% block page_content %}
{% include 'alert_messages.html' %}
<div
class=
"approval-widget"
>
{% if can_edit %}
<a
href=
"{% url 'publisher:publisher_courses_edit' pk=object.id %}"
class=
"btn btn-neutral btn-course-edit"
>
{% trans "EDIT" %}
</a>
<div
class=
"clearfix"
></div>
{% endif %}
</div>
<div
class=
"layout-full publisher-layout layout"
>
<h2
class=
"layout-title"
>
{% trans "Base information" %}
</h2>
<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
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>
</
fieldset
>
</
div
>
</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
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>
</div
>
</fieldset
>
</fieldset
>
</div
>
</div>
</div>
</div>
</main>
<aside
class=
"layout-col layout-col-a layout-col-a-custom"
>
{% include 'publisher/course_detail/_widgets.html' %}
</aside>
</div>
{% endblock %}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment