Module: ActiveSessionsHelper

Defined in:
app/helpers/active_sessions_helper.rb

Instance Method Summary collapse

Instance Method Details

#active_session_device_type_icon(active_session) ⇒ Object

Maps a device type as defined in `ActiveSession` to an svg icon name and outputs the icon html.

see `DeviceDetector::Device::DEVICE_NAMES` about the available device types


8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'app/helpers/active_sessions_helper.rb', line 8

def active_session_device_type_icon(active_session)
  icon_name =
    case active_session.device_type
    when 'smartphone', 'feature phone', 'phablet'
      'mobile'
    when 'tablet'
      'tablet'
    when 'tv', 'smart display', 'camera', 'portable media player', 'console'
      'media'
    when 'car browser'
      'car'
    else
      'monitor-o'
    end

  sprite_icon(icon_name, css_class: 'gl-mt-2')
end