Sha256: b71c5e8833b2cf9c0b8b99cba2e21c3d6669def8723629dd35a1fe1801ddad55

Contents?: true

Size: 757 Bytes

Versions: 134

Compression:

Stored size: 757 Bytes

Contents

# frozen_string_literal: true

require "action_view"

module Playbook
  module PbToggle
    class Toggle
      include ActionView::Helpers::FormTagHelper
      include ActionView::Context
      include Playbook::Props

      partial "pb_toggle/toggle"

      prop :checked, type: Playbook::Props::Boolean,
                     default: false
      prop :name
      prop :size, type: Playbook::Props::Enum,
                  values: %w[sm md],
                  default: "md"
      prop :value

      def classname
        generate_classname("pb_toggle_kit", size, checked_class)
      end

      def input
        check_box_tag(name, value, checked)
      end

    private

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

Version data entries

134 entries across 134 versions & 1 rubygems

Version Path
playbook_ui-5.1.0.pre.alpha2 app/pb_kits/playbook/pb_toggle/toggle.rb
playbook_ui-5.1.0.pre.alpha1 app/pb_kits/playbook/pb_toggle/toggle.rb
playbook_ui-5.0.1 app/pb_kits/playbook/pb_toggle/toggle.rb
playbook_ui-5.0.1.pre.alpha1 app/pb_kits/playbook/pb_toggle/toggle.rb
playbook_ui-4.18.1.pre.alpha1 app/pb_kits/playbook/pb_toggle/toggle.rb
playbook_ui-4.18.1 app/pb_kits/playbook/pb_toggle/toggle.rb
playbook_ui-4.18.0 app/pb_kits/playbook/pb_toggle/toggle.rb
playbook_ui-4.17.0 app/pb_kits/playbook/pb_toggle/toggle.rb
playbook_ui-4.17.0.pre.alpha1 app/pb_kits/playbook/pb_toggle/toggle.rb
playbook_ui-4.16.0 app/pb_kits/playbook/pb_toggle/toggle.rb
playbook_ui-4.15.0 app/pb_kits/playbook/pb_toggle/toggle.rb
playbook_ui-4.14.0 app/pb_kits/playbook/pb_toggle/toggle.rb
playbook_ui-4.15.1.alpha1 app/pb_kits/playbook/pb_toggle/toggle.rb
playbook_ui-4.13.1 app/pb_kits/playbook/pb_toggle/toggle.rb
playbook_ui-4.13.0 app/pb_kits/playbook/pb_toggle/toggle.rb
playbook_ui-4.12.0 app/pb_kits/playbook/pb_toggle/toggle.rb
playbook_ui-4.11.0 app/pb_kits/playbook/pb_toggle/toggle.rb
playbook_ui-4.11.0.pre.alpha3 app/pb_kits/playbook/pb_toggle/toggle.rb
playbook_ui-4.11.0.pre.alpha.pre.2 app/pb_kits/playbook/pb_toggle/toggle.rb
playbook_ui-4.10.0 app/pb_kits/playbook/pb_toggle/toggle.rb