Commit 60637f67 by Asad Azam Committed by AsadAzam

Fixed add instructor after deleting it once on course run edit page

parent 77a8cac9
...@@ -129,10 +129,15 @@ $(document).on('change', '#id_staff', function (e) { ...@@ -129,10 +129,15 @@ $(document).on('change', '#id_staff', function (e) {
$(document).on('click', '.selected-instructor a.delete', function (e) { $(document).on('click', '.selected-instructor a.delete', function (e) {
e.preventDefault(); e.preventDefault();
var id = this.id, var id = this.id,
option = $('#id_staff').find('option[value="' + id + '"]'); $staff = $('#id_staff'),
option = $staff.find('option[value="' + id + '"]');
option.prop("selected", false); // This condition is to check for the existence of id or uuid
if (option.length == 0) {
option = $staff.find('option:contains("' + id + '")');
}
option.remove();
this.closest('.selected-instructor, .instructor').remove(); this.closest('.selected-instructor, .instructor').remove();
$('.instructor-select').find('.select2-selection__choice').remove();
}); });
function renderSelectedInstructor(id, name, image, uuid) { function renderSelectedInstructor(id, name, image, 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