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

This commit is contained in:
Mark VanLandingham 2020-05-26 12:56:36 -05:00 committed by GitHub
parent a6189c5070
commit 7820686f73
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 2 deletions

View File

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

View File

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