Skip to content

A platform for community discussion. Free, open, simple.

FIX: Wizard previews if color step is excluded (#9881)

Mark VanLandingham7820686f7397
diff --git a/app/assets/javascripts/wizard/models/wizard.js b/app/assets/javascripts/wizard/models/wizard.js
index e907687e11a..69d166bf7a0 100644
--- a/app/assets/javascripts/wizard/models/wizard.js
+++ b/app/assets/javascripts/wizard/models/wizard.js
@@ -28,7 +28,7 @@ const Wizard = EmberObject.extend({
getCurrentColors(schemeId) {
const colorStep = this.steps.findBy("id", "colors");
if (!colorStep) {
- return;
+ return this.current_color_scheme;
}
const themeChoice = colorStep.get("fieldsById.theme_previews");
diff --git a/app/serializers/wizard_serializer.rb b/app/serializers/wizard_serializer.rb
index d830ad73256..6ffe49a1f93 100644
--- a/app/serializers/wizard_serializer.rb
+++ b/app/serializers/wizard_serializer.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
class WizardSerializer < ApplicationSerializer
- attributes :start, :completed
+ attributes :start, :completed, :current_color_scheme
has_many :steps, serializer: WizardStepSerializer, embed: :objects
@@ -12,4 +12,14 @@ class WizardSerializer < ApplicationSerializer
def completed
object.completed?
end
+
+ def current_color_scheme
+ color_scheme = Theme.find(SiteSetting.default_theme_id).color_scheme
+ colors = color_scheme ? color_scheme.colors : ColorScheme.base_colors
+
+ # The frontend expects the color hexs to start with '#'
+ colors_with_hash = {}
+ colors.each { |color, hex| colors_with_hash[color] = "##{hex}" }
+ colors_with_hash
+ end
end