Sha256: 25102e35863ad2caca91030664b9993a3524233ee6cf7a9b51d290c3acb0fc78

Contents?: true

Size: 1.03 KB

Versions: 78

Compression:

Stored size: 1.03 KB

Contents

# frozen_string_literal: true

module Playbook
  module PbCheckbox
    class Checkbox
      include Playbook::Props
      include ActionView::Helpers::FormTagHelper
      include ActionView::Context



      partial "pb_checkbox/checkbox"

      prop :dark, type: Playbook::Props::Boolean, default: false
      prop :error, type: Playbook::Props::Boolean, default: false
      prop :checked, type: Playbook::Props::Boolean, default: false
      prop :text
      prop :value
      prop :name

      def checked_html
        checked ? "checked='true'" : nil
      end

      def classname
        generate_classname("pb_checkbox_kit", dark_class, checked_class) + error_class
      end

      def input
        check_box_tag(name, value, checked)
      end

      def checkbox_label_status
        error ? "negative" : nil
      end

    private

      def error_class
        error ? " error" : ""
      end

      def checked_class
        checked ? "on" : "off"
      end

      def dark_class
        dark ? "dark" : nil
      end
    end
  end
end

Version data entries

78 entries across 78 versions & 1 rubygems

Version Path
playbook_ui-5.2.0.pre.alpha7 app/pb_kits/playbook/pb_checkbox/checkbox.rb
playbook_ui-5.3.0.pre.alpha1 app/pb_kits/playbook/pb_checkbox/checkbox.rb
playbook_ui-5.4.0 app/pb_kits/playbook/pb_checkbox/checkbox.rb
playbook_ui-5.2.0.pre.alpha6 app/pb_kits/playbook/pb_checkbox/checkbox.rb
playbook_ui-5.2.0.pre.alpha5 app/pb_kits/playbook/pb_checkbox/checkbox.rb
playbook_ui-5.3.0 app/pb_kits/playbook/pb_checkbox/checkbox.rb
playbook_ui-5.2.0.pre.alpha4 app/pb_kits/playbook/pb_checkbox/checkbox.rb
playbook_ui-5.2.0.pre.alpha3 app/pb_kits/playbook/pb_checkbox/checkbox.rb
playbook_ui-5.2.0.pre.alpha2 app/pb_kits/playbook/pb_checkbox/checkbox.rb
playbook_ui-5.2.0 app/pb_kits/playbook/pb_checkbox/checkbox.rb
playbook_ui-5.1.0 app/pb_kits/playbook/pb_checkbox/checkbox.rb
playbook_ui-5.0.3 app/pb_kits/playbook/pb_checkbox/checkbox.rb
playbook_ui-5.0.2 app/pb_kits/playbook/pb_checkbox/checkbox.rb
playbook_ui-5.0.1.pre.beta app/pb_kits/playbook/pb_checkbox/checkbox.rb
playbook_ui-5.1.0.pre.alpha4 app/pb_kits/playbook/pb_checkbox/checkbox.rb
playbook_ui-5.1.0.pre.alpha2 app/pb_kits/playbook/pb_checkbox/checkbox.rb
playbook_ui-5.1.0.pre.alpha1 app/pb_kits/playbook/pb_checkbox/checkbox.rb
playbook_ui-5.0.1 app/pb_kits/playbook/pb_checkbox/checkbox.rb
playbook_ui-5.0.1.pre.alpha1 app/pb_kits/playbook/pb_checkbox/checkbox.rb
playbook_ui-4.18.1.pre.alpha1 app/pb_kits/playbook/pb_checkbox/checkbox.rb