@@ -, +, @@ - Make the "Remove" text translatable - Re-order the first name and last name when added by JavaScript to with leading zeroes. the "remove" link. Nothing will happen. should be added to the list of instructors in the format "surname, firstname." Nothing will happen. The "remove" link should now work. --- .../prog/en/modules/course_reserves/course.tt | 31 +++++++++++++------- 1 files changed, 20 insertions(+), 11 deletions(-) --- a/koha-tmpl/intranet-tmpl/prog/en/modules/course_reserves/course.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/course_reserves/course.tt @@ -43,7 +43,7 @@ source: "/cgi-bin/koha/circ/ysearch.pl", minLength: 3, select: function( event, ui ) { - AddInstructor( ui.item.firstname + " " + ui.item.surname, ui.item.cardnumber ); + AddInstructor( ui.item.surname + ", " + ui.item.firstname, ui.item.cardnumber ); return false; } }) @@ -54,17 +54,32 @@ .appendTo( ul ); }; + if ( ! $('#instructors').html() ) { + $('#course_instructors').hide(); + } + + $("body").on("click",".removeInstructor",function(e){ + e.preventDefault(); + var divid = $(this).parent().attr("id"); + var cardnumber = divid.replace("borrower_",""); + RemoveInstructor(cardnumber); + }); }); function AddInstructor( name, cardnumber ) { - div = "
" + name + " ( Remove )
"; + div = "
" + name + " ( " + _("Remove")+ " )
"; $('#instructors').append( div ); $('#find_instructor').val('').focus(); + $('#course_instructors').show(); } function RemoveInstructor( cardnumber ) { $( '#borrower_' + cardnumber ).remove(); + + if ( ! $('#instructors').html() ) { + $('#course_instructors').hide( 800 ); + } } //]]> @@ -143,15 +158,9 @@
  • Instructors: -
    -
    - [% FOREACH i IN instructors %] -
    - [% i.surname %], [% i.firstname %] ( Remove ) - -
    - [% END %] -
    +
    +
    [% FOREACH i IN instructors %]
    [% i.surname %], [% i.firstname %] ( Remove ) +
    [% END %]
    --