1
0
Fork 0

Merge pull request #128 from paviliondev/fix-theme-lookup

DEV: fix compatibility with core theme architecture changes
Dieser Commit ist enthalten in:
Angus McLeod 2021-06-28 17:18:27 +10:00 committet von GitHub
Commit 262f2d5628
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 4AEE18F83AFDEB23
3 geänderte Dateien mit 12 neuen und 9 gelöschten Zeilen

Datei anzeigen

@ -1,7 +1,10 @@
import I18n from "I18n";
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)) {
return themeId.toString();

Datei anzeigen

@ -6,7 +6,7 @@ class CustomWizard::WizardController < ::ApplicationController
before_action :ensure_plugin_enabled
helper_method :wizard_page_title
helper_method :wizard_theme_ids
helper_method :wizard_theme_id
helper_method :wizard_theme_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')
end
def wizard_theme_ids
wizard ? [wizard.theme_id] : nil
def wizard_theme_id
wizard ? wizard.theme_id : nil
end
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
def wizard_theme_translations_lookup
Theme.lookup_field(wizard_theme_ids, :translations, I18n.locale)
Theme.lookup_field(wizard_theme_id, :translations, I18n.locale)
end
def index

Datei anzeigen

@ -4,8 +4,8 @@
<%= discourse_stylesheet_link_tag :wizard, theme_id: nil %>
<%= discourse_stylesheet_link_tag :wizard_custom %>
<%- if wizard_theme_ids.present? %>
<%= discourse_stylesheet_link_tag (mobile_view? ? :mobile_theme : :desktop_theme), theme_ids: wizard_theme_ids %>
<%- if wizard_theme_id.present? %>
<%= discourse_stylesheet_link_tag (mobile_view? ? :mobile_theme : :desktop_theme), theme_id: wizard_theme_id %>
<%- end %>
<%= preload_script "locales/#{I18n.locale}" %>
@ -29,7 +29,7 @@
<%= 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 %>">
<%= render partial: "layouts/head" %>