Commit bb7aacac by Awais Committed by Awais Qureshi

Implement front-end dropdown for the revisions.

ECOM-6337
parent d88587f5
......@@ -1489,6 +1489,14 @@ class CourseDetailViewTests(TestCase):
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}))
self.assertContains(response, 'REVISION HISTORY')
revision_url = reverse(
'publisher:publisher_course_revision', args=[self.course.id, self.course.history.first().history_id]
)
self.assertContains(
response, '<option value="{revision_url}">Latest version</option>'.format(revision_url=revision_url)
)
def test_detail_page_data(self):
"""
......
......@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-02-01 18:58+0500\n"
"POT-Creation-Date: 2017-02-02 15:13+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"
......@@ -953,6 +953,23 @@ msgstr ""
msgid "Sign Out"
msgstr ""
#: templates/publisher/_history_widget.html
msgid "REVISION HISTORY"
msgstr ""
#: templates/publisher/_history_widget.html
msgid "Latest version"
msgstr ""
#: templates/publisher/_history_widget.html
#, python-format
msgid "%(history_date)s&nbsp;by&nbsp;%(changed_by)s"
msgstr ""
#: templates/publisher/_history_widget.html
msgid "Open Selected Version"
msgstr ""
#: templates/publisher/add_courserun_form.html
msgid "New Course Run"
msgstr ""
......
......@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-02-01 18:58+0500\n"
"POT-Creation-Date: 2017-02-02 15:13+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-02-01 18:58+0500\n"
"POT-Creation-Date: 2017-02-02 15:13+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"
......@@ -1108,6 +1108,23 @@ msgstr "ÖFF Ⱡ'σяєм#"
msgid "Sign Out"
msgstr "Sïgn Öüt Ⱡ'σяєм ιρѕυм ∂#"
#: templates/publisher/_history_widget.html
msgid "REVISION HISTORY"
msgstr "RÉVÌSÌÖN HÌSTÖRÝ Ⱡ'σяєм ιρѕυм ∂σłσя ѕιт αм#"
#: templates/publisher/_history_widget.html
msgid "Latest version"
msgstr "Lätést vérsïön Ⱡ'σяєм ιρѕυм ∂σłσя ѕιт#"
#: templates/publisher/_history_widget.html
#, python-format
msgid "%(history_date)s&nbsp;by&nbsp;%(changed_by)s"
msgstr "%(history_date)s&nbsp;ßý&nbsp;%(changed_by)s Ⱡ'σяєм ιρѕυм ∂σłσя ѕιт#"
#: templates/publisher/_history_widget.html
msgid "Open Selected Version"
msgstr "Öpén Séléçtéd Vérsïön Ⱡ'σяєм ιρѕυм ∂σłσя ѕιт αмєт, #"
#: templates/publisher/add_courserun_form.html
msgid "New Course Run"
msgstr "Néw Çöürsé Rün Ⱡ'σяєм ιρѕυм ∂σłσя ѕιт#"
......
......@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-02-01 18:58+0500\n"
"POT-Creation-Date: 2017-02-02 15:13+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"
......
......@@ -194,3 +194,8 @@ $(document).on('change', '#id_type', function (e) {
$seatBlock.show();
}
});
$(document).on('change', '#id_select_revisions', function (e) {
// on changing the revision from dropdown set the href of button.
$('#id_open_revision').prop("href", this.value);
});
{% load i18n %}
<div class="margin-top20">
<h5 class="hd-5 emphasized course-runs-heading">{% trans "REVISION HISTORY" %}</h5>
<br>
{% with object.history.all as history_list %}
<select id="id_select_revisions">
{% for history in history_list %}
{% if forloop.first %}
<option value="{% url 'publisher:publisher_course_revision' course.id history.history_id %}">{% trans "Latest version" %}</option>
{% else %}
<option value="{% url 'publisher:publisher_course_revision' course.id history.history_id %}">
{% blocktrans with history.history_date|date:'d-m-Y' as history_date and history.changed_by as changed_by trimmed %}
{{ history_date }}&nbsp;by&nbsp;{{ changed_by}}
{% endblocktrans %}
</option>
{% endif %}
{% endfor %}
</select>
<a id="id_open_revision" class="btn btn-brand btn-small btn-courserun-add" href="{% url 'publisher:publisher_course_revision' course.id history_list.first.history_id %}" target="_blank">{% trans "Open Selected Version" %}</a>
{% endwith %}
</div>
{% extends 'publisher/base.html' %}
{% load i18n %}
{% load staticfiles %}
{% block title %}
{% trans "Course Form" %}
{% endblock title %}
......@@ -99,3 +100,6 @@
</aside>
</div>
{% endblock %}
{% block extra_js %}
<script src="{% static 'js/publisher/publisher.js' %}"></script>
{% endblock %}
......@@ -39,4 +39,5 @@
</div>
{% endfor %}
</div>
{% include 'publisher/_history_widget.html' %}
</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