Sha256: 72e80a3d90418651409bbf08374d824ce10adaa4f27bd2a5d00d1569ed4decff

Contents?: true

Size: 976 Bytes

Versions: 76

Compression:

Stored size: 976 Bytes

Contents

# frozen_string_literal: true

require "action_view"

module Playbook
  module PbRadio
    class Radio < Playbook::KitBase
      prop :checked, type: Playbook::Props::Boolean,
                     default: false
      prop :error, type: Playbook::Props::Boolean,
                   default: false
      prop :input_options, type: Playbook::Props::Hash,
                           default: {}
      prop :name, type: Playbook::Props::String,
                  default: "radio_name"
      prop :text, type: Playbook::Props::String,
                  default: "Radio Text"
      prop :value, type: Playbook::Props::String,
                   default: "radio_text"

      def classname
        generate_classname("pb_radio_kit") + error_class
      end

      def selected
        "checked" if checked == true
      end

      def body_status
        error ? "negative" : nil
      end

    private

      def error_class
        error ? " error" : ""
      end
    end
  end
end

Version data entries

76 entries across 76 versions & 1 rubygems

Version Path
playbook_ui-9.15.0.pre.decouple.website1 app/pb_kits/playbook/pb_radio/radio.rb
playbook_ui-9.14.1.alpha.highcharts9 app/pb_kits/playbook/pb_radio/radio.rb
playbook_ui-9.14.1 app/pb_kits/playbook/pb_radio/radio.rb
playbook_ui-9.13.0 app/pb_kits/playbook/pb_radio/radio.rb
playbook_ui-9.12.0 app/pb_kits/playbook/pb_radio/radio.rb
playbook_ui-9.12.0.pre.text.addon app/pb_kits/playbook/pb_radio/radio.rb
playbook_ui-9.11.0 app/pb_kits/playbook/pb_radio/radio.rb
playbook_ui-9.10.0 app/pb_kits/playbook/pb_radio/radio.rb
playbook_ui-9.10.0.pre.date.time.stacked.1 app/pb_kits/playbook/pb_radio/radio.rb
playbook_ui-9.10.0.pre.alpha2 app/pb_kits/playbook/pb_radio/radio.rb
playbook_ui-9.10.0.pre.alpha1 app/pb_kits/playbook/pb_radio/radio.rb
playbook_ui-9.9.0.alpha.inline1 app/pb_kits/playbook/pb_radio/radio.rb
playbook_ui-9.9.0 app/pb_kits/playbook/pb_radio/radio.rb
playbook_ui-9.8.0 app/pb_kits/playbook/pb_radio/radio.rb
playbook_ui-9.7.0.pre.alphawidth1 app/pb_kits/playbook/pb_radio/radio.rb
playbook_ui-9.7.0.pre.alpha.a11y.btn app/pb_kits/playbook/pb_radio/radio.rb
playbook_ui-9.7.0 app/pb_kits/playbook/pb_radio/radio.rb
playbook_ui-9.6.1 app/pb_kits/playbook/pb_radio/radio.rb
playbook_ui-9.6.1.pre.deps1 app/pb_kits/playbook/pb_radio/radio.rb
playbook_ui-9.6.0 app/pb_kits/playbook/pb_radio/radio.rb