Commit f01bd86ca0a45deb162f9dc1d0a99c87d325dc03
1 parent
0757181e
Exists in
master
and in
28 other branches
ActionItem85: fixing the focus on first field to skip search_box_form
git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@602 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing
1 changed file
with
14 additions
and
3 deletions
Show diff stats
app/views/layouts/application.rhtml
@@ -20,6 +20,17 @@ | @@ -20,6 +20,17 @@ | ||
20 | apply_source_formatting : true, | 20 | apply_source_formatting : true, |
21 | language: <%= language.inspect %>, | 21 | language: <%= language.inspect %>, |
22 | }); | 22 | }); |
23 | + | ||
24 | + function focusOnFirstField() { | ||
25 | + var form = document.forms[0]; | ||
26 | + if (form.id == 'search_box_form') { | ||
27 | + form = document.forms[1]; | ||
28 | + } | ||
29 | + if (form != null && form.elements[0] != null) { | ||
30 | + form.elements[0].focus(); | ||
31 | + } | ||
32 | + } | ||
33 | + | ||
23 | </script> | 34 | </script> |
24 | 35 | ||
25 | <%= design_all_header_tags %> | 36 | <%= design_all_header_tags %> |
@@ -34,7 +45,7 @@ | @@ -34,7 +45,7 @@ | ||
34 | 45 | ||
35 | </head> | 46 | </head> |
36 | 47 | ||
37 | - <body onload='javascript: if (document.forms[0] != null && document.forms[0].elements[0] != null) { document.forms[0].elements[0].focus(); }'> | 48 | + <body onload='javascript: focusOnFirstField();'> |
38 | 49 | ||
39 | <% unless flash[:notice].nil? %> | 50 | <% unless flash[:notice].nil? %> |
40 | <div id='notice'> | 51 | <div id='notice'> |
@@ -62,8 +73,8 @@ | @@ -62,8 +73,8 @@ | ||
62 | </script> | 73 | </script> |
63 | 74 | ||
64 | <div id='search_box'> | 75 | <div id='search_box'> |
65 | - <form action="" method="GET"> | ||
66 | - <input type='text' name='q' value='sua busca aqui ...'> | 76 | + <form id='search_box_form' action="" method="GET"> |
77 | + <input type='text' name='q' value='<%= _('Your search here ...')%>'> | ||
67 | <input type='submit' value='Buscar'> | 78 | <input type='submit' value='Buscar'> |
68 | </form> | 79 | </form> |
69 | </div><!-- id='search_box' --> | 80 | </div><!-- id='search_box' --> |