Sha256: e3425480fe1711ecdc6293daee107138a69e68fddcb021be12299ac2b3d51f9f

Contents?: true

Size: 733 Bytes

Versions: 5

Compression:

Stored size: 733 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

5 entries across 5 versions & 2 rubygems

Version Path
express_admin-1.3.2 vendor/gems/express_templates/lib/express_templates/components/forms/checkbox.rb
express_admin-1.3.1 vendor/gems/express_templates/lib/express_templates/components/forms/checkbox.rb
express_templates-0.7.1 lib/express_templates/components/forms/checkbox.rb
express_templates-0.7.0 lib/express_templates/components/forms/checkbox.rb
express_admin-1.3.0 vendor/gems/express_templates/lib/express_templates/components/forms/checkbox.rb