Sha256: 7e754bf4f0df3974911da96b77b53df2f611926425a0e9e53c802ab68a4613cf

Contents?: true

Size: 771 Bytes

Versions: 42

Compression:

Stored size: 771 Bytes

Contents

module ExpressTemplates
  module Components
    module Forms
      class Checkbox < FormComponent

        has_option :label_after, 'Positions the option label after the checkbox.', default: false

        contains {
          label_tag(label_name, label_text) if label_before?
          check_box(resource_name, field_name.to_sym, field_options, checked_value, unchecked_value)
          label_tag(label_name, label_text) if label_after?
        }

        def label_before?
          !label_after?
        end

        def label_after?
          !!config[:label_after]
        end

        def field_options
          {}
        end

        def checked_value
          "1"
        end

        def unchecked_value
          "0"
        end

      end
    end
  end
end

Version data entries

42 entries across 42 versions & 2 rubygems

Version Path
express_templates-0.11.20 lib/express_templates/components/forms/checkbox.rb
express_templates-0.11.20.rc1 lib/express_templates/components/forms/checkbox.rb
express_templates-0.11.19 lib/express_templates/components/forms/checkbox.rb
express_templates-0.11.18 lib/express_templates/components/forms/checkbox.rb
express_templates-0.11.17 lib/express_templates/components/forms/checkbox.rb
express_templates-0.11.16 lib/express_templates/components/forms/checkbox.rb
express_templates-0.11.16.rc1 lib/express_templates/components/forms/checkbox.rb
express_templates-0.11.15 lib/express_templates/components/forms/checkbox.rb
express_templates-0.11.14 lib/express_templates/components/forms/checkbox.rb
express_templates-0.11.13 lib/express_templates/components/forms/checkbox.rb
express_templates-0.11.11 lib/express_templates/components/forms/checkbox.rb
express_templates-0.11.10 lib/express_templates/components/forms/checkbox.rb
express_templates-0.11.9 lib/express_templates/components/forms/checkbox.rb
express_templates-0.11.8 lib/express_templates/components/forms/checkbox.rb
express_templates-0.11.7 lib/express_templates/components/forms/checkbox.rb
express_templates-0.11.6 lib/express_templates/components/forms/checkbox.rb
express_templates-0.11.5 lib/express_templates/components/forms/checkbox.rb
express_templates-0.11.4 lib/express_templates/components/forms/checkbox.rb
express_admin-1.7.5 vendor/gems/express_templates/lib/express_templates/components/forms/checkbox.rb
express_admin-1.7.4 vendor/gems/express_templates/express_templates/lib/express_templates/components/forms/checkbox.rb