Skip to content
Browse files

Forms have a nice layout now.

Signed-off-by: Balint Erdi <balint.erdi@gmail.com>
  • Loading branch information...
1 parent 9185da2 commit 6d0e6cc91fa96570f83fc1d24498d242e0a72217 @balinterdi committed
Showing with 30 additions and 27 deletions.
  1. +1 −1 thrifty.rb
  2. +1 −1 todos.markdown
  3. +8 −8 views/login.haml
  4. +6 −3 views/main.sass
  5. +14 −14 views/register.haml
View
2 thrifty.rb
@@ -101,7 +101,7 @@ def redirect_if_not_logged_in
if user
current_user = user
flash[:ok] = "The new user has been created."
- redirect '/'
+ redirect '/login'
else
flash[:error] = "Bad data. Registration failed. Try again."
haml :register
View
2 todos.markdown
@@ -5,7 +5,6 @@
* revisit layout of the expenses page (Total amount is too close to the date filters)
* check layout of the date selectors on expensese page in Safari (looks ugly now)
* add README
-* make layout of the login and register pages nice
* make a form builder for the commonly used form (ul-li-label-input)
## Long-term
@@ -14,6 +13,7 @@
# DONE
+* make layout of the login and register pages nice
* correct the '/' action (gives error on 'name')
* get rid of the Pot model
* rename app to "thrifty"
View
16 views/login.haml
@@ -1,12 +1,12 @@
%form{ :name => "login", :method => "post", :action => "/login" }
- %ul{ :class => "fieldset" }
- %li{ :class => "field" }
- %label{ :for => "login" } Login
- %input{ :type => "text", :id => "login", :name => "login" }
- %li{ :class => "field" }
- %label{ :for => "password" } Password
- %input{ :type => "password", :id => "password", :name => "password" }
- %li{ :class => "field" }
+ %ul.fieldset
+ %li.field
+ %label.leftColumn{ :for => "login" } Login
+ %input.rightColumn{ :type => "text", :id => "login", :name => "login" }
+ %li.field{ :class => "field" }
+ %label.leftColumn{ :for => "password" } Password
+ %input.rightColumn{ :type => "password", :id => "password", :name => "password" }
+ %li.field{ :class => "field" }
%input{ :type => "submit", :value => "Log in"}
%a{ :href => "/register" } Register
View
9 views/main.sass
@@ -76,7 +76,7 @@ input
&:focus
:background #fff
-!left_field_width = 120px
+!left_field_width = 140px
!right_field_width = 240px
!form_width = 400px
@@ -100,7 +100,7 @@ form
:width = !form_width
input[type=submit]
:cursor pointer
- :margin-left = !left_field_width + 30
+ :margin-left = !left_field_width + 10
:border 2px outset #333
:width auto
:background = !nice_yellow
@@ -123,7 +123,10 @@ form
:text-align left
:margin-top 5px
.onlyRightColumn
- :margin-left = !left_field_width + 10
+ :margin-left = !left_field_width
+ :float right
+ :text-align left
+ :margin-top 5px
div#expenses
:margin 50px 0px
View
28 views/register.haml
@@ -1,17 +1,17 @@
%form{ :name => "register", :action => "/register", :method => "post" }
- %ul{ :class => "fieldset" }
- %li{ :class => "field" }
- %label{ :for => "name" } Name
- %input{ :type => "text", :id => "name", :name => "user[name]" }
- %li{ :class => "field" }
- %label{ :for => "login" } Login
- %input{ :type => "text", :id => "login", :name => "user[login]" }
- %li{ :class => "field" }
- %label{ :for => "password" } Password
- %input{ :type => "password", :id => "password", :name => "user[password]" }
- %li{ :class => "field" }
- %label{ :for => "re-password" } Re-password
- %input{ :type => "password", :id => "re-password", :name => "user[re_password]" }
+ %ul.fieldset
+ %li.field
+ %label.leftColumn{ :for => "name" } Name
+ %input.rightColumn{ :type => "text", :id => "name", :name => "user[name]" }
+ %li.field
+ %label.leftColumn{ :for => "login" } Login
+ %input.rightColumn{ :type => "text", :id => "login", :name => "user[login]" }
+ %li.field
+ %label.leftColumn{ :for => "password" } Password
+ %input.rightColumn{ :type => "password", :id => "password", :name => "user[password]" }
+ %li.field
+ %label.leftColumn{ :for => "re-password" } Re-password
+ %input.rightColumn{ :type => "password", :id => "re-password", :name => "user[re_password]" }
- %li{ :class => "field" }
+ %li.field
%input{ :type => "submit", :value => "Register"}

0 comments on commit 6d0e6cc

Please sign in to comment.
Something went wrong with that request. Please try again.