Sha256: 640f11ac851ca1ca396ca6cb75b95d50876af03e2d5bd595490bc89f652e14db

Contents?: true

Size: 1.14 KB

Versions: 20

Compression:

Stored size: 1.14 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 resource_var, field_name.to_sym, input_attributes
              }
            end
RUBY

          eval(class_definition)

        end
      end

      # class Email < FormComponent
      #   contains {
      #      label_tag label_name, label_text
      #      email_field resource_var, field_name.to_sym, input_attributes
      #   }
      # end

      class Textarea < FormComponent
        contains {
          label_tag(label_name, label_text)
          text_area resource_var, field_name.to_sym, input_attributes
        }
      end

      class Hidden < FormComponent
        contains {
          hidden_field resource_var, field_name.to_sym, input_attributes
        }
      end
    end
  end
end

Version data entries

20 entries across 20 versions & 2 rubygems

Version Path
express_admin-1.4.10 vendor/gems/express_templates/lib/express_templates/components/forms/basic_fields.rb
express_admin-1.4.9 vendor/gems/express_templates/lib/express_templates/components/forms/basic_fields.rb
express_templates-0.9.8 lib/express_templates/components/forms/basic_fields.rb
express_admin-1.4.8 vendor/gems/express_templates/lib/express_templates/components/forms/basic_fields.rb
express_templates-0.9.7 lib/express_templates/components/forms/basic_fields.rb
express_admin-1.4.7 vendor/gems/express_templates/lib/express_templates/components/forms/basic_fields.rb
express_templates-0.9.6 lib/express_templates/components/forms/basic_fields.rb
express_admin-1.4.6 vendor/gems/express_templates/lib/express_templates/components/forms/basic_fields.rb
express_templates-0.9.5 lib/express_templates/components/forms/basic_fields.rb
express_admin-1.4.5 vendor/gems/express_templates/lib/express_templates/components/forms/basic_fields.rb
express_templates-0.9.4 lib/express_templates/components/forms/basic_fields.rb
express_templates-0.9.3 lib/express_templates/components/forms/basic_fields.rb
express_admin-1.4.4 vendor/gems/express_templates/lib/express_templates/components/forms/basic_fields.rb
express_admin-1.4.3 vendor/gems/express_templates/lib/express_templates/components/forms/basic_fields.rb
express_templates-0.9.1 lib/express_templates/components/forms/basic_fields.rb
express_admin-1.4.2 vendor/gems/express_templates/lib/express_templates/components/forms/basic_fields.rb
express_templates-0.9.0 lib/express_templates/components/forms/basic_fields.rb
express_admin-1.4.1 vendor/gems/express_templates/lib/express_templates/components/forms/basic_fields.rb
express_admin-1.4.0 vendor/gems/express_templates/lib/express_templates/components/forms/basic_fields.rb
express_templates-0.8.0 lib/express_templates/components/forms/basic_fields.rb