Class: Head::Knob

Inherits:
ApplicationComponent show all
Defined in:
app/components/head/knob.rb

Instance Method Summary collapse

Methods inherited from ApplicationComponent

#initialize

Constructor Details

This class inherits a constructor from Head::ApplicationComponent

Instance Method Details

#classesObject



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

#groupObject



52
53
54
# File 'app/components/head/knob.rb', line 52

def group
  left? ? :left : :right
end

#iconObject



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_classObject



36
37
38
# File 'app/components/head/knob.rb', line 36

def icon_class
  "o-headicon--#{icon.to_sym.to_s.gsub('_', '-')}"
end

#idObject



22
23
24
# File 'app/components/head/knob.rb', line 22

def id
  manual_id || preset
end

#left?Boolean

Returns:

  • (Boolean)


56
57
58
# File 'app/components/head/knob.rb', line 56

def left?
  !right?
end

#preset_avatar?Boolean

Returns:

  • (Boolean)


80
81
82
# File 'app/components/head/knob.rb', line 80

def preset_avatar?
  preset == :avatar
end

#preset_help?Boolean

Returns:

  • (Boolean)


72
73
74
# File 'app/components/head/knob.rb', line 72

def preset_help?
  preset == :help
end

#preset_identicon?Boolean

Returns:

  • (Boolean)


76
77
78
# File 'app/components/head/knob.rb', line 76

def preset_identicon?
  preset == :identicon
end

#preset_mainmenu?Boolean

Returns:

  • (Boolean)


64
65
66
# File 'app/components/head/knob.rb', line 64

def preset_mainmenu?
  preset == :mainmenu
end

#preset_notifications?Boolean

Returns:

  • (Boolean)


84
85
86
# File 'app/components/head/knob.rb', line 84

def preset_notifications?
  preset == :notifications
end

#preset_search?Boolean

Returns:

  • (Boolean)


68
69
70
# File 'app/components/head/knob.rb', line 68

def preset_search?
  preset == :search
end

#preset_settings?Boolean

Returns:

  • (Boolean)


88
89
90
# File 'app/components/head/knob.rb', line 88

def preset_settings?
  preset == :settings
end

#right?Boolean

Returns:

  • (Boolean)


60
61
62
# File 'app/components/head/knob.rb', line 60

def right?
  @right
end

#urlObject



40
41
42
# File 'app/components/head/knob.rb', line 40

def url
  manual_url || options[:url] || '#'
end