Sha256: 5df4e8e71c272324d3c6b39acad5b1d472db7a061b7874f87e1d14dc079d0a6e
Contents?: true
Size: 1.5 KB
Versions: 3
Compression:
Stored size: 1.5 KB
Contents
# frozen_string_literal: true module Playbook module PbPill class Pill < Playbook::PbKit::Base PROPS = %i[configured_classname configured_data configured_id configured_text configured_variant].freeze def initialize(classname: default_configuration, data: default_configuration, id: default_configuration, text: default_configuration, variant: default_configuration) self.configured_classname = classname self.configured_data = data self.configured_id = id self.configured_text = text self.configured_variant = variant end def display_text pb_text = Playbook::PbBody::Body.new do text end ApplicationController.renderer.render(partial: pb_text, as: :object) end def kit_class kit_options = [ "pb_pill", variant, ] kit_options.join("_") end def to_partial_path "pb_pill/pill" end private def variant variant_options = %w[success warning error info neutral] one_of_value(configured_variant, variant_options, "neutral") end def text default_value(configured_text.downcase, "") end DEFAULT = Object.new private_constant :DEFAULT def default_configuration DEFAULT end attr_accessor(*PROPS) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
playbook_ui-2.8.4 | app/pb_kits/playbook/pb_pill/pill.rb |
playbook_ui-2.8.3 | app/pb_kits/playbook/pb_pill/pill.rb |
playbook_ui-2.8.1 | app/pb_kits/playbook/pb_pill/pill.rb |