Commit e04a1b30 by Awais Committed by Awais Qureshi

Implementing accept/reject changes button.

ECOM-7779
parent 5521f053
...@@ -7,7 +7,7 @@ msgid "" ...@@ -7,7 +7,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-05-15 19:22+0500\n" "POT-Creation-Date: 2017-05-17 15:46+0500\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
...@@ -1242,7 +1242,7 @@ msgstr "" ...@@ -1242,7 +1242,7 @@ msgstr ""
#: templates/publisher/_history_widget.html #: templates/publisher/_history_widget.html
#, python-format #, python-format
msgid "%(history_date)s&nbsp;by&nbsp;%(changed_by)s (Latest version)" msgid "%(history_date)s&nbsp;by&nbsp;%(changed_by)s (Latest)"
msgstr "" msgstr ""
#: templates/publisher/_history_widget.html #: templates/publisher/_history_widget.html
...@@ -1256,10 +1256,6 @@ msgid "Restore to this version" ...@@ -1256,10 +1256,6 @@ msgid "Restore to this version"
msgstr "" msgstr ""
#: templates/publisher/_history_widget.html #: templates/publisher/_history_widget.html
msgid "Open Selected Version"
msgstr ""
#: templates/publisher/_history_widget.html
msgid "Unable to revert the revision, Please try again later." msgid "Unable to revert the revision, Please try again later."
msgstr "" msgstr ""
...@@ -1534,6 +1530,11 @@ msgstr "" ...@@ -1534,6 +1530,11 @@ msgstr ""
msgid "Course Detail" msgid "Course Detail"
msgstr "" msgstr ""
#: templates/publisher/course_detail.html
#: templates/publisher/course_run_detail/_widgets.html
msgid "EDIT"
msgstr ""
#: templates/publisher/course_detail.html templates/publisher/courses.html #: templates/publisher/course_detail.html templates/publisher/courses.html
msgid "Institution" msgid "Institution"
msgstr "" msgstr ""
...@@ -1579,11 +1580,6 @@ msgid "" ...@@ -1579,11 +1580,6 @@ msgid ""
msgstr "" msgstr ""
#: templates/publisher/course_detail/_widgets.html #: templates/publisher/course_detail/_widgets.html
#: templates/publisher/course_run_detail/_widgets.html
msgid "EDIT"
msgstr ""
#: templates/publisher/course_detail/_widgets.html
msgid "COURSE RUNS" msgid "COURSE RUNS"
msgstr "" msgstr ""
......
...@@ -7,7 +7,7 @@ msgid "" ...@@ -7,7 +7,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-05-15 19:22+0500\n" "POT-Creation-Date: 2017-05-17 15:46+0500\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
......
...@@ -7,7 +7,7 @@ msgid "" ...@@ -7,7 +7,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-05-15 19:22+0500\n" "POT-Creation-Date: 2017-05-17 15:46+0500\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
...@@ -1419,10 +1419,10 @@ msgstr "RÉVÌSÌÖN HÌSTÖRÝ Ⱡ'σяєм ιρѕυм ∂σłσя ѕιт αм# ...@@ -1419,10 +1419,10 @@ msgstr "RÉVÌSÌÖN HÌSTÖRÝ Ⱡ'σяєм ιρѕυм ∂σłσя ѕιт αм#
#: templates/publisher/_history_widget.html #: templates/publisher/_history_widget.html
#, python-format #, python-format
msgid "%(history_date)s&nbsp;by&nbsp;%(changed_by)s (Latest version)" msgid "%(history_date)s&nbsp;by&nbsp;%(changed_by)s (Latest)"
msgstr "" msgstr ""
"%(history_date)s&nbsp;ßý&nbsp;%(changed_by)s (Lätést vérsïön) Ⱡ'σяєм ιρѕυм " "%(history_date)s&nbsp;ßý&nbsp;%(changed_by)s (Lätést) Ⱡ'σяєм ιρѕυм ∂σłσя ѕιт"
"∂σłσя ѕιт αмєт, ¢σηѕє¢т#" " αмєт, ¢σ#"
#: templates/publisher/_history_widget.html #: templates/publisher/_history_widget.html
#, python-format #, python-format
...@@ -1435,10 +1435,6 @@ msgid "Restore to this version" ...@@ -1435,10 +1435,6 @@ msgid "Restore to this version"
msgstr "Réstöré tö thïs vérsïön Ⱡ'σяєм ιρѕυм ∂σłσя ѕιт αмєт, ¢σ#" msgstr "Réstöré tö thïs vérsïön Ⱡ'σяєм ιρѕυм ∂σłσя ѕιт αмєт, ¢σ#"
#: templates/publisher/_history_widget.html #: templates/publisher/_history_widget.html
msgid "Open Selected Version"
msgstr "Öpén Séléçtéd Vérsïön Ⱡ'σяєм ιρѕυм ∂σłσя ѕιт αмєт, #"
#: templates/publisher/_history_widget.html
msgid "Unable to revert the revision, Please try again later." msgid "Unable to revert the revision, Please try again later."
msgstr "" msgstr ""
"Ûnäßlé tö révért thé révïsïön, Pléäsé trý ägäïn lätér. Ⱡ'σяєм ιρѕυм ∂σłσя " "Ûnäßlé tö révért thé révïsïön, Pléäsé trý ägäïn lätér. Ⱡ'σяєм ιρѕυм ∂σłσя "
...@@ -1797,6 +1793,11 @@ msgstr "Çöürsés Ⱡ'σяєм ιρѕυм #" ...@@ -1797,6 +1793,11 @@ msgstr "Çöürsés Ⱡ'σяєм ιρѕυм #"
msgid "Course Detail" msgid "Course Detail"
msgstr "Çöürsé Détäïl Ⱡ'σяєм ιρѕυм ∂σłσя ѕι#" msgstr "Çöürsé Détäïl Ⱡ'σяєм ιρѕυм ∂σłσя ѕι#"
#: templates/publisher/course_detail.html
#: templates/publisher/course_run_detail/_widgets.html
msgid "EDIT"
msgstr "ÉDÌT Ⱡ'σяєм ι#"
#: templates/publisher/course_detail.html templates/publisher/courses.html #: templates/publisher/course_detail.html templates/publisher/courses.html
msgid "Institution" msgid "Institution"
msgstr "Ìnstïtütïön Ⱡ'σяєм ιρѕυм ∂σłσя #" msgstr "Ìnstïtütïön Ⱡ'σяєм ιρѕυм ∂σłσя #"
...@@ -1845,11 +1846,6 @@ msgstr "" ...@@ -1845,11 +1846,6 @@ msgstr ""
" Ⱡ'σяєм ιρѕυм ∂σłσя ѕιт αмєт, ¢σηѕє¢тєтυя α∂ιριѕι¢ιηg єłιт, ѕє∂ ∂σ єιυѕмσ∂ тємρσя ιη¢ι∂ι∂υηт υт łαвσяє єт ∂σłσяє мαgηα αłιqυα. υт єηιм α∂ мιηιм νєηιαм, qυιѕ ησѕтяυ∂ єχєя¢ιтαтιση υłłαм¢σ łαвσяιѕ ηιѕι υт αłιqυιρ єχ єα ¢σммσ∂σ ¢σηѕєqυαт. ∂υιѕ αυтє ιяυяє ∂σłσя ιη яєρяєнєη∂єяιт ιη νσłυρтαтє νєłιт єѕѕє ¢ιłłυм ∂σłσяє єυ ƒυgιαт ηυłłα#" " Ⱡ'σяєм ιρѕυм ∂σłσя ѕιт αмєт, ¢σηѕє¢тєтυя α∂ιριѕι¢ιηg єłιт, ѕє∂ ∂σ єιυѕмσ∂ тємρσя ιη¢ι∂ι∂υηт υт łαвσяє єт ∂σłσяє мαgηα αłιqυα. υт єηιм α∂ мιηιм νєηιαм, qυιѕ ησѕтяυ∂ єχєя¢ιтαтιση υłłαм¢σ łαвσяιѕ ηιѕι υт αłιqυιρ єχ єα ¢σммσ∂σ ¢σηѕєqυαт. ∂υιѕ αυтє ιяυяє ∂σłσя ιη яєρяєнєη∂єяιт ιη νσłυρтαтє νєłιт єѕѕє ¢ιłłυм ∂σłσяє єυ ƒυgιαт ηυłłα#"
#: templates/publisher/course_detail/_widgets.html #: templates/publisher/course_detail/_widgets.html
#: templates/publisher/course_run_detail/_widgets.html
msgid "EDIT"
msgstr "ÉDÌT Ⱡ'σяєм ι#"
#: templates/publisher/course_detail/_widgets.html
msgid "COURSE RUNS" msgid "COURSE RUNS"
msgstr "ÇÖÛRSÉ RÛNS Ⱡ'σяєм ιρѕυм ∂σłσя #" msgstr "ÇÖÛRSÉ RÛNS Ⱡ'σяєм ιρѕυм ∂σłσя #"
......
...@@ -7,7 +7,7 @@ msgid "" ...@@ -7,7 +7,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-05-15 19:22+0500\n" "POT-Creation-Date: 2017-05-17 15:46+0500\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
......
...@@ -19,3 +19,19 @@ function decodeEntities(encodedString) { ...@@ -19,3 +19,19 @@ function decodeEntities(encodedString) {
textArea.innerHTML = encodedString; textArea.innerHTML = encodedString;
return textArea.value; return textArea.value;
} }
function hasValidData(){
for (var i = 0; i < tinyMCE.editors.length; i++) {
var editor = tinyMCE.editors[i];
if (editor.dom.select('ins').length > 0) {
editor.focus();
return false;
}
if (editor.dom.select('del').length > 0) {
editor.focus();
return false;
}
}
return true;
}
...@@ -3,7 +3,7 @@ $(document).ready(function(){ ...@@ -3,7 +3,7 @@ $(document).ready(function(){
plugins: [ plugins: [
'link lists charactercount paste' 'link lists charactercount paste'
], ],
toolbar: 'undo redo | styleselect | bold italic | bullist numlist outdent indent | link anchor', toolbar: 'addbutton removebutton |undo redo | styleselect | bold italic | bullist numlist outdent indent | link anchor',
menubar: false, menubar: false,
statusbar: true, statusbar: true,
paste_remove_spans: true, paste_remove_spans: true,
...@@ -11,14 +11,73 @@ $(document).ready(function(){ ...@@ -11,14 +11,73 @@ $(document).ready(function(){
paste_as_text: true, paste_as_text: true,
paste_auto_cleanup_on_paste: true, paste_auto_cleanup_on_paste: true,
skin: false, skin: false,
forced_root_block : false forced_root_block : false,
setup: function(editor) {
function monitorNodeChange() {
var btn = this;
editor.on('NodeChange', function(e) {
var trackElem = getInsDelElement(e.element);
btn.disabled((trackElem == null) || (trackElem.nodeName != 'DEL' && trackElem.nodeName != 'INS'));
});
}
editor.addButton('addbutton', {
text: 'Accept',
icon: false,
onclick: function() {
//
var trackElem = getInsDelElement(editor.selection.getNode());
if (trackElem != null && trackElem.nodeName === 'INS') {
removeTrackingElement(trackElem);
}
if (trackElem.nodeName === 'DEL') {
trackElem.remove();
}
},
onpostrender: monitorNodeChange
});
editor.addButton('removebutton', {
text: 'Reject',
icon: false,
onclick: function() {
var trackElem = getInsDelElement(editor.selection.getNode());
if (trackElem != null && trackElem.nodeName === 'DEL') {
removeTrackingElement(trackElem);
}
if (trackElem.nodeName === 'INS') {
trackElem.remove();
}
},
onpostrender: monitorNodeChange
});
}
}; };
function getInsDelElement(elem)
{
if (elem == null)
{
return null;
}
else if (elem.nodeName === 'INS' || elem.nodeName === 'DEL')
{
return elem;
}
return getInsDelElement(elem.parentElement);
}
function removeTrackingElement(elem)
{
$(elem).replaceWith($(elem).contents());
}
tinymceConfig["selector"]="textarea"; tinymceConfig["selector"]="textarea";
tinymce.init(tinymceConfig); tinymce.init(tinymceConfig);
tinymceConfig["selector"]= "#id_title"; tinymceConfig["selector"]= "#id_title";
tinymceConfig["toolbar"] = false; tinymceConfig["toolbar"] = "addbutton removebutton";
tinymce.init(tinymceConfig); tinymce.init(tinymceConfig);
}); });
...@@ -47,11 +47,11 @@ ...@@ -47,11 +47,11 @@
.select-revision { .select-revision {
margin-right: 10px; margin-right: 10px;
width: 250px;
} }
.btn-revision { .btn-revision {
@include margin-left(0); @include margin-left(0);
margin-top: 8px;
} }
.btn-accept { .btn-accept {
......
...@@ -26,25 +26,25 @@ ...@@ -26,25 +26,25 @@
@include margin-left(0); @include margin-left(0);
@include padding-left(0); @include padding-left(0);
@include padding-right(0); @include padding-right(0);
width: 20%; width: 12%;
} }
.layout-col-container { .layout-col-container {
@include padding(20px, 20px, 20px, 20px); @include padding(20px, 20px, 20px, 20px);
@include margin-right(0); @include margin-right(0);
width: 80%; width: 88%;
} }
.layout-col-a-custom { .layout-col-a-custom {
@include margin-left(0); @include margin-left(0);
width: 50%; width: 45%;
} }
.layout-col-b-custom { .layout-col-b-custom {
@include margin-right(0); @include margin-right(0);
width: 50%; width: 55%;
} }
} }
...@@ -345,7 +345,7 @@ ...@@ -345,7 +345,7 @@
} }
.approval-widget, .course-widgets { .approval-widget, .course-widgets, .edit-history-widget {
.btn-course-edit, .btn-courserun-edit, .btn-change-state, .btn-preview, .btn-save-preview-url, .btn-edit-preview-url { .btn-course-edit, .btn-courserun-edit, .btn-change-state, .btn-preview, .btn-save-preview-url, .btn-edit-preview-url {
@include padding(2px, 20px, 3px, 20px); @include padding(2px, 20px, 3px, 20px);
...@@ -423,6 +423,20 @@ ...@@ -423,6 +423,20 @@
}//approval-widget (END) }//approval-widget (END)
.edit-history-widget {
position: relative;
#btn_course_edit {
@include right(4px);
position: absolute;
margin: 0 auto;
top: 42px;
font-weight: 600;
font-size: 0.875rem;
@include margin-right(50px);
}
}
.course-count-heading { .course-count-heading {
......
{% load i18n %} {% load i18n %}
<div class="margin-top20"> <div class="margin-top20">
<h5 class="hd-5 emphasized course-runs-heading">{% trans "REVISION HISTORY" %}</h5> <div class="info-item heading"><strong>{% trans "REVISION HISTORY" %}</strong></div>
<br>
<select id="id_select_revisions" class="select-revision"> <select id="id_select_revisions" class="select-revision">
{% for history in history_list %} {% for history in history_list %}
{% if forloop.first %} {% if forloop.first %}
<option value="{% url 'publisher:publisher_course_revision' course.id history.history_id %}"> <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 %} {% 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}} (Latest version) {{ history_date }}&nbsp;by&nbsp;{{ changed_by}} (Latest)
{% endblocktrans %} {% endblocktrans %}
</option> </option>
{% else %} {% else %}
...@@ -29,7 +28,6 @@ ...@@ -29,7 +28,6 @@
<span id="span_revert_revision" class="hidden"> <span id="span_revert_revision" class="hidden">
<a id="id_revert_revision" class="btn btn-brand btn-small btn-courserun-add btn-revision">{% trans "Restore to this version" %}</a> <a id="id_revert_revision" class="btn btn-brand btn-small btn-courserun-add btn-revision">{% trans "Restore to this version" %}</a>
</span> </span>
<a id="id_open_revision" class="btn btn-brand btn-small btn-courserun-add btn-revision" href="{% url 'publisher:publisher_course_revision' course.id history_list.first.history_id %}" target="_blank">{% trans "Open Selected Version" %}</a>
<div id="RevertRevisionAlert" class="alert alert-error hidden" role="alert">{% trans "Unable to revert the revision, Please try again later." %}</div> <div id="RevertRevisionAlert" class="alert alert-error hidden" role="alert">{% trans "Unable to revert the revision, Please try again later." %}</div>
</div> </div>
{% include 'publisher/_revert_confirmation.html' %} {% include 'publisher/_revert_confirmation.html' %}
...@@ -15,9 +15,30 @@ ...@@ -15,9 +15,30 @@
</div> </div>
</div> </div>
</div> </div>
<div class="layout-1t2t layout-flush publisher-container course-detail"> <div class="layout-1t2t layout-flush publisher-container course-detail">
<main class="layout-col layout-col-b layout-col-b-custom"> <main class="layout-col layout-col-b layout-col-b-custom">
<div class="course-information"> <div class="course-information">
<div class="edit-history-widget">
{% with object.history.all as history_list %}
{% if history_list.count > 1 %}
<div class="history-widget {% if not publisher_history_widget_feature %}hidden{% endif %}">
{% include 'publisher/_history_widget.html' %}
</div>
{% endif %}
{% endwith %}
{% if can_edit %}
{% url 'publisher:publisher_courses_edit' pk=object.id as edit_page_url %}
<a id="btn_course_edit" href="{% if add_warning_popup %}#{% else %}{{ edit_page_url }}{% endif %}" class="btn btn-neutral btn-course-edit">
{% trans "EDIT" %}
</a>
<div class="clearfix"></div>
{% endif %}
</div>
<div class="info-item"> <div class="info-item">
<div class="heading"> <div class="heading">
{% trans "Institution" %} {% trans "Institution" %}
......
{% load i18n %} {% load i18n %}
<div class="course-widgets"> <div class="course-widgets">
{% if can_edit %}
{% url 'publisher:publisher_courses_edit' pk=object.id as edit_page_url %}
<a id="btn_course_edit" href="{% if add_warning_popup %}#{% else %}{{ edit_page_url }}{% endif %}" class="btn btn-neutral btn-course-edit">
{% trans "EDIT" %}
</a>
<div class="clearfix"></div>
{% endif %}
<div class="clearfix"></div> <div class="clearfix"></div>
...@@ -44,13 +38,6 @@ ...@@ -44,13 +38,6 @@
{% endfor %} {% endfor %}
</div> </div>
{% with object.history.all as history_list %}
{% if history_list.count > 1 %}
<div class="history-widget {% if not publisher_history_widget_feature %}hidden{% endif %}">
{% include 'publisher/_history_widget.html' %}
</div>
{% endif %}
{% endwith %}
<div class="approval-widget {% if not publisher_approval_widget_feature %}hidden{% endif %}"> <div class="approval-widget {% if not publisher_approval_widget_feature %}hidden{% endif %}">
{% include 'publisher/_approval_widget.html' %} {% include 'publisher/_approval_widget.html' %}
</div> </div>
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
<strong>{% trans "Update Course." %}</strong> <strong>{% trans "Update Course." %}</strong>
{% trans "All required fields must be complete before this course can be sent for review." %} {% trans "All required fields must be complete before this course can be sent for review." %}
</p> </p>
<form class="form" method="post" action="" enctype="multipart/form-data">{% csrf_token %} <form id="frm_course_edit" class="form" method="post" action="" enctype="multipart/form-data">{% csrf_token %}
<input id="id_history_revision" type="hidden" value="{{ history_object.id }}"> <input id="id_history_revision" type="hidden" value="{{ history_object.id }}">
<div class="layout-full layout"> <div class="layout-full layout">
<div class="course-form"> <div class="course-form">
...@@ -568,7 +568,7 @@ ...@@ -568,7 +568,7 @@
<a class="btn-cancel" href="{% url 'publisher:publisher_course_detail' course.id %}"> <a class="btn-cancel" href="{% url 'publisher:publisher_course_detail' course.id %}">
{% trans "Cancel" %} {% trans "Cancel" %}
</a> </a>
<button class="btn-brand btn-base btn-save" type="submit">{% trans "UPDATE COURSE" %}</button> <button class="btn-brand btn-base btn-save" type="button" onclick="saveEditForm(); return false;">{% trans "UPDATE COURSE" %}</button>
</div> </div>
</div> </div>
...@@ -595,5 +595,15 @@ ...@@ -595,5 +595,15 @@
<script src="{% static 'bower_components/google-diff-match-patch/diff_match_patch.js' %}"></script> <script src="{% static 'bower_components/google-diff-match-patch/diff_match_patch.js' %}"></script>
<script src="{% static 'js/publisher/course-edit-history-compare.js' %}"></script> <script src="{% static 'js/publisher/course-edit-history-compare.js' %}"></script>
<script type="text/javascript">
function saveEditForm() {
if (hasValidData()) {
$('#frm_course_edit').submit();
}
}
</script>
{% endblock %} {% 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