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.10.0.pre.alpha1 app/pb_kits/playbook/pb_toggle/toggle.rb
playbook_ui-4.9.0.pre.alpha1 app/pb_kits/playbook/pb_toggle/toggle.rb
playbook_ui-4.9.0 app/pb_kits/playbook/pb_toggle/toggle.rb
playbook_ui-4.8.2 app/pb_kits/playbook/pb_toggle/toggle.rb
playbook_ui-4.8.1 app/pb_kits/playbook/pb_toggle/toggle.rb
playbook_ui-4.7.1 app/pb_kits/playbook/pb_toggle/toggle.rb
playbook_ui-4.7.0 app/pb_kits/playbook/pb_toggle/toggle.rb
playbook_ui-4.6.1 app/pb_kits/playbook/pb_toggle/toggle.rb
playbook_ui-4.6.0 app/pb_kits/playbook/pb_toggle/toggle.rb
playbook_ui-4.5.2 app/pb_kits/playbook/pb_toggle/toggle.rb
playbook_ui-4.5.1 app/pb_kits/playbook/pb_toggle/toggle.rb
playbook_ui-4.5.0 app/pb_kits/playbook/pb_toggle/toggle.rb
playbook_ui-4.4.1 app/pb_kits/playbook/pb_toggle/toggle.rb
playbook_ui-4.4.0 app/pb_kits/playbook/pb_toggle/toggle.rb
playbook_ui-4.3.1 app/pb_kits/playbook/pb_toggle/toggle.rb
playbook_ui-4.3.0 app/pb_kits/playbook/pb_toggle/toggle.rb
playbook_ui-4.2.0 app/pb_kits/playbook/pb_toggle/toggle.rb
playbook_ui-4.1.2 app/pb_kits/playbook/pb_toggle/toggle.rb
playbook_ui-4.1.1 app/pb_kits/playbook/pb_toggle/toggle.rb
playbook_ui-4.1.0 app/pb_kits/playbook/pb_toggle/toggle.rb