diff --git a/app/models/remote_theme.rb b/app/models/remote_theme.rb index cc47c35a32..53a4cd21a3 100644 --- a/app/models/remote_theme.rb +++ b/app/models/remote_theme.rb @@ -112,25 +112,6 @@ class RemoteTheme < ActiveRecord::Base end end - theme_info["fields"]&.each do |name, info| - unless Hash === info - info = { - "target" => :common, - "type" => :theme_var, - "value" => info - } - end - - if info["type"] == "color" - info["type"] = :theme_color_var - end - - theme.set_field(target: info["target"] || :common, - name: name, - value: info["value"], - type: info["type"] || :theme_var) - end - Theme.targets.keys.each do |target| next if target == :settings || target == :translations ALLOWED_FIELDS.each do |field| diff --git a/app/models/theme_field.rb b/app/models/theme_field.rb index 166cbdea63..5e0da4119c 100644 --- a/app/models/theme_field.rb +++ b/app/models/theme_field.rb @@ -41,13 +41,13 @@ class ThemeField < ActiveRecord::Base @types ||= Enum.new(html: 0, scss: 1, theme_upload_var: 2, - theme_color_var: 3, - theme_var: 4, + theme_color_var: 3, # No longer used + theme_var: 4, # No longer used yaml: 5) end def self.theme_var_type_ids - @theme_var_type_ids ||= [2, 3, 4] + @theme_var_type_ids ||= [2] end def self.force_recompilation! diff --git a/spec/models/theme_spec.rb b/spec/models/theme_spec.rb index 88604d06d4..1a4b758ee0 100644 --- a/spec/models/theme_spec.rb +++ b/spec/models/theme_spec.rb @@ -239,37 +239,7 @@ HTML end end - context 'theme vars' do - - it 'works in parent theme' do - theme.set_field(target: :common, name: :scss, value: 'body {color: $magic; }') - theme.set_field(target: :common, name: :magic, value: 'red', type: :theme_var) - theme.set_field(target: :common, name: :not_red, value: 'red', type: :theme_var) - theme.component = true - theme.save - - parent_theme = Fabricate(:theme) - parent_theme.set_field(target: :common, name: :scss, value: 'body {background-color: $not_red; }') - parent_theme.set_field(target: :common, name: :not_red, value: 'blue', type: :theme_var) - parent_theme.save - parent_theme.add_child_theme!(theme) - - scss, _map = Stylesheet::Compiler.compile('@import "theme_variables"; @import "desktop_theme"; ', "theme.scss", theme_id: parent_theme.id) - expect(scss).to include("color:red") - expect(scss).to include("background-color:blue") - end - - it 'can generate scss based off theme vars' do - theme.set_field(target: :common, name: :scss, value: 'body {color: $magic; content: quote($content)}') - theme.set_field(target: :common, name: :magic, value: 'red', type: :theme_var) - theme.set_field(target: :common, name: :content, value: 'Sam\'s Test', type: :theme_var) - theme.save - - scss, _map = Stylesheet::Compiler.compile('@import "theme_variables"; @import "desktop_theme"; ', "theme.scss", theme_id: theme.id) - expect(scss).to include("red") - expect(scss).to include('"Sam\'s Test"') - end - + context 'theme upload vars' do let :image do file_from_fixtures("logo.png") end