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:
Krzysztof Kotlarek
2019-11-28 16:19:01 +11:00
committed by GitHub
parent 7371b427cd
commit b120728999
19 changed files with 168 additions and 43 deletions

View File

@ -374,7 +374,7 @@ RSpec.describe ApplicationController do
expect(controller.theme_ids).to eq([theme2.id])
theme2.update!(user_selectable: false, component: true)
theme.add_child_theme!(theme2)
theme.add_relative_theme!(:child, theme2)
cookies['theme_ids'] = "#{theme.id},#{theme2.id}|#{user.user_option.theme_key_seq}"
get "/"