use autofocus attribute for text boxes instead of javascript
This commit is contained in:
parent
42150c8a56
commit
d5cf5bc4f5
|
@ -6,7 +6,7 @@
|
||||||
<%= form_tag login_url do %>
|
<%= form_tag login_url do %>
|
||||||
<p>
|
<p>
|
||||||
<%= label_tag :email, "E-mail or Username:" %>
|
<%= label_tag :email, "E-mail or Username:" %>
|
||||||
<%= text_field_tag :email, "", :size => 30 %>
|
<%= text_field_tag :email, "", :size => 30, :autofocus => "autofocus" %>
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
<%= label_tag :password, "Password:" %>
|
<%= label_tag :password, "Password:" %>
|
||||||
|
@ -24,9 +24,3 @@
|
||||||
</p>
|
</p>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
|
||||||
$(document).ready(function() {
|
|
||||||
$("#email").focus();
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
|
@ -5,7 +5,8 @@
|
||||||
|
|
||||||
<%= form_tag "/search", :method => :get do %>
|
<%= form_tag "/search", :method => :get do %>
|
||||||
<div class="boxline">
|
<div class="boxline">
|
||||||
<%= text_field_tag "q", @search.q, :size => 40 %>
|
<%= text_field_tag "q", @search.q, { :size => 40 }.
|
||||||
|
merge(@search.q.present? ? {} : { :autofocus => "autofocus" }) %>
|
||||||
<input type="submit" value="Search">
|
<input type="submit" value="Search">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -43,14 +44,6 @@
|
||||||
<label for="search_order_points" class="normal">Points</label>
|
<label for="search_order_points" class="normal">Points</label>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<% if !@search.q.present? %>
|
|
||||||
<script>
|
|
||||||
$(document).ready(function() {
|
|
||||||
$("#q").focus();
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
<% end %>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<% if @search.results.any? %>
|
<% if @search.results.any? %>
|
||||||
|
|
Loading…
Reference in a new issue