[open-ils-commits] [GIT] Evergreen ILS branch master updated. 87e504ff83c87b05c7ecce744315404abf3ae0d7

Evergreen Git git at git.evergreen-ils.org
Wed Mar 7 14:07:39 EST 2012


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Evergreen ILS".

The branch, master has been updated
       via  87e504ff83c87b05c7ecce744315404abf3ae0d7 (commit)
      from  15e6089f601dd12bfc11d4315ce46da9e56ad1e4 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 87e504ff83c87b05c7ecce744315404abf3ae0d7
Author: Dan Scott <dscott at laurentian.ca>
Date:   Sun Mar 4 23:15:58 2012 -0500

    Restore autofocus to the searchbar in TPAC
    
    The switch to autosuggest gave us great functionality, but we lost
    autofocus for effortless initial searching. Restore it, with and without
    Dojo. For the latter case, just use HTML5's autofocus attribute to begin
    with; later on we can use something like Modernizr to detect browsers
    that don't support this attribute and prop them up with additional
    JavaScript, but let's not let that prevent us from getting a good bang
    for our attribute buck in the short term.
    
    Note the slightly painful workaround required to get the cursor to
    position itself at the end of the input value of the Dojo autosuggest
    widget on page load. This is what we get for stepping back into the
    world of JavaScript :)
    
    Signed-off-by: Dan Scott <dscott at laurentian.ca>
    Signed-off-by: Mike Rylander <mrylander at gmail.com>

diff --git a/Open-ILS/src/templates/opac/parts/js.tt2 b/Open-ILS/src/templates/opac/parts/js.tt2
index 8d00df5..a7bc567 100644
--- a/Open-ILS/src/templates/opac/parts/js.tt2
+++ b/Open-ILS/src/templates/opac/parts/js.tt2
@@ -61,6 +61,18 @@
 [% IF use_autosuggest.enabled == "t"; %]
 <script type="text/javascript">
     dojo.require("openils.widget.AutoSuggest");
+
+    /* Set focus, and place the cursor at the end of the input string */
+    dojo.addOnLoad(function() {
+        dijit.byId('search_box').focus();
+
+        var sb_value = dijit.byId('search_box').value;
+        /* Dojo won't trigger a change if the value doesn't change */
+        if (sb_value) {
+            dijit.byId('search_box').setValue(sb_value + ' ');
+            dijit.byId('search_box').setValue(sb_value);
+        }
+    });
 </script>
 [% END; # use_autosuggest %]
 
diff --git a/Open-ILS/src/templates/opac/parts/searchbar.tt2 b/Open-ILS/src/templates/opac/parts/searchbar.tt2
index 80b55ee..3c12bd9 100644
--- a/Open-ILS/src/templates/opac/parts/searchbar.tt2
+++ b/Open-ILS/src/templates/opac/parts/searchbar.tt2
@@ -24,7 +24,7 @@
                 store_args='{"org_unit_getter": function() { return [% ctx.search_ou %]; }}'
                 [%-     END # opac_visible -%]
                 [%- ELSE -%]
-                x-webkit-speech
+                autofocus x-webkit-speech
                 [%- END # autosuggest enabled %] />
         </span>
         [%- INCLUDE "opac/parts/qtype_selector.tt2" id="qtype";

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

Summary of changes:
 Open-ILS/src/templates/opac/parts/js.tt2        |   12 ++++++++++++
 Open-ILS/src/templates/opac/parts/searchbar.tt2 |    2 +-
 2 files changed, 13 insertions(+), 1 deletions(-)


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list