Lines 19-27
Link Here
|
19 |
#course_instructors { |
19 |
#course_instructors { |
20 |
float: left; |
20 |
float: left; |
21 |
} |
21 |
} |
22 |
.instructor_line { |
|
|
23 |
padding: 0.3em; |
24 |
} |
25 |
fieldset.rows label[for="find_instructor"] { |
22 |
fieldset.rows label[for="find_instructor"] { |
26 |
text-align: left; |
23 |
text-align: left; |
27 |
margin: 0; |
24 |
margin: 0; |
Lines 131-143
Link Here
|
131 |
<div id="course_instructors"> |
128 |
<div id="course_instructors"> |
132 |
<div id="instructors"> |
129 |
<div id="instructors"> |
133 |
[% FOREACH i IN instructors %] |
130 |
[% FOREACH i IN instructors %] |
134 |
<div class="instructor_line" id="borrower_[% i.borrowernumber | html %]"> |
131 |
<div class="patron-detail-autocomplete-selection" id="patron-detail-[% i.borrowernumber | html %]"> |
135 |
[% INCLUDE 'patron-title.inc' patron=i no_cardnumber=1 %] (<a href="#" class="removeInstructor"><i class="fa fa-trash-can"></i> Remove </a>) |
132 |
[% INCLUDE 'patron-title.inc' patron=i no_cardnumber=1 %] (<a href="#" class="removePatron"><i class="fa fa-trash-can"></i> Remove </a>) |
136 |
<input type="hidden" name="instructors" value="[% i.borrowernumber | html %]" /> |
133 |
<input type="hidden" name="instructors" value="[% i.borrowernumber | html %]" /> |
137 |
</div> |
134 |
</div> |
138 |
[% END %] |
135 |
[% END %] |
139 |
</div> |
136 |
</div> |
140 |
<div id="instructor_search" class="instructor_line"> |
137 |
<div id="instructor_search" class="patron-detail-autocomplete-selection"> |
141 |
<label for="find_instructor">Instructor search:</label> |
138 |
<label for="find_instructor">Instructor search:</label> |
142 |
<input autocomplete="off" id="find_instructor" type="text" style="width:150px" class="noEnterSubmit" /> |
139 |
<input autocomplete="off" id="find_instructor" type="text" style="width:150px" class="noEnterSubmit" /> |
143 |
</div> |
140 |
</div> |
Lines 199-246
Link Here
|
199 |
<script> |
196 |
<script> |
200 |
$(document).ready(function () { |
197 |
$(document).ready(function () { |
201 |
patron_autocomplete($("#find_instructor"), { |
198 |
patron_autocomplete($("#find_instructor"), { |
|
|
199 |
"on-select-add-to": { container: $("#instructors"), input_name: "instructors" }, |
202 |
"on-select-callback": function (event, ui) { |
200 |
"on-select-callback": function (event, ui) { |
203 |
AddInstructor($patron_to_html(ui.item, { display_cardnumber: false }), ui.item.patron_id); |
201 |
$("#find_instructor").val("").focus(); |
204 |
return false; |
|
|
205 |
}, |
202 |
}, |
206 |
}); |
203 |
}); |
207 |
|
204 |
$(".removePatron").on("click", function (e) { |
208 |
if (!$("#instructors").html()) { |
|
|
209 |
$("#course_instructors").hide(); |
210 |
} |
211 |
|
212 |
$("body").on("click", ".removeInstructor", function (e) { |
213 |
e.preventDefault(); |
205 |
e.preventDefault(); |
214 |
var divid = $(this).parent().attr("id"); |
206 |
$(this).closest('div[id^="patron-detail-"]').remove(); |
215 |
var borrowernumber = divid.replace("borrower_", ""); |
|
|
216 |
RemoveInstructor(borrowernumber); |
217 |
}); |
207 |
}); |
218 |
}); |
208 |
}); |
219 |
|
|
|
220 |
function AddInstructor(name, borrowernumber) { |
221 |
div = |
222 |
"<div class='instructor_line' id='borrower_" + |
223 |
borrowernumber + |
224 |
"'>" + |
225 |
(name ? name.escapeHtml() : "") + |
226 |
" ( <a href='#' class='removeInstructor'><i class='fa fa-trash-can'></i> " + |
227 |
_("Remove") + |
228 |
" </a> ) <input type='hidden' name='instructors' value='" + |
229 |
borrowernumber + |
230 |
"' /></div>"; |
231 |
$("#instructors").append(div); |
232 |
|
233 |
$("#find_instructor").val("").focus(); |
234 |
$("#course_instructors").show(); |
235 |
} |
236 |
|
237 |
function RemoveInstructor(borrowernumber) { |
238 |
$("#borrower_" + borrowernumber).remove(); |
239 |
|
240 |
if (!$("#instructors").html()) { |
241 |
$("#course_instructors").hide(800); |
242 |
} |
243 |
} |
244 |
</script> |
209 |
</script> |
245 |
[% END %] |
210 |
[% END %] |
246 |
[% END %] |
211 |
[% END %] |