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-4.0.1 app/pb_kits/playbook/pb_toggle/toggle.rb
playbook_ui-4.0.0 app/pb_kits/playbook/pb_toggle/toggle.rb
playbook_ui-3.5.0 app/pb_kits/playbook/pb_toggle/toggle.rb
playbook_ui-3.4.0 app/pb_kits/playbook/pb_toggle/toggle.rb
playbook_ui-3.3.0 app/pb_kits/playbook/pb_toggle/toggle.rb
playbook_ui-3.2.0 app/pb_kits/playbook/pb_toggle/toggle.rb
playbook_ui-3.1.0 app/pb_kits/playbook/pb_toggle/toggle.rb
playbook_ui-3.0.1 app/pb_kits/playbook/pb_toggle/toggle.rb
playbook_ui-3.0.0 app/pb_kits/playbook/pb_toggle/toggle.rb
playbook_ui-2.9.9 app/pb_kits/playbook/pb_toggle/toggle.rb
playbook_ui-2.9.8 app/pb_kits/playbook/pb_toggle/toggle.rb
playbook_ui-2.9.7 app/pb_kits/playbook/pb_toggle/toggle.rb
playbook_ui-2.9.6 app/pb_kits/playbook/pb_toggle/toggle.rb
playbook_ui-2.9.5 app/pb_kits/playbook/pb_toggle/toggle.rb