Sha256: 3ac7714bd64a94bd401aca81b9e345366833ae11ed940fab959e4667d13ce4ba

Contents?: true

Size: 1.05 KB

Versions: 34

Compression:

Stored size: 1.05 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 :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 input
        check_box_tag(name, value, checked)
      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

34 entries across 34 versions & 1 rubygems

Version Path
playbook_ui-7.3.0.pre.alpha2 app/pb_kits/playbook/pb_radio/radio.rb
playbook_ui-6.7.0.pre.alpha1 app/pb_kits/playbook/pb_radio/radio.rb
playbook_ui-6.7.0 app/pb_kits/playbook/pb_radio/radio.rb
playbook_ui-6.6.1 app/pb_kits/playbook/pb_radio/radio.rb
playbook_ui-7.0.0.pre.alpha10 app/pb_kits/playbook/pb_radio/radio.rb
playbook_ui-6.6.0 app/pb_kits/playbook/pb_radio/radio.rb
playbook_ui-6.5.2 app/pb_kits/playbook/pb_radio/radio.rb
playbook_ui-7.0.1.pre.alpha12 app/pb_kits/playbook/pb_radio/radio.rb
playbook_ui-7.0.1.pre.alpha11 app/pb_kits/playbook/pb_radio/radio.rb
playbook_ui-7.0.1.pre.alpha10 app/pb_kits/playbook/pb_radio/radio.rb
playbook_ui-7.0.1.pre.alpha9 app/pb_kits/playbook/pb_radio/radio.rb
playbook_ui-6.5.1 app/pb_kits/playbook/pb_radio/radio.rb
playbook_ui-6.5.0 app/pb_kits/playbook/pb_radio/radio.rb
playbook_ui-7.0.1.pre.alpha8 app/pb_kits/playbook/pb_radio/radio.rb
playbook_ui-7.0.1.pre.alpha7 app/pb_kits/playbook/pb_radio/radio.rb
playbook_ui-7.0.1.pre.alpha6 app/pb_kits/playbook/pb_radio/radio.rb
playbook_ui-7.0.1.pre.alpha5 app/pb_kits/playbook/pb_radio/radio.rb
playbook_ui-7.0.1.pre.alpha4 app/pb_kits/playbook/pb_radio/radio.rb
playbook_ui-7.0.1.pre.alpha3 app/pb_kits/playbook/pb_radio/radio.rb
playbook_ui-7.0.1.pre.alpha2 app/pb_kits/playbook/pb_radio/radio.rb