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.14.0.pre.alpha1 app/pb_kits/playbook/pb_radio/radio.rb
playbook_ui-7.16.0 app/pb_kits/playbook/pb_radio/radio.rb
playbook_ui-7.15.1 app/pb_kits/playbook/pb_radio/radio.rb
playbook_ui-7.15.0 app/pb_kits/playbook/pb_radio/radio.rb
playbook_ui-7.14.0 app/pb_kits/playbook/pb_radio/radio.rb
playbook_ui-7.13.0.pre.alpha1 app/pb_kits/playbook/pb_radio/radio.rb
playbook_ui-7.13.0 app/pb_kits/playbook/pb_radio/radio.rb
playbook_ui-7.12.1 app/pb_kits/playbook/pb_radio/radio.rb
playbook_ui-7.12.0 app/pb_kits/playbook/pb_radio/radio.rb
playbook_ui-7.11.1 app/pb_kits/playbook/pb_radio/radio.rb
playbook_ui-7.11.0 app/pb_kits/playbook/pb_radio/radio.rb
playbook_ui-7.11.0.pre.alpha1 app/pb_kits/playbook/pb_radio/radio.rb
playbook_ui-7.10.0 app/pb_kits/playbook/pb_radio/radio.rb
playbook_ui-7.9.0 app/pb_kits/playbook/pb_radio/radio.rb
playbook_ui-7.8.4 app/pb_kits/playbook/pb_radio/radio.rb
playbook_ui-7.8.3 app/pb_kits/playbook/pb_radio/radio.rb
playbook_ui-7.8.2 app/pb_kits/playbook/pb_radio/radio.rb
playbook_ui-7.8.1 app/pb_kits/playbook/pb_radio/radio.rb
playbook_ui-7.8.0 app/pb_kits/playbook/pb_radio/radio.rb
playbook_ui-7.7.0.pre.alpha1 app/pb_kits/playbook/pb_radio/radio.rb