Skip to content

Commit

Permalink
Started input group
Browse files Browse the repository at this point in the history
  • Loading branch information
kaineer committed Feb 4, 2011
1 parent 0eadc73 commit 7533706
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 4 deletions.
3 changes: 3 additions & 0 deletions lib/ream/form.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -2,3 +2,6 @@
require 'ream/form/simple_inputs' require 'ream/form/simple_inputs'
require 'ream/form/textarea' require 'ream/form/textarea'
require 'ream/form/dsl' require 'ream/form/dsl'

# Used by select, radio_group, checkbox_group
require 'ream/form/input_group'
2 changes: 1 addition & 1 deletion lib/ream/form/input.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def initialize( name = nil, type = :text, value = "", opts = {} )
attr_reader :opts attr_reader :opts


def self.acceptable_attributes def self.acceptable_attributes
@attributes ||= [ :id, :class, :style ] @attributes ||= [ :id, :class, :style, :size, :length ]
end end


def render def render
Expand Down
11 changes: 11 additions & 0 deletions lib/ream/form/input_group.rb
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,11 @@
require 'ream/form/input'

module Ream
module Form
class InputGroup < Input
def initialize( name = nil, type = :select, values = [], opts = {} )
super( name, type, values, opts )
end
end
end
end
2 changes: 1 addition & 1 deletion lib/ream/form/textarea.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def initialize( name = nil, value = "", opts = {} )
end end


def render def render
"<textarea #{name_attribute}>#{value.to_s}</textarea>" "<textarea #{name_attribute} #{html_attributes}>#{value.to_s}</textarea>"
end end
end end
end end
Expand Down
4 changes: 2 additions & 2 deletions sandbox/login_form.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
class LoginForm < Ream::Form::Form class LoginForm < Ream::Form::Form
def initialize( user_object = nil ) def initialize( user_object = nil )
super( "/login" ) do |f| super( "/login" ) do |f|
f.text( "login[name]", user_object.name, :id => "login_id" ) f.text( "login[name]", user_object.name, :id => "login_id", :label => "Login" )
f.password( "login[password]", :id => "login_password" ) f.password( "login[password]", :id => "login_password", :label => "Password" )
f.submit( "Ok" ) f.submit( "Ok" )
end end
end end
Expand Down

0 comments on commit 7533706

Please sign in to comment.