diff --git a/app/controllers/admin/designs_controller.rb b/app/controllers/admin/designs_controller.rb index 0b94317eb..a3824950a 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 0013082d9..774750e70 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 5e9a57750..76fdff783 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 c49c5fb4b..2a710dd0d 100644 --- a/app/views/admin/designs/edit.html.erb +++ b/app/views/admin/designs/edit.html.erb @@ -34,10 +34,10 @@
<%= render :partial => 'tab_form', :locals => {:type => :css_default, :object => @design.css_default} %>
<%= render :partial => 'tab_form', :locals => {:type => :css_reset, :object => @design.css_reset} %>
<% @design.themes.each do |theme| %> -
<%= render :partial => 'tab_form', :locals => {:type => :css_reset, :object => theme} %>
+
<%= render :partial => 'tab_form', :locals => {:type => :themes, :object => theme} %>
<% end %> <% @design.javascripts.each do |js| %> -
<%= render :partial => 'tab_form', :locals => {:type => :css_reset, :object => js} %>
+
<%= render :partial => 'tab_form', :locals => {:type => :javascripts, :object => js} %>
<% end %>
<%= render :partial => 'images' %>