From d5cf5bc4f527d1333a00891961213cec58fc438a Mon Sep 17 00:00:00 2001 From: joshua stein Date: Tue, 18 Sep 2012 09:44:22 -0500 Subject: [PATCH] use autofocus attribute for text boxes instead of javascript --- app/views/login/index.html.erb | 8 +------- app/views/search/index.html.erb | 11 ++--------- 2 files changed, 3 insertions(+), 16 deletions(-) diff --git a/app/views/login/index.html.erb b/app/views/login/index.html.erb index 65d21cf..ef96305 100644 --- a/app/views/login/index.html.erb +++ b/app/views/login/index.html.erb @@ -6,7 +6,7 @@ <%= form_tag login_url do %>

<%= label_tag :email, "E-mail or Username:" %> - <%= text_field_tag :email, "", :size => 30 %> + <%= text_field_tag :email, "", :size => 30, :autofocus => "autofocus" %>
<%= label_tag :password, "Password:" %> @@ -24,9 +24,3 @@

<% end %> - - diff --git a/app/views/search/index.html.erb b/app/views/search/index.html.erb index 77aca46..2bd5e23 100644 --- a/app/views/search/index.html.erb +++ b/app/views/search/index.html.erb @@ -5,7 +5,8 @@ <%= form_tag "/search", :method => :get do %>
- <%= text_field_tag "q", @search.q, :size => 40 %> + <%= text_field_tag "q", @search.q, { :size => 40 }. + merge(@search.q.present? ? {} : { :autofocus => "autofocus" }) %>
@@ -43,14 +44,6 @@ <% end %> - - <% if !@search.q.present? %> - - <% end %> <% if @search.results.any? %>