Permalink
Browse files

added JS to focus on first element in forms so I don't have to click …

…into them
  • Loading branch information...
tomcz committed Mar 15, 2010
1 parent 3a0121a commit a0b078eb5c74bfa947483b051eabee1e60c25bb0
@@ -1,5 +1,5 @@
.depot-form
- - form_tag do
+ - form_tag({}, :class => 'login') do
%fieldset
%legend Please Log In
%div
@@ -4,6 +4,8 @@
%meta(http-equiv="content-type" content="text/html;charset=UTF-8")
%title Pragprog Books Online Store
= stylesheet_link_tag 'scaffold', 'depot'
+ = javascript_include_tag :defaults
+ = javascript_include_tag 'admin'
%body#store
#banner
= image_tag("logo.png")
@@ -5,6 +5,7 @@
%title Pragprog Books Online Store
= stylesheet_link_tag "depot", :media => "all"
= javascript_include_tag :defaults
+ = javascript_include_tag 'store'
%body#store
#banner
= image_tag("logo.png")
@@ -1,6 +1,6 @@
.depot-form
= error_messages_for 'order'
- - form_for :order, :url => { :action => :save_order, :id => @conversation_id } do |form|
+ - form_for :order, :url => { :action => :save_order, :id => @conversation_id }, :html => {:class => 'checkout'} do |form|
%fieldset
%legend Please Enter Your Details
%div
@@ -0,0 +1,5 @@
+document.observe('dom:loaded', function() {
+ $$('form.login, form.new_product, form.edit_product, form.new_user, form.edit_user').each(function(form) {
+ Form.focusFirstElement(form);
+ });
+});
@@ -0,0 +1,5 @@
+document.observe('dom:loaded', function() {
+ $$('form.checkout').each(function(form) {
+ Form.focusFirstElement(form);
+ });
+});

0 comments on commit a0b078e

Please sign in to comment.