settings_helper.rb 793 B

12345678910111213141516171819202122232425262728293031
  1. # frozen_string_literal: true
  2. module SettingsHelper
  3. def filterable_languages
  4. LanguagesHelper.sorted_locale_keys(LanguagesHelper::SUPPORTED_LOCALES.keys)
  5. end
  6. def ui_languages
  7. LanguagesHelper.sorted_locale_keys(I18n.available_locales)
  8. end
  9. def session_device_icon(session)
  10. device = session.detection.device
  11. if device.mobile?
  12. 'mobile'
  13. elsif device.tablet?
  14. 'tablet'
  15. else
  16. 'desktop'
  17. end
  18. end
  19. def compact_account_link_to(account)
  20. return if account.nil?
  21. link_to ActivityPub::TagManager.instance.url_for(account), class: 'name-tag', title: account.acct do
  22. safe_join([image_tag(account.avatar.url, width: 15, height: 15, alt: '', class: 'avatar'), content_tag(:span, account.acct, class: 'username')], ' ')
  23. end
  24. end
  25. end