Commit a00607f4 by attiyaishaque Committed by Attiya Ishaque

EDUCATOR-1265 Instructor bios would not disappear from course run when edited.

parent bc5b5bbe
...@@ -142,7 +142,7 @@ $(document).on('click', '.selected-instructor a.delete', function (e) { ...@@ -142,7 +142,7 @@ $(document).on('click', '.selected-instructor a.delete', function (e) {
}); });
function renderSelectedInstructor(id, name, image, uuid) { function renderSelectedInstructor(id, name, image, uuid) {
var instructorHtmlStart = '<div class="instructor"><div><img src="' + image + '"></div><div>', var instructorHtmlStart = '<div class="instructor" id= "instructor_'+ id +'"><div><img src="' + image + '"></div><div>',
instructorHtmlEnd = '<b>' + name + '</b></div></div>', instructorHtmlEnd = '<b>' + name + '</b></div></div>',
controlOptions = '<a class="delete" id="' + id + '"href="#"><i class="fa fa-trash-o fa-fw"></i></a>'; controlOptions = '<a class="delete" id="' + id + '"href="#"><i class="fa fa-trash-o fa-fw"></i></a>';
...@@ -179,7 +179,8 @@ function loadInstructor(uuid, editMode) { ...@@ -179,7 +179,8 @@ function loadInstructor(uuid, editMode) {
id, id,
label, label,
image_source, image_source,
name; name,
instructor_id;
$.getJSON({ $.getJSON({
url: url, url: url,
...@@ -197,11 +198,15 @@ function loadInstructor(uuid, editMode) { ...@@ -197,11 +198,15 @@ function loadInstructor(uuid, editMode) {
}).attr('selected', 'selected')); }).attr('selected', 'selected'));
if (editMode) { if (editMode) {
//before loading updated instructor it will remove old one. // Updating the existing instructor
$('#' + id).click(); instructor_id = $('#instructor_' + id);
instructor_id.find('img').attr('src', image_source);
instructor_id.find('b').text(name);
} }
else {
renderSelectedInstructor(id, name, image_source, uuid); renderSelectedInstructor(id, name, image_source, uuid);
} }
}
} }
}); });
......
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