Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

switching to divs instead of paragraph tags in forms

  • Loading branch information...
commit f8c2e08ea5468f8d3bfbfb04029fcd4f92cb5b31 1 parent f95a45b
Ryan Bates authored
2  LICENSE
View
@@ -1,4 +1,4 @@
-Copyright (c) 2010 Ryan Bates
+Copyright (c) 2011 Ryan Bates
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
18 lib/generators/nifty/authentication/templates/views/erb/_form.html.erb
View
@@ -1,20 +1,20 @@
<%%= form_for @<%= user_singular_name %> do |f| %>
<%%= f.error_messages %>
- <p>
+ <div class="field">
<%%= f.label :username %><br />
<%%= f.text_field :username %>
- </p>
- <p>
+ </div>
+ <div class="field">
<%%= f.label :email, "Email Address" %><br />
<%%= f.text_field :email %>
- </p>
- <p>
+ </div>
+ <div class="field">
<%%= f.label :password %><br />
<%%= f.password_field :password %>
- </p>
- <p>
+ </div>
+ <div class="field">
<%%= f.label :password_confirmation, "Confirm Password" %><br />
<%%= f.password_field :password_confirmation %>
- </p>
- <p><%%= f.submit (@<%= user_singular_name %>.new_record? ? "Sign up" : "Update") %></p>
+ </div>
+ <div class="actions"><%%= f.submit (@<%= user_singular_name %>.new_record? ? "Sign up" : "Update") %></div>
<%% end %>
2  lib/generators/nifty/authentication/templates/views/erb/edit.html.erb
View
@@ -1,3 +1,3 @@
<%% title "Update Profile" %>
-<%%= render 'form' %>
+<%%= render "form" %>
20 lib/generators/nifty/authentication/templates/views/erb/login.html.erb
View
@@ -5,26 +5,26 @@
<%- if options[:authlogic] -%>
<%%= form_for @<%= session_singular_name %> do |f| %>
<%%= f.error_messages %>
- <p>
+ <div class="field">
<%%= f.label :username %><br />
<%%= f.text_field :username %>
- </p>
- <p>
+ </div>
+ <div class="field">
<%%= f.label :password %><br />
<%%= f.password_field :password %>
- </p>
- <p><%%= f.submit "Log in" %></p>
+ </div>
+ <div class="actions"><%%= f.submit "Log in" %></div>
<%% end %>
<%- else -%>
<%%= form_tag <%= session_plural_name %>_path do %>
- <p>
+ <div class="field">
<%%= label_tag :login, "Username or Email Address" %><br />
<%%= text_field_tag :login, params[:login] %>
- </p>
- <p>
+ </div>
+ <div class="field">
<%%= label_tag :password %><br />
<%%= password_field_tag :password %>
- </p>
- <p><%%= submit_tag "Log in" %></p>
+ </div>
+ <div class="actions"><%%= submit_tag "Log in" %></div>
<%% end %>
<%- end -%>
2  lib/generators/nifty/authentication/templates/views/erb/signup.html.erb
View
@@ -2,4 +2,4 @@
<p>Already have an account? <%%= link_to "Log in", login_path %>.</p>
-<%%= render 'form' %>
+<%%= render "form" %>
10 lib/generators/nifty/authentication/templates/views/haml/_form.html.haml
View
@@ -1,20 +1,20 @@
= form_for @<%= user_singular_name %> do |f|
= f.error_messages
- %p
+ .field
= f.label :username
%br
= f.text_field :username
- %p
+ .field
= f.label :email, "Email Address"
%br
= f.text_field :email
- %p
+ .field
= f.label :password
%br
= f.password_field :password
- %p
+ .field
= f.label :password_confirmation, "Confirm Password"
%br
= f.password_field :password_confirmation
- %p
+ .actions
= f.submit (@<%= user_singular_name %>.new_record? ? "Sign up" : "Update")
2  lib/generators/nifty/authentication/templates/views/haml/edit.html.haml
View
@@ -1,3 +1,3 @@
- title "Sign up"
-= render 'form'
+= render "form"
12 lib/generators/nifty/authentication/templates/views/haml/login.html.haml
View
@@ -5,26 +5,26 @@
<%- if options[:authlogic] -%>
= form_for @<%= session_singular_name %> do |f|
= f.error_messages
- %p
+ .field
= f.label :username
%br
= f.text_field :username
- %p
+ .field
= f.label :password
%br
= f.password_field :password
- %p
+ .actions
= f.submit "Log in"
<%- else -%>
- form_tag <%= session_plural_name %>_path do
- %p
+ .field
= label_tag :login, "Username or Email Address"
%br
= text_field_tag :login, params[:login]
- %p
+ .field
= label_tag :password
%br
= password_field_tag :password
- %p
+ .actions
= submit_tag "Log in"
<%- end -%>
2  lib/generators/nifty/authentication/templates/views/haml/signup.html.haml
View
@@ -2,4 +2,4 @@
%p== Already have an account? #{link_to "Log in", login_path}.
-= render 'form'
+= render "form"
4 lib/generators/nifty/layout/templates/stylesheet.css
View
@@ -73,3 +73,7 @@ a {
.field_with_errors {
display: inline;
}
+
+form .field, form .actions {
+ margin: 10px 0;
+}
10 lib/generators/nifty/layout/templates/stylesheet.sass
View
@@ -39,9 +39,6 @@ a
background-color: #ffcccc
border: solid 1px #cc6666
-.fieldWithErrors
- display: inline
-
.error_messages
width: 400px
border: 2px solid #cf0000
@@ -64,3 +61,10 @@ a
margin: 8px 10px
ul
margin: 0
+
+.field_with_errors
+ display: inline
+
+form .field,
+form .actions
+ margin: 10px 0
4 lib/generators/nifty/scaffold/scaffold_generator.rb
View
@@ -187,9 +187,9 @@ def controller_methods(dir_name)
def render_form
if form_partial?
if options.haml?
- "= render 'form'"
+ "= render \"form\""
else
- "<%= render 'form' %>"
+ "<%= render \"form\" %>"
end
else
read_template("views/#{view_language}/_form.html.#{view_language}")
6 lib/generators/nifty/scaffold/templates/views/erb/_form.html.erb
View
@@ -1,10 +1,10 @@
<%%= form_for <%= item_path :instance_variable => true %> do |f| %>
<%%= f.error_messages %>
<%- for attribute in model_attributes -%>
- <p>
+ <div class="field">
<%%= f.label :<%= attribute.name %> %><br />
<%%= f.<%= attribute.field_type %> :<%= attribute.name %> %>
- </p>
+ </div>
<%- end -%>
- <p><%%= f.submit %></p>
+ <div class="actions"><%%= f.submit %></div>
<%% end %>
4 lib/generators/nifty/scaffold/templates/views/haml/_form.html.haml
View
@@ -1,10 +1,10 @@
= form_for <%= item_path :instance_variable => true %> do |f|
= f.error_messages
<%- for attribute in model_attributes -%>
- %p
+ .field
= f.label :<%= attribute.name %>
%br
= f.<%= attribute.field_type %> :<%= attribute.name %>
<%- end -%>
- %p
+ .actions
= f.submit
Please sign in to comment.
Something went wrong with that request. Please try again.