mirror of
https://github.com/glitch-soc/mastodon.git
synced 2025-12-16 01:09:55 +00:00
Replace use_pack, layouts/theme and @theme by new helpers
Packs are now loaded from views, just like upstream, and are identified by their filenames. The definition of `theme.yml` has changed as such: - `pack_directory` is now required - `pack` is now unused - `signed_in_preload` has been introduced
This commit is contained in:
@@ -233,6 +233,21 @@ module ApplicationHelper
|
||||
EmojiFormatter.new(html, custom_emojis, other_options.merge(animate: prefers_autoplay?)).to_s
|
||||
end
|
||||
|
||||
# glitch-soc addition to handle the multiple flavors
|
||||
def preload_locale_pack
|
||||
supported_locales = Themes.instance.flavour(current_flavour)['locales']
|
||||
preload_pack_asset "locales/#{current_flavour}/#{I18n.locale}-json.js" if supported_locales.include?(I18n.locale.to_s)
|
||||
end
|
||||
|
||||
def flavoured_javascript_pack_tag(pack_name, **options)
|
||||
javascript_pack_tag("flavours/#{current_flavour}/#{pack_name}", **options)
|
||||
end
|
||||
|
||||
def preload_signed_in_js_packs
|
||||
preload_files = Themes.instance.flavour(current_flavour)&.fetch('signed_in_preload', nil) || []
|
||||
safe_join(preload_files.map { |entry| preload_pack_asset entry })
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def storage_host_var
|
||||
|
||||
Reference in New Issue
Block a user