Class: Playbook::PbSource::Source
- Inherits:
-
Object
- Object
- Playbook::PbSource::Source
show all
- Includes:
- Playbook::Props
- Defined in:
- app/pb_kits/playbook/pb_source/source.rb
Instance Method Summary
collapse
#dark_props, #generate_classname, #generate_classname_without_spacing, #initialize, #prop, #spacing_options, #spacing_props, #spacing_values
Instance Method Details
#avatar ⇒ Object
30
31
32
33
34
35
36
37
|
# File 'app/pb_kits/playbook/pb_source/source.rb', line 30
def avatar
if user.present? && (type == "user" || type == "referral")
avatar_props = user.clone
avatar_props[:size] = "sm"
avatar_props.delete(:user_id)
avatar_props
end
end
|
#classname ⇒ Object
60
61
62
|
# File 'app/pb_kits/playbook/pb_source/source.rb', line 60
def classname
generate_classname("pb_source_kit")
end
|
26
27
28
|
# File 'app/pb_kits/playbook/pb_source/source.rb', line 26
def show_icon?
!type_icon_name.nil? && avatar.nil?
end
|
#type_icon_name ⇒ Object
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
# File 'app/pb_kits/playbook/pb_source/source.rb', line 43
def type_icon_name
case type
when "retail"
"shopping-bag"
when "inbound"
"sign-in"
when "outbound"
"sign-out"
when "prospecting"
"binoculars"
when "events"
"calendar-alt"
when "referral"
"handshake"
end
end
|
#type_text ⇒ Object
18
19
20
21
22
23
24
|
# File 'app/pb_kits/playbook/pb_source/source.rb', line 18
def type_text
if type == "user" || (type == "referral" && user.present?)
user[:name]
else
type.titleize
end
end
|
#user_id ⇒ Object
39
40
41
|
# File 'app/pb_kits/playbook/pb_source/source.rb', line 39
def user_id
user.dig(:user_id)
end
|