Bugzilla – Attachment 50729 Details for
Bug 3534
Patron quick add form
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 3534 [Follow-up] Patron quick add form
Bug-3534-Follow-up-Patron-quick-add-form.patch (text/plain), 9.06 KB, created by
Owen Leonard
on 2016-04-26 16:18:06 UTC
(
hide
)
Description:
Bug 3534 [Follow-up] Patron quick add form
Filename:
MIME Type:
Creator:
Owen Leonard
Created:
2016-04-26 16:18:06 UTC
Size:
9.06 KB
patch
obsolete
>From 5d00045a2d043fbda43bc8329a056b0a97ddc573 Mon Sep 17 00:00:00 2001 >From: Owen Leonard <oleonard@myacpl.org> >Date: Tue, 26 Apr 2016 12:04:44 -0400 >Subject: [PATCH] Bug 3534 [Follow-up] Patron quick add form >Content-Type: text/plain; charset="utf-8" > >This follow-up move the full/quick add toggle control to the top of the >patron entry form, reformating it as a link with a Font Awesome icon > >The previous patch defined a new $(document).ready() block. This patch >moves that code into the existing $(document).ready() to keep things >organized. > >This patch also makes some minor corrections to the markup, converting >some single quotes in HTML to double, and correcting capitalization. > >To test, apply the patch and follow the original test plan. Confirm that >the toggle between full and brief form works correctly. >--- > .../prog/en/modules/members/memberentrygen.tt | 139 +++++++++++---------- > 1 file changed, 72 insertions(+), 67 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt >index a0979e7..6c37b45 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt >@@ -59,6 +59,41 @@ $(document).ready(function() { > mrform.hide(); > e.preventDefault(); > }); >+ >+ var toggle_quick_add = $(".toggle_quick_add"); >+ $(toggle_quick_add).click(function(e){ >+ toggle_quick_add.toggle(); >+ e.preventDefault(); >+ var toggle_to = ''; >+ var toggle_from = ''; >+ if( $("#entryform:visible").length ) { >+ toggle_to = "#quick_add_form label"; >+ toggle_from = "#entryform label"; >+ } else { >+ toggle_to="#entryform label"; >+ toggle_from = "#quick_add_form label"; >+ } >+ $(toggle_from).each(function() { >+ var input_label = $(this).attr('for'); >+ if ( input_label == 'sex-male' || input_label == 'sex-none' || input_label == 'sex-female' ) { >+ $(toggle_to+"[for='"+input_label+"']").next().prop('checked', $(this).next().prop('checked') ); >+ return; >+ } >+ if( $(this).next().val() != '' ) { $(toggle_to+"[for='"+input_label+"']").next().val( $(this).next().val() );} >+ }); >+ >+ $(".toggler").toggle(); >+ }); >+ >+ $(".save_quick_add").click(function(){ >+ $("#quick_add_form").validate(); >+ if( $("#quick_add_form").valid()){ >+ $('.toggle_quick_add').click(); >+ $('#entryform input[name="save"]').click(); >+ } >+ else {return false;} >+ }); >+ > }); > > function clear_entry(node) { >@@ -157,40 +192,6 @@ function select_user(borrowernumber, borrower) { > > hint.html(age_string); > } >-$(document).ready(function() { >- $(".toggle_quick_add").click(function(){ >- var toggle_to = ''; >- var toggle_from = ''; >- if( $("#entryform:visible").length ) { >- toggle_to = "#quick_add_form label"; >- toggle_from = "#entryform label"; >- } else { >- toggle_to="#entryform label"; >- toggle_from = "#quick_add_form label"; >- } >- $(toggle_from).each(function() { >- var input_label = $(this).attr('for'); >- if ( input_label == 'sex-male' || input_label == 'sex-none' || input_label == 'sex-female' ) { >- $(toggle_to+"[for='"+input_label+"']").next().prop('checked', $(this).next().prop('checked') ); >- return; >- } >- if( $(this).next().val() != '' ) { $(toggle_to+"[for='"+input_label+"']").next().val( $(this).next().val() );} >- }); >- >- $(".toggler").toggle(); >-// return false; >- }); >- >- >- $(".save_quick_add").click(function(){ >- $("#quick_add_form").validate(); >- if( $("#quick_add_form").valid()){ >- $('.toggle_quick_add').click(); >- $('#entryform input[name="save"]').click(); >- } >- else {return false;} >- }); >- }); > > var MSG_SEPARATOR = _("Separator must be / in field %s"); > var MSG_INCORRECT_DAY = _("Invalid day entered in field %s"); >@@ -239,6 +240,14 @@ $(document).ready(function() { > [% UNLESS ( no_add ) %] > <h1>[% IF ( opadd ) %]Add[% ELSIF ( opduplicate ) %]Duplicate[% ELSE %] Modify[% END %] patron [% IF (firstname) %][% firstname %] [% END %][% IF (surname) %][% surname %] [% END %]([%IF ( categoryname ) %][% categoryname %][% ELSE %][% IF ( I ) %]Organization[% END %][% IF ( A ) %]Adult[% END %][% IF ( C ) %]Child[% END %][% IF ( P ) %]Professional[% END %][% IF ( S ) %]Staff[% END %][% END %])</h1> > >+ [% IF quickadd && opadd %] >+ <a href="#" class="toggle_quick_add"><i class="fa fa-plus-square"></i> Show full form</a> >+ <a href="#" class="toggle_quick_add" style="display:none"><i class="fa fa-minus-square"></i> Show brief form</a> >+ [% ELSE %] >+ <a href="#" class="toggle_quick_add" style="display:none"><i class="fa fa-plus-square"></i> Show full form</a> >+ <a href="#" class="toggle_quick_add"><i class="fa fa-minus-square"></i> Show brief form</a> >+ [% END %] >+ > [% IF ( check_member ) %] > <div class="dialog alert"> > <h3>Duplicate patron record?</h3> >@@ -309,7 +318,7 @@ $(document).ready(function() { > [% END %] > > >-[% UNLESS ( check_member ) %]<form name="form" id="entryform" action="/cgi-bin/koha/members/memberentry.pl" method="post" autocomplete="off" class='toggler' > >+[% UNLESS ( check_member ) %]<form name="form" id="entryform" action="/cgi-bin/koha/members/memberentry.pl" method="post" autocomplete="off" class="toggler" > > <input type="hidden" name="nodouble" value="[% nodouble %]" /> [% END %] > <!-- field always hidden in different form (1,2,3) --> > <input type="hidden" name="BorrowerMandatoryField" value="[% BorrowerMandatoryField %]" /> >@@ -1182,9 +1191,6 @@ $(document).ready(function() { > > [% UNLESS ( check_member ) %] > <fieldset class="action"> >- [% IF quickadd && opadd %] >- <input type="button" class='toggle_quick_add' value="Quick-add/Full form" /> >- [% END %] > <input type="submit" name="save" onclick="return check_form_borrowers();" value="Save" /> > [% IF ( opadd ) %] > <a class="cancel" href="/cgi-bin/koha/members/member.pl">Cancel</a> >@@ -1197,35 +1203,34 @@ $(document).ready(function() { > </form> > > [% IF quickadd && opadd && !check_member %] >-<form id="quick_add_form" class='toggler'> >- <fieldset class="rows quick_add"><legend>Quick Add</legend> >- <ol id="quick_add_list"> >- </ol> >- </fieldset> >- >- <fieldset class="action"> >- <input type="button" class='toggle_quick_add' value="Quick-add/Full form"/> >- <input type="button" class="save_quick_add" value="Save" /> >- <a class="cancel" href="/cgi-bin/koha/members/member.pl">Cancel</a> >- </fieldset> >- >-</form> >-<script> >- $(document).ready(function () { >- $("#entryform").hide(); >- [% q_add_f = Koha.Preference('PatronQuickAddFields').split('\|') %] >- var qaddfields = "[% FOREACH field IN q_add_f.unique %][% field %] [% END %]"; >- $("#entryform label").each(function () { >- var input_label = $(this).attr('for'); >- if ( input_label == 'sex-female' ) { input_label='sex'; } >- else if ( input_label == 'btitle' ) { input_label='title'; } >- if( qaddfields.indexOf( input_label ) != -1 || $(this).attr('class') == 'required' ){ >- $(this).parent().clone().appendTo("#quick_add_list"); >- if( input_label == 'password') $("#entryform label[for='password2']").parent().clone().appendTo("#quick_add_list"); >- } >- }); >- }); >-</script> >+ <form id="quick_add_form" class="toggler"> >+ <fieldset class="rows quick_add"><legend>Quick add</legend> >+ <ol id="quick_add_list"> >+ </ol> >+ </fieldset> >+ >+ <fieldset class="action"> >+ <input type="button" class="save_quick_add" value="Save" /> >+ <a class="cancel" href="/cgi-bin/koha/members/member.pl">Cancel</a> >+ </fieldset> >+ >+ </form> >+ <script> >+ $(document).ready(function () { >+ $("#entryform").hide(); >+ [% q_add_f = Koha.Preference('PatronQuickAddFields').split('\|') %] >+ var qaddfields = "[% FOREACH field IN q_add_f.unique %][% field %] [% END %]"; >+ $("#entryform label").each(function () { >+ var input_label = $(this).attr('for'); >+ if ( input_label == 'sex-female' ) { input_label='sex'; } >+ else if ( input_label == 'btitle' ) { input_label='title'; } >+ if( qaddfields.indexOf( input_label ) != -1 || $(this).attr('class') == 'required' ){ >+ $(this).parent().clone().appendTo("#quick_add_list"); >+ if( input_label == 'password') $("#entryform label[for='password2']").parent().clone().appendTo("#quick_add_list"); >+ } >+ }); >+ }); >+ </script> > [% END %] > </div> > </div> >-- >2.1.4
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 3534
:
1396
|
50090
|
50091
|
50092
|
50093
|
50362
|
50410
|
50413
|
50414
|
50665
|
50666
|
50729
|
51382
|
51389
|
51445
|
51446
|
51960
|
51961
|
52192
|
52584
|
52585
|
52586
|
52934
|
52935
|
52936
|
52937
|
53109
|
53152
|
53171
|
53172
|
53173
|
53174
|
53175
|
84851