mirror of
https://github.com/discourse/discourse.git
synced 2025-01-18 10:52:45 +08:00
FIX: Wizard previews if color step is excluded (#9881)
This commit is contained in:
parent
a6189c5070
commit
7820686f73
|
@ -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");
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue
Block a user