Sha256: d9e1f078c975f129d646a8d618f0c8d5fc6a42aa2000589bd7ea793b103f9f11

Contents?: true

Size: 1.49 KB

Versions: 2

Compression:

Stored size: 1.49 KB

Contents

module Formnestic
  module Inputs
    module Base
      module Wrapping
        def input_wrapping(&block)
          if self.builder.options[:display_type] == "table"
            if [
              "Formtastic::Inputs::DateSelectInput", 
              "Formtastic::Inputs::TimeSelectInput", 
              "Formtastic::Inputs::DateTimeSelectInput",
              "Formtastic::Inputs::TimeInput", 
              "Formtastic::Inputs::DateInput", 
            ].index(self.class.to_s)
              table_date_select_input_wrapping(&block)
            else
              table_input_wrapping(&block)
            end
          else
            formtastic_input_wrapping(&block)
          end
        end
  
        def table_date_select_input_wrapping(&block)
          self.builder.options[:parent_builder].add_table_header(self.attributized_method_name, self.class, label_text)
          template.content_tag(:td, 
            template.content_tag(:div, [
              template.capture(&block), error_html, hint_html].join("\n").html_safe, 
            class: "table-date-select-container"), wrapper_html_options
          )
        end
              
        def table_input_wrapping(&block)
          self.builder.options[:parent_builder].add_table_header(self.attributized_method_name, self.class, label_text)
          template.content_tag(:td, 
            [template.capture(&block), error_html, hint_html].join("\n").html_safe, 
            wrapper_html_options
          )
        end          
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
formnestic-1.0.2 lib/formnestic/inputs/base/wrapping.rb
formnestic-1.0.1 lib/formnestic/inputs/base/wrapping.rb