From 04b2b87ea263638c8ef7acfd97fad7933d3b8b00 Mon Sep 17 00:00:00 2001 From: Faizaan Gagan Date: Fri, 19 Mar 2021 01:14:57 +0530 Subject: [PATCH] FIX: lookup for assets in the wizard specified theme (#79) --- controllers/custom_wizard/wizard.rb | 6 ++++++ views/layouts/wizard.html.erb | 6 +++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/controllers/custom_wizard/wizard.rb b/controllers/custom_wizard/wizard.rb index 38b16d3e..51b15f09 100644 --- a/controllers/custom_wizard/wizard.rb +++ b/controllers/custom_wizard/wizard.rb @@ -1,11 +1,13 @@ # frozen_string_literal: true class CustomWizard::WizardController < ::ApplicationController + include ApplicationHelper prepend_view_path(Rails.root.join('plugins', 'discourse-custom-wizard', 'views')) layout 'wizard' before_action :ensure_plugin_enabled helper_method :wizard_page_title helper_method :wizard_theme_ids + helper_method :wizard_theme_lookup def wizard CustomWizard::Wizard.create(params[:wizard_id].underscore, current_user) @@ -19,6 +21,10 @@ class CustomWizard::WizardController < ::ApplicationController wizard ? [wizard.theme_id] : nil end + def wizard_theme_lookup(name) + Theme.lookup_field(wizard_theme_ids, mobile_view? ? :mobile : :desktop, name) + end + def index respond_to do |format| format.json do diff --git a/views/layouts/wizard.html.erb b/views/layouts/wizard.html.erb index 6b1a4a4b..45551c59 100644 --- a/views/layouts/wizard.html.erb +++ b/views/layouts/wizard.html.erb @@ -22,7 +22,7 @@ <%- unless customization_disabled? %> <%= theme_translations_lookup %> - <%= raw theme_lookup("head_tag") %> + <%= raw wizard_theme_lookup("head_tag") %> <%- end %> <%= server_plugin_outlet "custom_wizard" %> @@ -38,13 +38,13 @@ <%- unless customization_disabled? %> - <%= raw theme_lookup("header") %> + <%= raw wizard_theme_lookup("header") %> <%- end %>
<%- unless customization_disabled? %> - <%= raw theme_lookup("body_tag") %> + <%= raw wizard_theme_lookup("body_tag") %> <%- end %> <%- if current_user %>