Bugzilla – Attachment 24904 Details for
Bug 11534
impossible to remove instructors on course reserve
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 11534 - impossible to remove instructors on course reserve
Bug-11534---impossible-to-remove-instructors-on-co.patch (text/plain), 5.04 KB, created by
Kyle M Hall (khall)
on 2014-01-30 19:52:35 UTC
(
hide
)
Description:
Bug 11534 - impossible to remove instructors on course reserve
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2014-01-30 19:52:35 UTC
Size:
5.04 KB
patch
obsolete
>From fc09e0b0f384df54e3c81e962286239c19016b7d Mon Sep 17 00:00:00 2001 >From: Owen Leonard <oleonard@myacpl.org> >Date: Wed, 29 Jan 2014 12:52:51 -0500 >Subject: [PATCH] Bug 11534 - impossible to remove instructors on course reserve > >In some cases clicking the "remove" link to remove a course instructor >when editing a course reserves course doesn't work. I suspect this is >caused by leading zeroes in the card number. This patch refactors the >relevant function to fix the problem and to remove inline JavaScript >from generated markup. > >Other changes: > >- Make the "Remove" text translatable >- Re-order the first name and last name when added by JavaScript to >match the template's "surname, firstname" order. > >To test: > >1. If necessary, create or modify a patron to have a card number > with leading zeroes. >2. Go to Course reserves and add or edit a course. >3. If you are editing a course and there are existing instructors, click > the "remove" link. Nothing will happen. >4. Perform a patron search and choose one of the results. The name > should be added to the list of instructors in the format "surname, > firstname." >5. Click the "remove" link next to the patron name which was just added. > Nothing will happen. >6. Apply the patch and repeat step 4. The "remove" link should work. >7. Add an instructor and save the course reserve. Repeat steps 2 and 3. > The "remove" link should now work. > >To test the translation fix, after applying the patch run "translate >update [language code]" and confirm that the "Remove" string is listed >in the updated po file for course_reserves/course.tt. > >Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz> >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > .../prog/en/modules/course_reserves/course.tt | 31 +++++++++++++------- > 1 files changed, 20 insertions(+), 11 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/course_reserves/course.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/course_reserves/course.tt >index 1f5aca8..b9daa0a 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/course_reserves/course.tt >+++ b/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 = "<div id='borrower_" + cardnumber + "'>" + name + " ( <a href='#' onclick='RemoveInstructor(" + cardnumber + ");return false;'> Remove </a> ) <input type='hidden' name='instructors' value='" + cardnumber + "' /></div>"; >+ div = "<div id='borrower_" + cardnumber + "'>" + name + " ( <a href='#' class='removeInstructor'> " + _("Remove")+ " </a> ) <input type='hidden' name='instructors' value='" + cardnumber + "' /></div>"; > $('#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 @@ > <li> > <span class="label">Instructors:</span> > >- <fieldset> >- <div id="instructors"> >- [% FOREACH i IN instructors %] >- <div id="borrower_[% i.cardnumber %]"> >- [% i.surname %], [% i.firstname %] ( <a href='#' onclick='RemoveInstructor( [% i.cardnumber %] );'> Remove </a> ) >- <input type='hidden' name='instructors' value='[% i.cardnumber %]' /> >- </div> >- [% END %] >- </div> >+ <fieldset id="course_instructors"> >+ <div id="instructors">[% FOREACH i IN instructors %]<div id="borrower_[% i.cardnumber %]">[% i.surname %], [% i.firstname %] ( <a href="#" class="removeInstructor"> Remove </a> ) >+ <input type='hidden' name='instructors' value='[% i.cardnumber %]' /></div>[% END %]</div> > </fieldset> > > <fieldset> >-- >1.7.2.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 11534
:
24869
|
24871
|
24878
| 24904