mirror of
https://github.com/discourse/discourse.git
synced 2025-06-04 07:14:41 +08:00
Refactor theme fields so they support custom theme defined vars
This paves the way to allowing themes to specify uploads and so on.
This commit is contained in:
@ -19,12 +19,12 @@ describe Admin::StaffActionLogsController do
|
||||
context '.diff' do
|
||||
it 'can generate diffs for theme changes' do
|
||||
theme = Theme.new(user_id: -1, name: 'bob')
|
||||
theme.set_field(:mobile, :scss, 'body {.up}')
|
||||
theme.set_field(:common, :scss, 'omit-dupe')
|
||||
theme.set_field(target: :mobile, name: :scss, value: 'body {.up}')
|
||||
theme.set_field(target: :common, name: :scss, value: 'omit-dupe')
|
||||
|
||||
original_json = ThemeSerializer.new(theme, root: false).to_json
|
||||
|
||||
theme.set_field(:mobile, :scss, 'body {.down}')
|
||||
theme.set_field(target: :mobile, name: :scss, value: 'body {.down}')
|
||||
|
||||
record = StaffActionLogger.new(Discourse.system_user)
|
||||
.log_theme_change(original_json, theme)
|
||||
|
@ -14,8 +14,8 @@ describe Admin::ThemesController do
|
||||
context ' .index' do
|
||||
it 'returns success' do
|
||||
theme = Theme.new(name: 'my name', user_id: -1)
|
||||
theme.set_field(:common, :scss, '.body{color: black;}')
|
||||
theme.set_field(:desktop, :after_header, '<b>test</b>')
|
||||
theme.set_field(target: :common, name: :scss, value: '.body{color: black;}')
|
||||
theme.set_field(target: :desktop, name: :after_header, value: '<b>test</b>')
|
||||
|
||||
theme.remote_theme = RemoteTheme.new(
|
||||
remote_url: 'awesome.git',
|
||||
@ -71,7 +71,7 @@ describe Admin::ThemesController do
|
||||
it 'updates a theme' do
|
||||
#focus
|
||||
theme = Theme.new(name: 'my name', user_id: -1)
|
||||
theme.set_field(:common, :scss, '.body{color: black;}')
|
||||
theme.set_field(target: :common, name: :scss, value: '.body{color: black;}')
|
||||
theme.save
|
||||
|
||||
child_theme = Theme.create(name: 'my name', user_id: -1)
|
||||
|
Reference in New Issue
Block a user