class EndView::Bootstrap::FormGroup

Private Instance Methods

default() click to toggle source
# File lib/end_view/bootstrap/form_group.rb, line 47
def default
  @default ||= begin
    match = defaults.find { |k, _v| k.any? { |w| attribute =~ /#{w}/ } }
    match ? match[1] : {}
  end
end
defaults() click to toggle source
# File lib/end_view/bootstrap/form_group.rb, line 54
def defaults
  @defaults ||= {
    %w(email)          => { left: icon('envelope') },
    %w(phone)          => { left: icon('earphone') },
    %w(repeat confirm) => { left: icon('repeat'), required: true },
    %w(password)       => { left: icon('lock'), required: true },
    %w(card)           => { left: icon('credit-card'), required: true }
  }
end
icon(icon) click to toggle source
# File lib/end_view/bootstrap/form_group.rb, line 64
def icon(icon)
  "<span class='glyphicon glyphicon-#{icon}' aria-hidden='true'></span>"
end
input_opts() click to toggle source
# File lib/end_view/bootstrap/form_group.rb, line 22
def input_opts
  form_builder.input_opts(attribute, @input_opts)
end
label() click to toggle source
# File lib/end_view/bootstrap/form_group.rb, line 30
def label
  @label = default[:label] || Inflecto.humanize(attribute.to_s) if @label.nil?
  @label
end
label_opts() click to toggle source
# File lib/end_view/bootstrap/form_group.rb, line 26
def label_opts
  form_builder.label_opts(attribute, @label_opts)
end
left() click to toggle source
# File lib/end_view/bootstrap/form_group.rb, line 35
def left
  @left ||= default[:left]
end
required() click to toggle source
# File lib/end_view/bootstrap/form_group.rb, line 43
def required
  @required ||= default[:required]
end
right() click to toggle source
# File lib/end_view/bootstrap/form_group.rb, line 39
def right
  @right ||= default[:right]
end