Class: Playbook::PbUserBadge::UserBadge

Inherits:
Playbook::PbKit::Base show all
Includes:
ActionView::Helpers::AssetTagHelper
Defined in:
app/pb_kits/playbook/pb_user_badge/user_badge.rb

Constant Summary collapse

PROPS =
%i[configured_badge
configured_classname
configured_data
configured_id
configured_size].freeze

Instance Method Summary collapse

Methods inherited from Playbook::PbKit::Base

#adjusted_value, #aria, #classname, #concat_value, #data, #default_value, #false_value, #id, #is_boolean?, #is_integer?, #is_set?, #is_string?, #is_true?, #merge_value, #one_of?, #one_of_value, #true_value

Constructor Details

#initialize(badge: default_configuration, classname: default_configuration, data: default_configuration, id: default_configuration, size: default_configuration) ⇒ UserBadge

Returns a new instance of UserBadge.



14
15
16
17
18
19
20
21
22
23
24
# File 'app/pb_kits/playbook/pb_user_badge/user_badge.rb', line 14

def initialize(badge: default_configuration,
               classname: default_configuration,
               data: default_configuration,
               id: default_configuration,
               size: default_configuration)
  self.configured_badge = badge
  self.configured_classname = classname
  self.configured_data = data
  self.configured_id = id
  self.configured_size = size
end

Instance Method Details

#display_badgeObject



26
27
28
# File 'app/pb_kits/playbook/pb_user_badge/user_badge.rb', line 26

def display_badge
  "pb_user_badge/badges/#{badge}" if is_set? configured_badge
end

#kit_classObject



30
31
32
33
34
35
36
# File 'app/pb_kits/playbook/pb_user_badge/user_badge.rb', line 30

def kit_class
  kit_options = [
    "pb_user_badge_kit",
    size,
  ]
  kit_options.join("_")
end

#to_partial_pathObject



38
39
40
# File 'app/pb_kits/playbook/pb_user_badge/user_badge.rb', line 38

def to_partial_path
  "pb_user_badge/user_badge"
end