Sha256: 2ec11b7bf79a08eadc3a653c5bb78fbc595f33968e8b9612b48ef33f32bf51b5

Contents?: true

Size: 734 Bytes

Versions: 6

Compression:

Stored size: 734 Bytes

Contents

module ExpressTemplates
  module Components
    module Forms
      class Checkbox < FormComponent

        emits -> {
          div(class: field_wrapper_class) {
            label_tag(label_name, label_text) if label_before?
            check_box(resource_var, 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

6 entries across 6 versions & 2 rubygems

Version Path
express_admin-1.2.1 vendor/gems/express_templates/lib/express_templates/components/forms/checkbox.rb
express_admin-1.2.0 vendor/gems/express_templates/lib/express_templates/components/forms/checkbox.rb
express_templates-0.5.0 lib/express_templates/components/forms/checkbox.rb
express_templates-0.4.2 lib/express_templates/components/forms/checkbox.rb
express_templates-0.4.1 lib/express_templates/components/forms/checkbox.rb
express_templates-0.4.0 lib/express_templates/components/forms/checkbox.rb