mirror of
https://github.com/discourse/discourse.git
synced 2025-01-18 15:35:31 +08:00
94b09f3331
Why this change? The `/admin/customize/themes/:id/schema/name` route is a work in progress but we want to be able to start navigating to it from the `/admin/customize/themes/:id` route. What does this change do? 1. Move `adminCustomizeThemes.schema` to a child route of `adminCustomizeThemes.show`. This is because we need the model from the parent route and if it isn't a child route we end up having to load the theme model again from the server. 1. Add the `objects_schema` attribute to `ThemeSettingsSerializer` 1. Refactor `SiteSettingComponent` to be able to render a button so that we don't have to hardcode the button rendering into the `SiteSettings::String` component
23 lines
701 B
Ruby
23 lines
701 B
Ruby
# frozen_string_literal: true
|
|
|
|
RSpec.describe ThemeSettingsSerializer do
|
|
fab!(:theme)
|
|
|
|
describe "#objects_schema" do
|
|
let(:objects_setting) do
|
|
yaml = File.read("#{Rails.root}/spec/fixtures/theme_settings/objects_settings.yaml")
|
|
theme.set_field(target: :settings, name: "yaml", value: yaml)
|
|
theme.save!
|
|
theme.settings[:objects_setting]
|
|
end
|
|
|
|
before { SiteSetting.experimental_objects_type_for_theme_settings = true }
|
|
|
|
it "should include the attribute when theme setting is typed objects" do
|
|
payload = ThemeSettingsSerializer.new(objects_setting).as_json
|
|
|
|
expect(payload[:theme_settings][:objects_schema][:name]).to eq("sections")
|
|
end
|
|
end
|
|
end
|