mirror of
https://git.kescher.at/CatCatNya/catstodon.git
synced 2024-11-23 12:18:06 +01:00
a6147a831f
Conflicts: - `app/lib/themes.rb` - `app/views/layouts/application.html.haml` - `app/views/layouts/embedded.html.haml` - `app/views/layouts/error.html.haml` - `config/settings.yml` All these conflicts are because glitch-soc and upstream have different theming systems and upstream changed a few things to have dynamic theme selection based on system settings. Conflicts were solved to take that into account, and `current_theme` has been changed in the process to return a tuple of `[flavour, skin]` to be used in the `theme_style_tags` helper.
24 lines
732 B
Ruby
24 lines
732 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, 'system', '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
|
|
[current_flavour, current_skin]
|
|
end
|
|
end
|