Commit b032a2f6 by tasawernawaz Committed by Tasawer Nawaz

Fix console error on course run page ECOM-7116

parent bd3f45fe
...@@ -23,4 +23,9 @@ function showDiff($object, $historyObject, $outputDiv) { ...@@ -23,4 +23,9 @@ function showDiff($object, $historyObject, $outputDiv) {
$outputDiv.show(); $outputDiv.show();
} }
function showDiffCourseDetails(currentObject, historyObject, $outputDiv) {
var d = dmp.diff_main(currentObject, historyObject);
$outputDiv.html(dmp.diff_prettyHtml(d));
$outputDiv.show();
}
...@@ -261,7 +261,7 @@ function loadRevisionHistory(revisionUrl) { ...@@ -261,7 +261,7 @@ function loadRevisionHistory(revisionUrl) {
$.each(data, function(key, value) { $.each(data, function(key, value) {
var currentObject = $('.history-field-container').find('.' + key); var currentObject = $('.history-field-container').find('.' + key);
if (currentObject.length) { if (currentObject.length) {
showDiff(value, currentObject.text(), currentObject.siblings('.show-diff')); showDiffCourseDetails(value, currentObject.text(), currentObject.siblings('.show-diff'));
currentObject.hide(); currentObject.hide();
} }
}); });
...@@ -269,13 +269,6 @@ function loadRevisionHistory(revisionUrl) { ...@@ -269,13 +269,6 @@ function loadRevisionHistory(revisionUrl) {
}); });
} }
var dmp = new diff_match_patch();
function showDiff(currentObject, historyObject, $outputDiv) {
var d = dmp.diff_main(historyObject, currentObject);
$outputDiv.html(dmp.diff_prettyHtml(d));
$outputDiv.show();
}
function addModalError(errorMessage) { function addModalError(errorMessage) {
var errorHtml = '<div class="alert alert-error" role="alert" aria-labelledby="alert-title-error" tabindex="-1">' + var errorHtml = '<div class="alert alert-error" role="alert" aria-labelledby="alert-title-error" tabindex="-1">' +
'<div><p class="alert-copy">' + errorMessage + '</p></div></div>'; '<div><p class="alert-copy">' + errorMessage + '</p></div></div>';
......
...@@ -112,4 +112,5 @@ ...@@ -112,4 +112,5 @@
{% block extra_js %} {% block extra_js %}
<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/publisher.js' %}"></script> <script src="{% static 'js/publisher/publisher.js' %}"></script>
<script src="{% static 'js/publisher/comparing-objects.js' %}"></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