gearheads
/
mastodon
Archived
2
0
Fork 0

Add fa-fw class to user agent icon (#4047)

gh/stable
Yamagishi Kazutoshi 2017-07-03 18:04:35 +09:00 committed by Eugen Rochko
parent a6d02cff36
commit 92f1c474f3
2 changed files with 10 additions and 5 deletions

View File

@ -31,7 +31,11 @@ module ApplicationHelper
Rails.env.production? ? site_title : "#{site_title} (Dev)"
end
def fa_icon(icon)
content_tag(:i, nil, class: 'fa ' + icon.split(' ').map { |cl| "fa-#{cl}" }.join(' '))
def fa_icon(icon, attributes = {})
class_names = attributes[:class]&.split(' ') || []
class_names << 'fa'
class_names += icon.split(' ').map { |cl| "fa-#{cl}" }
content_tag(:i, nil, attributes.merge(class: class_names.join(' ')))
end
end

View File

@ -11,7 +11,8 @@
- @sessions.each do |session|
%tr
%td
%span{ title: session.user_agent }= fa_icon session_device_icon(session)
%span{ title: session.user_agent }<
= fa_icon "#{session_device_icon(session)} fw", 'aria-label' => session_device_icon(session)
= ' '
= t 'sessions.description', browser: t("sessions.browsers.#{session.browser}"), platform: t("sessions.platforms.#{session.platform}")
%td