Spiegel von
https://github.com/paviliondev/discourse-custom-wizard.git
synchronisiert 2024-11-25 10:40:28 +01:00
Merge pull request #128 from paviliondev/fix-theme-lookup
DEV: fix compatibility with core theme architecture changes
Dieser Commit ist enthalten in:
Commit
262f2d5628
3 geänderte Dateien mit 12 neuen und 9 gelöschten Zeilen
|
@ -1,7 +1,10 @@
|
||||||
import I18n from "I18n";
|
import I18n from "I18n";
|
||||||
|
|
||||||
const getThemeId = () => {
|
const getThemeId = () => {
|
||||||
let themeId = parseInt($("meta[name=discourse_theme_ids]")[0].content, 10);
|
let themeId = parseInt(
|
||||||
|
document.querySelector("meta[name=discourse_theme_id]").content,
|
||||||
|
10
|
||||||
|
);
|
||||||
|
|
||||||
if (!isNaN(themeId)) {
|
if (!isNaN(themeId)) {
|
||||||
return themeId.toString();
|
return themeId.toString();
|
||||||
|
|
|
@ -6,7 +6,7 @@ class CustomWizard::WizardController < ::ApplicationController
|
||||||
|
|
||||||
before_action :ensure_plugin_enabled
|
before_action :ensure_plugin_enabled
|
||||||
helper_method :wizard_page_title
|
helper_method :wizard_page_title
|
||||||
helper_method :wizard_theme_ids
|
helper_method :wizard_theme_id
|
||||||
helper_method :wizard_theme_lookup
|
helper_method :wizard_theme_lookup
|
||||||
helper_method :wizard_theme_translations_lookup
|
helper_method :wizard_theme_translations_lookup
|
||||||
|
|
||||||
|
@ -20,16 +20,16 @@ class CustomWizard::WizardController < ::ApplicationController
|
||||||
wizard ? (wizard.name || wizard.id) : I18n.t('wizard.custom_title')
|
wizard ? (wizard.name || wizard.id) : I18n.t('wizard.custom_title')
|
||||||
end
|
end
|
||||||
|
|
||||||
def wizard_theme_ids
|
def wizard_theme_id
|
||||||
wizard ? [wizard.theme_id] : nil
|
wizard ? wizard.theme_id : nil
|
||||||
end
|
end
|
||||||
|
|
||||||
def wizard_theme_lookup(name)
|
def wizard_theme_lookup(name)
|
||||||
Theme.lookup_field(wizard_theme_ids, mobile_view? ? :mobile : :desktop, name)
|
Theme.lookup_field(wizard_theme_id, mobile_view? ? :mobile : :desktop, name)
|
||||||
end
|
end
|
||||||
|
|
||||||
def wizard_theme_translations_lookup
|
def wizard_theme_translations_lookup
|
||||||
Theme.lookup_field(wizard_theme_ids, :translations, I18n.locale)
|
Theme.lookup_field(wizard_theme_id, :translations, I18n.locale)
|
||||||
end
|
end
|
||||||
|
|
||||||
def index
|
def index
|
||||||
|
|
|
@ -4,8 +4,8 @@
|
||||||
|
|
||||||
<%= discourse_stylesheet_link_tag :wizard, theme_id: nil %>
|
<%= discourse_stylesheet_link_tag :wizard, theme_id: nil %>
|
||||||
<%= discourse_stylesheet_link_tag :wizard_custom %>
|
<%= discourse_stylesheet_link_tag :wizard_custom %>
|
||||||
<%- if wizard_theme_ids.present? %>
|
<%- if wizard_theme_id.present? %>
|
||||||
<%= discourse_stylesheet_link_tag (mobile_view? ? :mobile_theme : :desktop_theme), theme_ids: wizard_theme_ids %>
|
<%= discourse_stylesheet_link_tag (mobile_view? ? :mobile_theme : :desktop_theme), theme_id: wizard_theme_id %>
|
||||||
<%- end %>
|
<%- end %>
|
||||||
|
|
||||||
<%= preload_script "locales/#{I18n.locale}" %>
|
<%= preload_script "locales/#{I18n.locale}" %>
|
||||||
|
@ -29,7 +29,7 @@
|
||||||
|
|
||||||
<%= tag.meta id: 'data-discourse-setup', data: client_side_setup_data %>
|
<%= tag.meta id: 'data-discourse-setup', data: client_side_setup_data %>
|
||||||
|
|
||||||
<meta name="discourse_theme_ids" content="<%= wizard_theme_ids&.join(",") %>">
|
<meta name="discourse_theme_id" content="<%= wizard_theme_id %>">
|
||||||
<meta name="discourse-base-uri" content="<%= Discourse.base_path %>">
|
<meta name="discourse-base-uri" content="<%= Discourse.base_path %>">
|
||||||
|
|
||||||
<%= render partial: "layouts/head" %>
|
<%= render partial: "layouts/head" %>
|
||||||
|
|
Laden …
In neuem Issue referenzieren