Sha256: e8fcfa5744d0970dcee6ea33911a5f4414f8ea3def9799b2806ea3c4e20afad5

Contents?: true

Size: 1.51 KB

Versions: 5

Compression:

Stored size: 1.51 KB

Contents

module UiBibzForm
  class UiBibzFormBuilder < SimpleForm::FormBuilder
    include ActionView::Helpers::TagHelper
    include ActionView::Helpers::TextHelper
    include UiBibz::Utils

    attr_accessor :output_buffer

    def ui_surround_field content = nil, opts = nil, html_options = nil, &block
      content = (options || {}).merge(content || {})
      content  = content.merge(template: @template, form: self)

      input_classes = UiBibz::Utils::Screwdriver.join_classes('form-group', 'surround_field', options[:input_html].try(:[], :class))
      wrapper_html = (options[:input_html] || {}).merge({ class: input_classes })

      content_tag :div, wrapper_html do
        concat content_tag(:label, content[:label]) unless content[:label].nil?
        concat UiBibz::Ui::Core::Forms::Surrounds::SurroundField.new(content, opts, html_options).tap(&block).render
      end
    end

    def ui_button_group content = nil, opts = nil, html_options = nil, &block
      content = (options || {}).merge(content || {})
      content  = content.merge(template: @template, form: self)

      input_classes = UiBibz::Utils::Screwdriver.join_classes('button_group', options[:input_html].try(:[], :class))
      wrapper_html = (options[:input_html] || {}).merge({ class: input_classes })

      content_tag :div, wrapper_html do
        concat content_tag(:label, content[:label]) unless content[:label].nil?
        concat UiBibz::Ui::Core::Forms::Buttons::ButtonGroup.new(content, opts, html_options).tap(&block).render
      end
    end

  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ui_bibz-2.0.0.beta2.6 app/inputs/ui_bibz_form/ui_bibz_form_builder.rb
ui_bibz-2.0.0.beta2.5 app/inputs/ui_bibz_form/ui_bibz_form_builder.rb
ui_bibz-2.0.0.beta2.4 app/inputs/ui_bibz_form/ui_bibz_form_builder.rb
ui_bibz-2.0.0.beta2.3 app/inputs/ui_bibz_form/ui_bibz_form_builder.rb
ui_bibz-2.0.0.beta2.2 app/inputs/ui_bibz_form/ui_bibz_form_builder.rb