mirror of
https://git.bsd.gay/fef/nyastodon.git
synced 2025-01-09 10:57:00 +01:00
7208edbd37
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
24 lines
733 B
Ruby
24 lines
733 B
Ruby
# frozen_string_literal: true
|
|
|
|
module ThemingConcern
|
|
extend ActiveSupport::Concern
|
|
|
|
private
|
|
|
|
def current_flavour
|
|
@current_flavour ||= [current_user&.setting_flavour, Setting.flavour, 'glitch', 'vanilla'].find { |flavour| Themes.instance.flavours.include?(flavour) }
|
|
end
|
|
|
|
def current_skin
|
|
@current_skin ||= begin
|
|
skins = Themes.instance.skins_for(current_flavour)
|
|
[current_user&.setting_skin, Setting.skin, 'default'].find { |skin| skins.include?(skin) }
|
|
end
|
|
end
|
|
|
|
def current_theme
|
|
# NOTE: this is slightly different from upstream, as it's a derived value used
|
|
# for the sole purpose of pointing to the appropriate stylesheet pack
|
|
"skins/#{current_flavour}/#{current_skin}"
|
|
end
|
|
end
|