mirror of
https://github.com/discourse/discourse.git
synced 2025-06-05 14:07:30 +08:00
FEATURE: Ability to add components to all themes (#8404)
* FEATURE: Ability to add components to all themes This is the first and functional step from that topic https://dev.discourse.org/t/adding-a-theme-component-is-too-much-work/15398/16 The idea here is that when a new component is added, the user can easily assign it to all themes (parents). To achieve that, I needed to change a site-setting component to accept `setDefaultValues` action and `setDefaultValuesLabel` translated label. Also, I needed to add `allowAny` option to disable that for theme selector. I also refactored backend to accept both parent and child ids with one method to avoid duplication (Renamed `add_child_theme!` to more general `add_relative_theme!`) * FIX: Improvement after code review * FIX: Improvement after code review2 * FIX: use mapBy and filterBy directly
This commit is contained in:

committed by
GitHub

parent
7371b427cd
commit
b120728999
@ -40,7 +40,7 @@ describe Stylesheet::Manager do
|
||||
child_theme.set_field(target: :common, name: "embedded_scss", value: ".child_embedded{.scss{color: red;}}")
|
||||
child_theme.save!
|
||||
|
||||
theme.add_child_theme!(child_theme)
|
||||
theme.add_relative_theme!(:child, child_theme)
|
||||
|
||||
old_link = Stylesheet::Manager.stylesheet_link_tag(:desktop_theme, 'all', theme.id)
|
||||
|
||||
@ -88,7 +88,7 @@ describe Stylesheet::Manager do
|
||||
it "can correctly account for settings in theme's components" do
|
||||
theme = Fabricate(:theme)
|
||||
child = Fabricate(:theme, component: true)
|
||||
theme.add_child_theme!(child)
|
||||
theme.add_relative_theme!(:child, child)
|
||||
|
||||
child.set_field(target: :settings, name: :yaml, value: "childcolor: red")
|
||||
child.set_field(target: :common, name: :scss, value: "body {background-color: $childcolor}")
|
||||
|
Reference in New Issue
Block a user