diff --git a/app/controllers/admin/designs_controller.rb b/app/controllers/admin/designs_controller.rb index 0b94317e..a3824950 100644 --- a/app/controllers/admin/designs_controller.rb +++ b/app/controllers/admin/designs_controller.rb @@ -52,7 +52,7 @@ class Admin::DesignsController < OrbitBackendController case params[:type] when 'layout', 'css_default', 'css_reset' @object = @design.send(params[:type]) - when 'image', 'javascript', 'theme' + when 'javascripts', 'themes'#, 'images' @object = @design.send(params[:type]).find(params[:object_id]) end diff --git a/app/models/design/design.rb b/app/models/design/design.rb index 0013082d..774750e7 100644 --- a/app/models/design/design.rb +++ b/app/models/design/design.rb @@ -11,7 +11,7 @@ class Design has_one :css_default, as: :css, :autosave => true, :dependent => :destroy has_one :layout, :autosave => true, :dependent => :destroy has_one :css_reset, :autosave => true, :dependent => :destroy - has_many :images,as: :imgs, :autosave => true, :dependent => :destroy + has_many :images, as: :imgs, :autosave => true, :dependent => :destroy has_many :javascripts, as: :js, :autosave => true, :dependent => :destroy has_many :pages has_many :themes, as: :css, :autosave => true, :dependent => :destroy diff --git a/app/models/design/stylesheet.rb b/app/models/design/stylesheet.rb index 5e9a5775..76fdff78 100644 --- a/app/models/design/stylesheet.rb +++ b/app/models/design/stylesheet.rb @@ -7,7 +7,12 @@ class Stylesheet < DesignFile # self.remove_file! # self.remove_file_orig! names = {} - images = self.css.images + case self._type + when 'Theme' + images = self.design.images + when 'CssDefault' + images = self.css.images + end content.scan(/(?<=url)(.*?)(?=\))/){ css_name = $1.gsub(' ','').gsub('(','') unless names.has_key?(css_name) diff --git a/app/views/admin/designs/edit.html.erb b/app/views/admin/designs/edit.html.erb index c49c5fb4..2a710dd0 100644 --- a/app/views/admin/designs/edit.html.erb +++ b/app/views/admin/designs/edit.html.erb @@ -34,10 +34,10 @@