From fa73a18363cd60aaf8579c9413c04d617aa02732 Mon Sep 17 00:00:00 2001 From: Penar Musaraj Date: Sat, 13 Mar 2021 02:57:18 -0500 Subject: [PATCH] Ensure SCSS compilation compatibility with core (#77) * WIP: Fix for new Discourse * Ensure SCSS compilation compatibility with core Co-authored-by: Faizaan Gagan --- plugin.rb | 11 ++++++++--- views/layouts/wizard.html.erb | 8 ++++---- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/plugin.rb b/plugin.rb index 91970d15..0a272aed 100644 --- a/plugin.rb +++ b/plugin.rb @@ -174,9 +174,14 @@ after_initialize do ::Wizard::Step.prepend CustomWizardStepExtension full_path = "#{Rails.root}/plugins/discourse-custom-wizard/assets/stylesheets/wizard/wizard_custom.scss" - DiscoursePluginRegistry.register_asset(full_path, {}, "wizard_custom") - Stylesheet::Importer.register_import("wizard_custom") do - import_files(DiscoursePluginRegistry.stylesheets["wizard_custom"]) + if Stylesheet::Importer.respond_to?(:plugin_assets) + Stylesheet::Importer.plugin_assets['wizard_custom'] = Set[full_path] + else + # legacy method, Discourse 2.7.0.beta5 and below + DiscoursePluginRegistry.register_asset(full_path, {}, "wizard_custom") + Stylesheet::Importer.register_import("wizard_custom") do + import_files(DiscoursePluginRegistry.stylesheets["wizard_custom"]) + end end CustomWizard::CustomField::CLASSES.keys.each do |klass| diff --git a/views/layouts/wizard.html.erb b/views/layouts/wizard.html.erb index 15ffbe65..6b1a4a4b 100644 --- a/views/layouts/wizard.html.erb +++ b/views/layouts/wizard.html.erb @@ -1,13 +1,13 @@ <%= discourse_color_scheme_stylesheets %> - + <%= 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 %> <%- end %> - + <%= preload_script "locales/#{I18n.locale}" %> <%= preload_script "ember_jquery" %> <%= preload_script "wizard-vendor" %> @@ -30,7 +30,7 @@ <%= tag.meta id: 'data-discourse-setup', data: client_side_setup_data %> "> - + <%= render partial: "layouts/head" %> <%= wizard_page_title %> @@ -40,7 +40,7 @@ <%- unless customization_disabled? %> <%= raw theme_lookup("header") %> <%- end %> - +
<%- unless customization_disabled? %>