Bugzilla – Attachment 54763 Details for
Bug 16963
Remove the use of "onclick" from subscription add template
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 16963 - Remove the use of "onclick" from subscription add template
Bug-16963---Remove-the-use-of-onclick-from-subscri.patch (text/plain), 13.64 KB, created by
Jonathan Druart
on 2016-08-23 10:52:38 UTC
(
hide
)
Description:
Bug 16963 - Remove the use of "onclick" from subscription add template
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2016-08-23 10:52:38 UTC
Size:
13.64 KB
patch
obsolete
>From b3ed9e8ea81aeffa685806a0f2e171e893dff36c Mon Sep 17 00:00:00 2001 >From: Owen Leonard <oleonard@myacpl.org> >Date: Fri, 22 Jul 2016 11:32:54 -0400 >Subject: [PATCH] Bug 16963 - Remove the use of "onclick" from subscription add > template > >This patch removes the use of event attributes from the subscription add >template and the template for testing prediction patterns. Events are >now defined in the JavaScript. > >To test, go to Serials -> New subscription. > >- Test that the "Search for vendor," "Search for record," and "Create > record" links work correctly. >- Test the "Next" button without entering a vendor or a biblionumber. > You should be warned about selecting a vendor and biblionumber. >- After selecting a bibliographic record to link to the subscription, > click the "Next" button. The second section of the subscription add > form should be displayed. >- Under frequency, choose "1/day." >- Confirm that the "Show advanced pattern" link correctly toggles > display of the advanced pattern form. >- Under the advanced pattern form, test the "Modify pattern" button. It > should enable editing in the form. >- Test the "Cancel modifications" and "Save as new pattern" buttons. >- Test the "Test prediction pattern" button. > - In the "Prediction pattern" box, test that the checkboxes next to > each day of the week, when checked, trigger the corresponding issue > number to be marked as "not published." >- Finally, confirm that your subscription is saved correctly. > >Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com> > >Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >--- > .../en/modules/serials/showpredictionpattern.tt | 19 +++-- > .../prog/en/modules/serials/subscription-add.tt | 83 +++++++++++++++++----- > 2 files changed, 77 insertions(+), 25 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/showpredictionpattern.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/showpredictionpattern.tt >index da04563..e23f912 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/showpredictionpattern.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/showpredictionpattern.tt >@@ -20,25 +20,30 @@ > }); > } > } >+ $(document).ready(function(){ >+ $(".skipday").on("change",function(){ >+ Check_boxes( $(this).data("dow")); >+ }); >+ }); > //]]> > </script> > <p><em> > If there is a day (or more) in the week where issues are never > published, you can check corresponding boxes below. > </em></p> >- <input type="checkbox" id="monday" data-dow="1" onchange="Check_boxes(1);" /> >+ <input type="checkbox" id="monday" data-dow="1" class="skipday" /> > <label for="monday">Monday</label> >- <input type="checkbox" id="tuesday" data-dow="2" onchange="Check_boxes(2);" /> >+ <input type="checkbox" id="tuesday" data-dow="2" class="skipday" /> > <label for="tuesday">Tuesday</label> >- <input type="checkbox" id="wednesday" data-dow="3" onchange="Check_boxes(3);" /> >+ <input type="checkbox" id="wednesday" data-dow="3" class="skipday" /> > <label for="wednesday">Wednesday</label> >- <input type="checkbox" id="thursday" data-dow="4" onchange="Check_boxes(4);" /> >+ <input type="checkbox" id="thursday" data-dow="4" class="skipday" /> > <label for="thursday">Thursday</label> >- <input type="checkbox" id="friday" data-dow="5" onchange="Check_boxes(5);" /> >+ <input type="checkbox" id="friday" data-dow="5" class="skipday" /> > <label for="friday">Friday</label> >- <input type="checkbox" id="saturday" data-dow="6" onchange="Check_boxes(6);" /> >+ <input type="checkbox" id="saturday" data-dow="6" class="skipday" /> > <label for="saturday">Saturday</label> >- <input type="checkbox" id="sunday" data-dow="7" onchange="Check_boxes(7);" /> >+ <input type="checkbox" id="sunday" data-dow="7" class="skipday" /> > <label for="sunday">Sunday</label> > [% END %] > [% END %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tt >index 637c843..ffe890b 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tt >@@ -37,12 +37,12 @@ function addbiblioPopup(biblionumber) { > window.open(destination,'AddBiblioPopup','width=1024,height=768,toolbar=no,scrollbars=yes'); > } > >-function Plugin(f) >+function Plugin() > { > window.open('subscription-bib-search.pl','FindABibIndex','width=800,height=400,toolbar=no,scrollbars=yes'); > } > >-function FindAcqui(f) >+function FindAcqui() > { > window.open('acqui-search.pl','FindASupplier','width=800,height=400,toolbar=no,scrollbars=yes'); > } >@@ -192,10 +192,6 @@ function displaymoreoptions() { > } > } > >-function toggleAdvancedPattern() { >- $("#advancedpredictionpattern").toggle(); >-} >- > function modifyAdvancedPattern() { > $("#patternname").prop('readOnly', false).val(''); > $("#numberingmethod").prop('readOnly', false); >@@ -460,6 +456,54 @@ $(document).ready(function() { > [% END %] > > show_page_1(); >+ $("#subscription_add_form").on("submit",function(){ >+ return Check_page2(); >+ }); >+ $("#vendor_search").on("click",function(e){ >+ e.preventDefault(); >+ FindAcqui(); >+ }); >+ $("#record_search").on("click",function(e){ >+ e.preventDefault(); >+ Plugin(); >+ }); >+ $("#biblio_add_edit").on("click",function(e){ >+ e.preventDefault(); >+ if( $(this).data("biblionumber") ){ >+ addbiblioPopup( $(this).data("biblionumber") ); >+ } else { >+ addbiblioPopup(); >+ } >+ }); >+ $("#subscription_add_next").on("click",function(){ >+ if ( Check_page1() ){ >+ show_page_2(); >+ } >+ }); >+ $("#subscription_add_previous").on("click",function(){ >+ show_page_1(); >+ }); >+ $(".toggle_advanced_pattern").on("click",function(e){ >+ e.preventDefault(); >+ $("#advancedpredictionpattern").toggle(); >+ $(".toggle_advanced_pattern").toggle(); >+ }); >+ $("#modifyadvancedpatternbutton").on("click",function(e){ >+ e.preventDefault(); >+ modifyAdvancedPattern(); >+ }); >+ $("#restoreadvancedpatternbutton").on("click",function(e){ >+ e.preventDefault(); >+ restoreAdvancedPattern(); >+ }); >+ $("#saveadvancedpatternbutton").on("click",function(e){ >+ e.preventDefault(); >+ saveAdvancedPattern(); >+ }); >+ $("#testpatternbutton").on("click",function(e){ >+ e.preventDefault(); >+ testPredictionPattern(); >+ }); > }); > //]]> > </script> >@@ -474,7 +518,7 @@ $(document).ready(function() { > <div id="bd"> > <div class="yui-g"> > <h1>[% IF ( modify ) %] Modify subscription for <i>[% bibliotitle |html %]</i>[% ELSE %]Add a new subscription[% END %] (<span id="page_number">1/2</span>)</h1> >- <form method="post" name="f" action="/cgi-bin/koha/serials/subscription-add.pl" class="validated" onsubmit="return Check_page2();" > >+ <form method="post" id="subscription_add_form" name="f" action="/cgi-bin/koha/serials/subscription-add.pl" class="validated"> > [% IF ( modify ) %] > <input type="hidden" name="op" value="modsubscription" /> > <input type="hidden" name="subscriptionid" value="[% subscriptionid %]" /> >@@ -494,18 +538,18 @@ $(document).ready(function() { > [% END %] > <li> > <label for="aqbooksellerid">Vendor: </label> >- <input type="text" name="aqbooksellerid" id="aqbooksellerid" value="[% aqbooksellerid %]" size="8" /> (<input type="text" name="aqbooksellername" id="aqbooksellername" value="[% aqbooksellername %]" disabled="disabled" readonly="readonly" />) <a href="#" onclick="FindAcqui(f)">Search for a vendor</a> >+ <input type="text" name="aqbooksellerid" id="aqbooksellerid" value="[% aqbooksellerid %]" size="8" /> (<input type="text" name="aqbooksellername" id="aqbooksellername" value="[% aqbooksellername %]" disabled="disabled" readonly="readonly" />) <a href="#" id="vendor_search"><i class="fa fa-search"></i> Search for a vendor</a> > </li> > <li> > <label for="biblionumber" class="required" title="Subscriptions must be associated with a bibliographic record">Record:</label> > <input type="text" name="biblionumber" id="biblionumber" value="[% bibnum %]" size="8" /> > (<input type="text" name="title" value="[% bibliotitle %]" disabled="disabled" readonly="readonly" />) <span class="required" title="Subscriptions must be associated with a bibliographic record">Required</span> >- <div class="inputnote"> <a href="#" onclick="Plugin(f)">Search for record</a> >+ <div class="inputnote"> <a href="#" id="record_search"><i class="fa fa-search"></i> Search for record</a> > [% IF ( CAN_user_editcatalogue ) %] > [% IF ( modify ) %] >- | <a href="#" onclick="addbiblioPopup([% bibnum %]); return false;">Edit record</a> >+ | <a href="#" id="biblio_add_edit" data-biblionumber="[% bibnum %]"><i class="fa fa-pencil"></i> Edit record</a> > [% ELSE %] >- | <a href="#" onclick="addbiblioPopup(); return false;">Create record</a> >+ | <a href="#" id="biblio_add_edit"><i class="fa fa-plus"></i> Create record</a> > [% END %] > [% END %] > </div> >@@ -623,7 +667,7 @@ $(document).ready(function() { > </ol> > </fieldset> > <fieldset class="action"> >- <input type="button" value="Next >>" onclick="if ( Check_page1() ) show_page_2();" style="float:right;" /> >+ <input type="button" value="Next >>" id="subscription_add_next" style="float:right;" /> > </fieldset> > </div> > </div> >@@ -767,7 +811,10 @@ $(document).ready(function() { > </tbody> > </table> > </li> >- <li><a style="cursor:pointer" onclick="toggleAdvancedPattern();">Show/Hide advanced pattern</a></li> >+ <li> >+ <a href="#" class="toggle_advanced_pattern show_advanced_pattern"><i class="fa fa-plus-square"></i> Show advanced pattern</a> >+ <a href="#" style="display:none;" class="toggle_advanced_pattern hide_advanced_pattern"><i class="fa fa-minus-square"></i> Hide advanced pattern</a> >+ </li> > <div id="advancedpredictionpattern" style="display:none"> > <li> > <label for="patternname" class="required">Pattern name:</label> >@@ -851,9 +898,9 @@ $(document).ready(function() { > </tr> > </tbody> > </table> >- <input id="modifyadvancedpatternbutton" type="button" value="Modify pattern" onclick="modifyAdvancedPattern();" /> >- <input id="restoreadvancedpatternbutton" type="button" value="Cancel modifications" onclick="restoreAdvancedPattern();" style="display:none" /> >- <input id="saveadvancedpatternbutton" type="button" value="Save as new pattern" onclick="saveAdvancedPattern();" style="display:none" /> >+ <input id="modifyadvancedpatternbutton" type="button" value="Modify pattern" /> >+ <input id="restoreadvancedpatternbutton" type="button" value="Cancel modifications" style="display:none" /> >+ <input id="saveadvancedpatternbutton" type="button" value="Save as new pattern" style="display:none" /> > </div> > </ol> > </fieldset> >@@ -892,8 +939,8 @@ $(document).ready(function() { > [% END %] > > <fieldset class="action"> >- <input type="button" value="<< Previous" onclick="show_page_1();" style="float:left;"/> >- <input id="testpatternbutton" type="button" value="Test prediction pattern" onclick="testPredictionPattern();" /> >+ <input type="button" id="subscription_add_previous" value="<< Previous" style="float:left;"/> >+ <input id="testpatternbutton" type="button" value="Test prediction pattern" /> > <input type="submit" value="Save subscription" style="float:right;" accesskey="w" /> > </fieldset> > </div> >-- >2.8.1
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 16963
:
53662
|
54736
| 54763