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-6.0.1.pre.alpha4 app/pb_kits/playbook/pb_checkbox/checkbox.rb
playbook_ui-6.0.1.pre.alpha3 app/pb_kits/playbook/pb_checkbox/checkbox.rb
playbook_ui-6.0.1.pre.alpha2 app/pb_kits/playbook/pb_checkbox/checkbox.rb
playbook_ui-5.2.0.pre.alpha15 app/pb_kits/playbook/pb_checkbox/checkbox.rb
playbook_ui-5.2.0.pre.alpha14 app/pb_kits/playbook/pb_checkbox/checkbox.rb
playbook_ui-5.2.0.pre.alpha13 app/pb_kits/playbook/pb_checkbox/checkbox.rb
playbook_ui-6.0.1 app/pb_kits/playbook/pb_checkbox/checkbox.rb
playbook_ui-5.2.0.pre.alpha12 app/pb_kits/playbook/pb_checkbox/checkbox.rb
playbook_ui-6.0.0 app/pb_kits/playbook/pb_checkbox/checkbox.rb
playbook_ui-5.2.0.pre.alpha11 app/pb_kits/playbook/pb_checkbox/checkbox.rb
playbook_ui-5.5.1.pre.alpha4 app/pb_kits/playbook/pb_checkbox/checkbox.rb
playbook_ui-5.5.1.pre.alpha3 app/pb_kits/playbook/pb_checkbox/checkbox.rb
playbook_ui-5.5.1.pre.alpha2 app/pb_kits/playbook/pb_checkbox/checkbox.rb
playbook_ui-5.5.1.pre.alpha1 app/pb_kits/playbook/pb_checkbox/checkbox.rb
playbook_ui-5.2.0.pre.alpha10 app/pb_kits/playbook/pb_checkbox/checkbox.rb
playbook_ui-5.5.1 app/pb_kits/playbook/pb_checkbox/checkbox.rb
playbook_ui-5.5.0 app/pb_kits/playbook/pb_checkbox/checkbox.rb
playbook_ui-5.5.0.pre.alpha1 app/pb_kits/playbook/pb_checkbox/checkbox.rb
playbook_ui-5.2.0.pre.alpha9 app/pb_kits/playbook/pb_checkbox/checkbox.rb
playbook_ui-5.2.0.pre.alpha8 app/pb_kits/playbook/pb_checkbox/checkbox.rb