Module: YMDP::FormTagHelper

Included in:
Compiler::Template::View
Defined in:
lib/ymdp/view/asset_tag_helper.rb

Instance Method Summary collapse

Instance Method Details

#label(name, content_or_options = nil, options = {}) ⇒ Object



48
49
50
51
52
53
54
55
56
57
58
# File 'lib/ymdp/view/asset_tag_helper.rb', line 48

def label(name, content_or_options = nil, options = {})
  if content_or_options.is_a?(Hash)
    options = content_or_options
    text = name
  else
    text = content_or_options || name
  end
  options[:id] ||= "#{name.downcase}_label"
  options[:for] ||= name.downcase
  ("label", text, options)
end

#password_field(name, options = {}) ⇒ Object



43
44
45
46
# File 'lib/ymdp/view/asset_tag_helper.rb', line 43

def password_field(name, options={})
  options[:type] = "password"
  text_field(name, options)
end

#text_field(name, options = {}) ⇒ Object



35
36
37
38
39
40
41
# File 'lib/ymdp/view/asset_tag_helper.rb', line 35

def text_field(name, options={})
  options[:id] ||= name
  options[:name] ||= name
  options[:type] ||= "text"
  
  tag("input", options)
end