Sha256: 8dfb5c7bf2d5851c66f31c252db951e61ff040c579427b0c1f080b621e5b6a1b

Contents?: true

Size: 1.08 KB

Versions: 70

Compression:

Stored size: 1.08 KB

Contents

# frozen_string_literal: true

require "action_view"

module Playbook
  module PbRadio
    class Radio
      include ActionView::Helpers::FormTagHelper
      include ActionView::Context
      include Playbook::Props

      partial "pb_radio/radio"

      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

70 entries across 70 versions & 1 rubygems

Version Path
playbook_ui-7.7.0 app/pb_kits/playbook/pb_radio/radio.rb
playbook_ui-7.6.2.pre.alpha1 app/pb_kits/playbook/pb_radio/radio.rb
playbook_ui-7.6.2 app/pb_kits/playbook/pb_radio/radio.rb
playbook_ui-7.6.1.pre.alpha1 app/pb_kits/playbook/pb_radio/radio.rb
playbook_ui-7.6.1 app/pb_kits/playbook/pb_radio/radio.rb
playbook_ui-7.6.0 app/pb_kits/playbook/pb_radio/radio.rb
playbook_ui-7.5.1 app/pb_kits/playbook/pb_radio/radio.rb
playbook_ui-7.5.0 app/pb_kits/playbook/pb_radio/radio.rb
playbook_ui-7.4.2 app/pb_kits/playbook/pb_radio/radio.rb
playbook_ui-7.4.1 app/pb_kits/playbook/pb_radio/radio.rb
playbook_ui-7.4.0.pre.alpha6 app/pb_kits/playbook/pb_radio/radio.rb
playbook_ui-7.4.0.pre.alpha5 app/pb_kits/playbook/pb_radio/radio.rb
playbook_ui-7.4.0 app/pb_kits/playbook/pb_radio/radio.rb
playbook_ui-7.4.0.pre.test4 app/pb_kits/playbook/pb_radio/radio.rb
playbook_ui-7.4.0.pre.test3 app/pb_kits/playbook/pb_radio/radio.rb
playbook_ui-7.4.0.pre.test2 app/pb_kits/playbook/pb_radio/radio.rb
playbook_ui-7.4.0.pre.alpha4 app/pb_kits/playbook/pb_radio/radio.rb
playbook_ui-7.4.0.pre.alpha2 app/pb_kits/playbook/pb_radio/radio.rb
playbook_ui-7.4.0.pre.alpha1 app/pb_kits/playbook/pb_radio/radio.rb
playbook_ui-7.3.0.pre.alpha12 app/pb_kits/playbook/pb_radio/radio.rb