Sha256: 3d14935fb99a9f014513fc8adf07282736b3f05ed63eeb6d4f04134c92249c1e

Contents?: true

Size: 1.36 KB

Versions: 21

Compression:

Stored size: 1.36 KB

Contents

module ExpressTemplates
  module Components
    module Forms
      module BasicFields
        ALL = %w(email phone text password color date datetime
                datetime_local number range
                search telephone time url week)

        ALL.each do |type|
          class_definition = <<-RUBY
            class #{type.classify} < FormComponent
              contains {
                label_tag(label_name, label_text)
                #{type}_field_tag field_name_attribute, field_value, field_helper_options
              }
            end
RUBY

          eval(class_definition)

        end
      end

      # class Email < FormComponent
      #   contains {
      #      label_tag label_name, label_text
      #      email_field  field_name_attribute, field_value, field_helper_options
      #   }
      # end

      class File < FormComponent
        contains {
          label_tag(label_name, label_text)
          file_field_tag field_name_attribute, field_helper_options
        }
      end

      class Textarea < FormComponent
        contains {
          label_tag(label_name, label_text)
          text_area_tag field_name_attribute, field_value, field_helper_options
        }
      end

      class Hidden < FormComponent
        contains {
          hidden_field_tag field_name_attribute, field_value, field_helper_options
        }
      end
    end
  end
end

Version data entries

21 entries across 21 versions & 2 rubygems

Version Path
express_templates-0.11.4 lib/express_templates/components/forms/basic_fields.rb
express_admin-1.7.5 vendor/gems/express_templates/lib/express_templates/components/forms/basic_fields.rb
express_admin-1.7.4 vendor/gems/express_templates/express_templates/lib/express_templates/components/forms/basic_fields.rb
express_admin-1.7.3 vendor/gems/express_templates/lib/express_templates/components/forms/basic_fields.rb
express_admin-1.7.2 vendor/gems/express_templates/lib/express_templates/components/forms/basic_fields.rb
express_admin-1.7.1 vendor/gems/express_templates/lib/express_templates/components/forms/basic_fields.rb
express_admin-1.6.13 vendor/gems/express_templates/lib/express_templates/components/forms/basic_fields.rb
express_admin-1.6.12 vendor/gems/express_templates/lib/express_templates/components/forms/basic_fields.rb
express_admin-1.6.11 vendor/gems/express_templates/lib/express_templates/components/forms/basic_fields.rb
express_admin-1.6.10 vendor/gems/express_templates/lib/express_templates/components/forms/basic_fields.rb
express_admin-1.6.9 vendor/gems/express_templates/lib/express_templates/components/forms/basic_fields.rb
express_admin-1.6.8 vendor/gems/express_templates/lib/express_templates/components/forms/basic_fields.rb
express_admin-1.6.7 vendor/gems/express_templates/lib/express_templates/components/forms/basic_fields.rb
express_templates-0.11.3 lib/express_templates/components/forms/basic_fields.rb
express_admin-1.6.4 vendor/gems/express_templates/lib/express_templates/components/forms/basic_fields.rb
express_templates-0.11.2 lib/express_templates/components/forms/basic_fields.rb
express_admin-1.6.3 vendor/gems/express_templates/lib/express_templates/components/forms/basic_fields.rb
express_templates-0.11.1 lib/express_templates/components/forms/basic_fields.rb
express_admin-1.6.2 vendor/gems/express_templates/lib/express_templates/components/forms/basic_fields.rb
express_admin-1.6.1 vendor/gems/express_templates/lib/express_templates/components/forms/basic_fields.rb