2016-11-19 10:19:57 +11:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module SettingsHelper
|
2017-09-08 20:32:22 +10:00
|
|
|
def filterable_languages
|
2021-11-25 23:07:38 +11:00
|
|
|
LanguageDetector.instance.language_names.select(&LanguagesHelper::HUMAN_LOCALES.method(:key?))
|
2017-09-08 20:32:22 +10:00
|
|
|
end
|
|
|
|
|
2017-01-13 06:46:24 +11:00
|
|
|
def hash_to_object(hash)
|
|
|
|
HashObject.new(hash)
|
|
|
|
end
|
2017-06-26 00:54:30 +10:00
|
|
|
|
|
|
|
def session_device_icon(session)
|
|
|
|
device = session.detection.device
|
|
|
|
|
|
|
|
if device.mobile?
|
|
|
|
'mobile'
|
|
|
|
elsif device.tablet?
|
|
|
|
'tablet'
|
|
|
|
else
|
|
|
|
'desktop'
|
|
|
|
end
|
|
|
|
end
|
2019-09-20 04:58:19 +10:00
|
|
|
|
|
|
|
def compact_account_link_to(account)
|
|
|
|
return if account.nil?
|
|
|
|
|
|
|
|
link_to ActivityPub::TagManager.instance.url_for(account), class: 'name-tag', title: account.acct do
|
|
|
|
safe_join([image_tag(account.avatar.url, width: 15, height: 15, alt: display_name(account), class: 'avatar'), content_tag(:span, account.acct, class: 'username')], ' ')
|
|
|
|
end
|
|
|
|
end
|
2020-04-20 22:03:03 +10:00
|
|
|
|
|
|
|
def picture_hint(hint, picture)
|
|
|
|
if picture.original_filename.nil?
|
|
|
|
hint
|
|
|
|
else
|
|
|
|
link = link_to t('generic.delete'), settings_profile_picture_path(picture.name.to_s), data: { method: :delete }
|
|
|
|
safe_join([hint, link], '<br/>'.html_safe)
|
|
|
|
end
|
|
|
|
end
|
2016-11-19 10:19:57 +11:00
|
|
|
end
|