Bug 14189: Use keep_text for the authority header
authorJonathan Druart <jonathan.druart@koha-community.org>
Tue, 26 May 2015 10:10:50 +0000 (12:10 +0200)
committerTomas Cohen Arazi <tomascohen@theke.io>
Tue, 7 Jul 2015 18:37:19 +0000 (15:37 -0300)
includes/authorities-search.inc already used the same behavior but with
another method.
For consistency it's better to have only 1 way to do that.

Test plan:
Go on the authority home page
Fill the input in the header and click on tab 'search all headings' and
'keyword search' and confirm that the text you have filled is kept.

I tested after applying the patch and the text is kept after removing the
part from authorities-search.inc. I also tried applying that jQuery solution
instead of my JS loop but could not get it to work for the other pages with
a reasonable ammount of effort.

Signed-off-by: Jonathan Druart <jonathan.druart@koha-community.org>
Signed-off-by: Eivin Giske Skaaren <eskaaren@yahoo.no>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
koha-tmpl/intranet-tmpl/prog/en/includes/authorities-search.inc

index 433c927..d7ce46d 100644 (file)
                 $("#header_search").tabs( "option", "selected", 2 );
             }
         }
-        $("#header_search input[type='text'], #header_search select").change(function() {
-            var myname = $(this).attr("name");
-            var myval  = $(this).val();
-            $("#header_search [name='" + myname + "']").val(myval);
-        });
     });
 //]]>
 </script>
@@ -58,7 +53,7 @@
             <option value="is">is exactly</option>
             [% END %]
         </select>
-        <input id="value_mainentry" type="text" name="value" value="[% value | html%]" />
+        <input id="value_mainentry" type="text" name="value" value="[% value | html%]" class="head-searchbox" />
         <select name="orderby">
             [% IF ( orderby == 'HeadingAsc' ) %]
             <option value="HeadingAsc" selected="selected">Heading A-Z</option>
             <option value="is">is exactly</option>
             [% END %]
         </select>
-        <input id="value_matchheading" type="text" name="value" value="[% value | html %]" />
+        <input id="value_matchheading" type="text" name="value" value="[% value | html %]" class="head-searchbox" />
         <select name="orderby">
             [% IF ( orderby == 'HeadingAsc' ) %]
             <option value="HeadingAsc" selected="selected">Heading A-Z</option>
             <option value="is">is exactly</option>
             [% END %]
         </select>
-        <input id="value_anywhere" type="text" name="value" value="[% value | html %]" />
+        <input id="value_anywhere" type="text" name="value" value="[% value | html %]" class="head-searchbox" />
         <select name="orderby">
             [% IF ( orderby == 'HeadingAsc' ) %]
             <option value="HeadingAsc" selected="selected">Heading A-Z</option>
     </form>
     </div>
     <ul>
-        <li><a href="#main_heading">Search main heading</a></li>
-        <li><a href="#matchheading_search">Search all headings</a></li>
-        <li><a href="#all_headings">Keyword search</a></li>
+        <li><a onclick="keep_text(0)" href="#main_heading">Search main heading</a></li>
+        <li><a onclick="keep_text(1)" href="#matchheading_search">Search all headings</a></li>
+        <li><a onclick="keep_text(2)" href="#all_headings">Keyword search</a></li>
     </ul>
 </div><!-- /header_search -->
 </div><!-- /gradient -->