Class: ActiveAdmin::Views::SemanticInputsProxy

Inherits:
FormtasticProxy
  • Object
show all
Defined in:
lib/active_admin/views/components/active_admin_form.rb

Instance Method Summary collapse

Methods inherited from FormtasticProxy

#closing_tag, #opening_tag, #split_string_on, #to_s

Instance Method Details

#build(form_builder, *args, &block) ⇒ Object


128
129
130
131
132
133
134
135
136
137
138
# File 'lib/active_admin/views/components/active_admin_form.rb', line 128

def build(form_builder, *args, &block)
  html_options = args.extract_options!
  html_options[:class] ||= "inputs"
  legend = args.shift if args.first.is_a?(::String)
  legend = html_options.delete(:name) if html_options.key?(:name)
  legend_tag = legend ? "<legend><span>#{legend}</span></legend>" : ""
  fieldset_attrs = html_options.map { |k, v| %Q{#{k}="#{v}"} }.join(" ")
  @opening_tag = "<fieldset #{fieldset_attrs}>#{legend_tag}<ol>"
  @closing_tag = "</ol></fieldset>"
  super(*(args << html_options), &block)
end