1
0
Fork 0

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"; 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();

Datei anzeigen

@ -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

Datei anzeigen

@ -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" %>