Sha256: 085bfdd92ad7a24de62bc4d807a11274ca09f1db3252bdd0fe646c647fa91f15

Contents?: true

Size: 744 Bytes

Versions: 175

Compression:

Stored size: 744 Bytes

Contents

# frozen_string_literal: true

require "action_view"

module Playbook
  module PbToggle
    class Toggle < Playbook::KitBase
      prop :input_options, type: Playbook::Props::HashProp,
                           default: {}

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

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

      def input
        check_box_tag(name, value, checked, input_options)
      end

    private

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

Version data entries

175 entries across 175 versions & 1 rubygems

Version Path
playbook_ui-13.10.0.pre.alpha.PLAY1046multilevelsingleselectphase21323 app/pb_kits/playbook/pb_toggle/toggle.rb
playbook_ui-13.10.0.pre.alpha.play978makehighchartsadevdependencypoc1322 app/pb_kits/playbook/pb_toggle/toggle.rb
playbook_ui-13.10.0 app/pb_kits/playbook/pb_toggle/toggle.rb
playbook_ui-13.9.0.pre.alpha.play978makehighchartsadevdependencypoc1292 app/pb_kits/playbook/pb_toggle/toggle.rb
playbook_ui-13.9.0.pre.alpha.verdaccioregistry1277 app/pb_kits/playbook/pb_toggle/toggle.rb
playbook_ui-13.9.0.pre.alpha.play845addswiftkitspage1273 app/pb_kits/playbook/pb_toggle/toggle.rb
playbook_ui-13.9.0.pre.alpha.play845addswiftkitspage1272 app/pb_kits/playbook/pb_toggle/toggle.rb
playbook_ui-13.9.0.pre.alpha.play845allkitsbytypes1271 app/pb_kits/playbook/pb_toggle/toggle.rb
playbook_ui-13.9.0.pre.alpha.play845allkitsbytypes1270 app/pb_kits/playbook/pb_toggle/toggle.rb
playbook_ui-13.9.0.pre.alpha.play845allkitsbytypes1268 app/pb_kits/playbook/pb_toggle/toggle.rb
playbook_ui-13.9.0.pre.alpha.play845allkitsbytypes1266 app/pb_kits/playbook/pb_toggle/toggle.rb
playbook_ui-13.9.0.pre.alpha.play845allkitsbytypes1264 app/pb_kits/playbook/pb_toggle/toggle.rb
playbook_ui-13.9.0.pre.alpha.play845allkitsbytypes1263 app/pb_kits/playbook/pb_toggle/toggle.rb
playbook_ui-13.9.0.pre.alpha.play845allkitsbytypes1262 app/pb_kits/playbook/pb_toggle/toggle.rb
playbook_ui-13.9.0.pre.alpha.PLAY962SingleSelect1261 app/pb_kits/playbook/pb_toggle/toggle.rb
playbook_ui-13.9.0.pre.alpha.play845allkitsbytypes1260 app/pb_kits/playbook/pb_toggle/toggle.rb
playbook_ui-13.9.0 app/pb_kits/playbook/pb_toggle/toggle.rb
playbook_ui-13.8.0.pre.alpha.play845allkitsbytypes1258 app/pb_kits/playbook/pb_toggle/toggle.rb
playbook_ui-13.8.0.pre.alpha.play845allkitsbytypes1257 app/pb_kits/playbook/pb_toggle/toggle.rb
playbook_ui-13.8.0.pre.alpha.PLAY962SingleSelect1256 app/pb_kits/playbook/pb_toggle/toggle.rb