0
0
Fork 1
Spiegel von https://github.com/paviliondev/discourse-custom-wizard.git synchronisiert 2024-11-22 09:20:29 +01:00

DEV: fix compatibility with core theme arch changes

Dieser Commit ist enthalten in:
Faizaan Gagan 2021-06-27 16:58:26 +05:30
Ursprung be86c77a77
Commit 9ec2da5a9f
3 geänderte Dateien mit 9 neuen und 9 gelöschten Zeilen

Datei anzeigen

@ -1,7 +1,7 @@
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" %>