Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexis Reigel ( 🌴 may 2nd - may 9th 🌴 ) <mail@koffeinfrei.org>2018-05-02 11:08:16 +0300
committerDouwe Maan <douwe@gitlab.com>2018-05-02 11:08:16 +0300
commit9b33e3d36fcd46072b9fe83f1121fb0fd87c0fd7 (patch)
tree968009edb90046874d6c9d733239f77f42d19cdf /app/helpers/active_sessions_helper.rb
parentd812ef0170ba2b482f096772d2307c64a7f6fc94 (diff)
Display and revoke active sessions
Diffstat (limited to 'app/helpers/active_sessions_helper.rb')
-rw-r--r--app/helpers/active_sessions_helper.rb23
1 files changed, 23 insertions, 0 deletions
diff --git a/app/helpers/active_sessions_helper.rb b/app/helpers/active_sessions_helper.rb
new file mode 100644
index 00000000000..97b6dac67c5
--- /dev/null
+++ b/app/helpers/active_sessions_helper.rb
@@ -0,0 +1,23 @@
+module ActiveSessionsHelper
+ # 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
+ 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, size: 16, css_class: 'prepend-top-2')
+ end
+end