Sha256: 53afe241321e2c76cc1c294c82b2a326be2eaab78ff2535614fa6879a0979a37

Contents?: true

Size: 707 Bytes

Versions: 2

Compression:

Stored size: 707 Bytes

Contents

module TaoForm
  module Components
    class FormComponent < TaoOnRails::Components::Base

      attr_reader :record, :html_options

      def initialize view, record, options
        super view, options
        @record = record
        @html_options = transform_html_options(@options.delete(:html) || {})
      end

      def render &block
        view.content_tag tag_name, view.simple_form_for(record, options, &block), html_options
      end

      def self.component_name
        :form
      end

      private

      def default_options
        {
          wrapper: view.request.variant.mobile? ? :tao_mobile : :tao_desktop,
          defaults: {tao_form: true}
        }
      end

    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
tao_form-0.1.6 lib/tao_form/components/form_component.rb
tao_form-0.1.5 lib/tao_form/components/form_component.rb