Class: Decidim::AuthorizationFormBuilder
- Inherits:
-
FormBuilder
- Object
- FoundationRailsHelper::FormBuilder
- FormBuilder
- Decidim::AuthorizationFormBuilder
- Defined in:
- lib/decidim/authorization_form_builder.rb
Overview
A custom form builder to render AuthorizationHandler forms.
Instance Method Summary collapse
-
#all_fields ⇒ Object
Renders all form attributes defined by the handler.
-
#input(name, options = {}) ⇒ Object
Renders a single attribute from the form handlers.
Methods inherited from FormBuilder
#areas_select, #attachment, #categories_select, #check_box, #choose_button_label, #collection_check_boxes, #collection_radio_buttons, #create_language_selector, #data_picker, #date_field, #datetime_field, #editor, #form_field_for, #hashtaggable_text_field, #label_for, #max_file_size, #password_field, #resources_select, #scopes_picker, #social_field, #text_area, #translated, #translated_one_locale, #upload, #upload_help
Methods included from Map::Autocomplete::FormBuilder
Methods included from TranslatableAttributes
Instance Method Details
#all_fields ⇒ Object
Renders all form attributes defined by the handler.
Returns a String.
11 12 13 14 15 16 17 |
# File 'lib/decidim/authorization_form_builder.rb', line 11 def all_fields fields = public_attributes.map do |name, type| @template.content_tag(:div, input_field(name, type), class: "field") end safe_join(fields) end |
#input(name, options = {}) ⇒ Object
Renders a single attribute from the form handlers.
name - The String name of the attribute. options - An optional Hash, accepted options are:
:as - A String name with the type the field to render
:input - An optional Hash to pass to the field method.
Returns a String.
27 28 29 30 31 32 33 34 |
# File 'lib/decidim/authorization_form_builder.rb', line 27 def input(name, = {}) if [:as] send([:as].to_s, name, [:input] || {}) else type = find_input_type(name.to_s) input_field(name, type) end end |