Class: Head::Knob
Instance Method Summary
collapse
#initialize
Instance Method Details
#classes ⇒ Object
44
45
46
47
48
49
50
|
# File 'app/components/head/knob.rb', line 44
def classes
result = %w[c-head-knob js-head-knob]
result.push 'c-head-knob--identicon' if preset_identicon?
result.push 'c-head-knob--avatar' if preset_avatar?
result.push 'c-head-knob--mainmenu' if preset_mainmenu?
result
end
|
#group ⇒ Object
52
53
54
|
# File 'app/components/head/knob.rb', line 52
def group
left? ? :left : :right
end
|
#icon ⇒ Object
26
27
28
29
30
31
32
33
34
|
# File 'app/components/head/knob.rb', line 26
def icon
return manual_icon if manual_icon
return :'bars-thin' if preset_mainmenu?
return :bell if preset_notifications?
return :gear if preset_settings?
return :'question-mark' if preset_help?
:magnifier if preset_search?
end
|
#icon_class ⇒ Object
36
37
38
|
# File 'app/components/head/knob.rb', line 36
def icon_class
"o-headicon--#{icon.to_sym.to_s.gsub('_', '-')}"
end
|
#id ⇒ Object
22
23
24
|
# File 'app/components/head/knob.rb', line 22
def id
manual_id || preset
end
|
#left? ⇒ Boolean
56
57
58
|
# File 'app/components/head/knob.rb', line 56
def left?
!right?
end
|
#preset_avatar? ⇒ Boolean
80
81
82
|
# File 'app/components/head/knob.rb', line 80
def preset_avatar?
preset == :avatar
end
|
#preset_help? ⇒ Boolean
72
73
74
|
# File 'app/components/head/knob.rb', line 72
def preset_help?
preset == :help
end
|
#preset_identicon? ⇒ Boolean
76
77
78
|
# File 'app/components/head/knob.rb', line 76
def preset_identicon?
preset == :identicon
end
|
#preset_mainmenu? ⇒ Boolean
64
65
66
|
# File 'app/components/head/knob.rb', line 64
def preset_mainmenu?
preset == :mainmenu
end
|
#preset_notifications? ⇒ Boolean
84
85
86
|
# File 'app/components/head/knob.rb', line 84
def preset_notifications?
preset == :notifications
end
|
#preset_search? ⇒ Boolean
68
69
70
|
# File 'app/components/head/knob.rb', line 68
def preset_search?
preset == :search
end
|
#preset_settings? ⇒ Boolean
88
89
90
|
# File 'app/components/head/knob.rb', line 88
def preset_settings?
preset == :settings
end
|
#right? ⇒ Boolean
60
61
62
|
# File 'app/components/head/knob.rb', line 60
def right?
@right
end
|
#url ⇒ Object
40
41
42
|
# File 'app/components/head/knob.rb', line 40
def url
manual_url || options[:url] || '#'
end
|