2016-11-18 18:19:57 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module SettingsHelper
|
2017-09-08 06:32:22 -04:00
|
|
|
def filterable_languages
|
2023-10-04 03:23:50 -04:00
|
|
|
LanguagesHelper.sorted_locale_keys(LanguagesHelper::SUPPORTED_LOCALES.keys)
|
|
|
|
end
|
|
|
|
|
|
|
|
def ui_languages
|
|
|
|
LanguagesHelper.sorted_locale_keys(I18n.available_locales)
|
2017-09-08 06:32:22 -04:00
|
|
|
end
|
|
|
|
|
2024-01-11 05:45:26 -05:00
|
|
|
def featured_tags_hint(recently_used_tags)
|
2024-09-27 04:18:42 -04:00
|
|
|
recently_used_tags.present? &&
|
|
|
|
safe_join(
|
|
|
|
[
|
|
|
|
t('simple_form.hints.featured_tag.name'),
|
|
|
|
safe_join(
|
|
|
|
links_for_featured_tags(recently_used_tags),
|
|
|
|
', '
|
|
|
|
),
|
|
|
|
],
|
|
|
|
' '
|
|
|
|
)
|
2024-01-11 05:45:26 -05:00
|
|
|
end
|
|
|
|
|
2017-06-25 10:54:30 -04:00
|
|
|
def session_device_icon(session)
|
|
|
|
device = session.detection.device
|
|
|
|
|
|
|
|
if device.mobile?
|
2024-08-20 07:52:45 -04:00
|
|
|
'smartphone'
|
2017-06-25 10:54:30 -04:00
|
|
|
elsif device.tablet?
|
|
|
|
'tablet'
|
|
|
|
else
|
2024-08-20 07:52:45 -04:00
|
|
|
'desktop_mac'
|
2017-06-25 10:54:30 -04:00
|
|
|
end
|
|
|
|
end
|
2019-09-19 14:58:19 -04: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
|
2023-11-07 16:46:08 -05:00
|
|
|
safe_join([image_tag(account.avatar.url, width: 15, height: 15, alt: '', class: 'avatar'), content_tag(:span, account.acct, class: 'username')], ' ')
|
2019-09-19 14:58:19 -04:00
|
|
|
end
|
|
|
|
end
|
2024-01-11 05:45:26 -05:00
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def links_for_featured_tags(tags)
|
|
|
|
tags.map { |tag| post_link_to_featured_tag(tag) }
|
|
|
|
end
|
|
|
|
|
|
|
|
def post_link_to_featured_tag(tag)
|
|
|
|
link_to(
|
|
|
|
"##{tag.display_name}",
|
|
|
|
settings_featured_tags_path(featured_tag: { name: tag.name }),
|
|
|
|
method: :post
|
|
|
|
)
|
|
|
|
end
|
2016-11-18 18:19:57 -05:00
|
|
|
end
|