0
0
Fork 1
Spiegel von https://github.com/paviliondev/discourse-custom-wizard.git synchronisiert 2024-09-19 23:31:11 +02:00

Support discourse client theme color schemes

This allows for color scheme switching via theme switching (e.g. for user selected dark modes). See further https://thepavilion.io/t/allow-wizard-themes-to-support-default-dark-mode-variables/3710
Dieser Commit ist enthalten in:
angusmcleod 2021-02-08 13:07:21 +11:00
Ursprung 2681fe21ad
Commit 6849c368f0
2 geänderte Dateien mit 7 neuen und 5 gelöschten Zeilen

Datei anzeigen

@ -4,7 +4,7 @@ class CustomWizard::WizardController < ::ApplicationController
before_action :ensure_plugin_enabled
helper_method :wizard_page_title
helper_method :theme_ids
helper_method :wizard_theme_ids
def wizard
CustomWizard::Wizard.create(params[:wizard_id].underscore, current_user)
@ -14,7 +14,7 @@ class CustomWizard::WizardController < ::ApplicationController
wizard ? (wizard.name || wizard.id) : I18n.t('wizard.custom_title')
end
def theme_ids
def wizard_theme_ids
wizard ? [wizard.theme_id] : nil
end

Datei anzeigen

@ -1,9 +1,11 @@
<html>
<head>
<%= discourse_color_scheme_stylesheets %>
<%= discourse_stylesheet_link_tag :wizard, theme_id: nil %>
<%= discourse_stylesheet_link_tag :wizard_custom %>
<%- if theme_ids.present? %>
<%= discourse_stylesheet_link_tag (mobile_view? ? :mobile_theme : :desktop_theme) %>
<%- if wizard_theme_ids.present? %>
<%= discourse_stylesheet_link_tag (mobile_view? ? :mobile_theme : :desktop_theme), theme_ids: wizard_theme_ids %>
<%- end %>
<%= preload_script "locales/#{I18n.locale}" %>
@ -27,7 +29,7 @@
<%= tag.meta id: 'data-discourse-setup', data: client_side_setup_data %>
<meta name="discourse_theme_ids" content="<%= theme_ids&.join(",") %>">
<meta name="discourse_theme_ids" content="<%= wizard_theme_ids&.join(",") %>">
<meta name="discourse-base-uri" content="<%= Discourse.base_uri %>">
<%= render partial: "layouts/head" %>