[Rt-commit] rt branch, 4.2/sticky-simple-search, created. rt-4.0.5-283-g06756fc

Thomas Sibley trs at bestpractical.com
Wed Mar 28 14:32:12 EDT 2012


The branch, 4.2/sticky-simple-search has been created
        at  06756fc05b3637d7dc37bcab408778921075061e (commit)

- Log -----------------------------------------------------------------
commit e04a1e5af7727f7ce9152eb164c23478dcf52a9d
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Wed Mar 28 13:49:47 2012 -0400

    Preserve the current simple search query for easier refinement
    
    More times than I can count I've typed in "trs keyword" and then wanted
    to quickly refine the search by another keyword.
    
    This also kills the JS onfocus logic in favor of the much simpler HTML5
    placeholder attribute.

diff --git a/share/html/Elements/SimpleSearch b/share/html/Elements/SimpleSearch
index 533698d..0487010 100755
--- a/share/html/Elements/SimpleSearch
+++ b/share/html/Elements/SimpleSearch
@@ -46,8 +46,18 @@
 %#
 %# END BPS TAGGED BLOCK }}}
 <form action="<% RT->Config->Get('WebPath') %><% $SendTo %>" id="simple-search">
-  <input size="12" name="q" autocomplete="off" accesskey="0" class="field" value="<&|/l&>Search</&>..." onfocus="if (this.value=='<&|/l&>Search</&>...') this.value=''" />
+  <input size="12" name="q" autocomplete="off" accesskey="0" class="field" value="<% $value %>" placeholder="<% loc('Search') %>..." />
 </form>
+<%init>
+my $value = '';
+
+# The current simple search is sticky
+if (defined $m->request_args->{q}) {
+    my %request = ( q => $m->request_args->{q} );
+    RT::Interface::Web::DecodeARGS(\%request);
+    $value = $request{q};
+}
+</%init>
 <%ARGS>
 $SendTo => '/Search/Simple.html'
 </%ARGS>

commit 06756fc05b3637d7dc37bcab408778921075061e
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Wed Mar 28 14:26:43 2012 -0400

    Allow the browser to remember past simple searches

diff --git a/share/html/Elements/SimpleSearch b/share/html/Elements/SimpleSearch
index 0487010..588e572 100755
--- a/share/html/Elements/SimpleSearch
+++ b/share/html/Elements/SimpleSearch
@@ -46,7 +46,7 @@
 %#
 %# END BPS TAGGED BLOCK }}}
 <form action="<% RT->Config->Get('WebPath') %><% $SendTo %>" id="simple-search">
-  <input size="12" name="q" autocomplete="off" accesskey="0" class="field" value="<% $value %>" placeholder="<% loc('Search') %>..." />
+  <input size="12" name="q" accesskey="0" class="field" value="<% $value %>" placeholder="<% loc('Search') %>..." />
 </form>
 <%init>
 my $value = '';

-----------------------------------------------------------------------


More information about the Rt-commit mailing list