diff --git a/app/controllers/admin/designs_controller.rb b/app/controllers/admin/designs_controller.rb
index f331e096..ef4be863 100644
--- a/app/controllers/admin/designs_controller.rb
+++ b/app/controllers/admin/designs_controller.rb
@@ -102,6 +102,11 @@ class Admin::DesignsController < ApplicationController
temp_file = File.new(dir + '/' + filename, 'w+')
temp_file.write (zip_file.read entry ).force_encoding('UTF-8')
design.default_css = temp_file
+ when /\A(#{zip_name})\/(reset\.css)\z/ #for reset css
+ filename = File.basename(entry.to_s)
+ temp_file = File.new(dir + '/' + filename, 'w+')
+ temp_file.write (zip_file.read entry ).force_encoding('UTF-8')
+ design.reset_css = temp_file
when /\A(#{zip_name})\/(layout\.html)\z/ #for layout html
filename = File.basename(entry.to_s)
temp_file = File.new(dir + '/' + filename, 'w+')
diff --git a/app/models/design/design.rb b/app/models/design/design.rb
index 3e96ca51..f4c637f5 100644
--- a/app/models/design/design.rb
+++ b/app/models/design/design.rb
@@ -2,25 +2,24 @@ class Design
include Mongoid::Document
include Mongoid::Timestamps
-
field :title
field :author
field :intro
-
field :version
- validates_presence_of :title
- validates_presence_of :author
+ mount_uploader :default_css, AssetUploader
+ mount_uploader :reset_css, AssetUploader
has_many :pages
-
+
embeds_one :layout
- mount_uploader :default_css, AssetUploader
-
embeds_many :themes
embeds_many :javascripts
embeds_many :images
-
+
+ validates_presence_of :title
+ validates_presence_of :author
+
after_save :procs_embedded_objects
# after_destroy :del_embedded_objects
diff --git a/app/models/design/layout.rb b/app/models/design/layout.rb
index cff82575..ef768512 100644
--- a/app/models/design/layout.rb
+++ b/app/models/design/layout.rb
@@ -20,7 +20,6 @@ class Layout < DesignFile
end
def parse_layout
- debugger
parse_layout_contents(self)
end
diff --git a/app/models/page.rb b/app/models/page.rb
index fe6916bf..54564cc7 100644
--- a/app/models/page.rb
+++ b/app/models/page.rb
@@ -21,4 +21,8 @@ class Page < Item
end
end
+ def is_home?
+ self.parent ? false : true
+ end
+
end
diff --git a/lib/parser.rb b/lib/parser.rb
index 35911e78..fa321407 100644
--- a/lib/parser.rb
+++ b/lib/parser.rb
@@ -65,9 +65,10 @@ module Parser
end
c.define_tag 'stylesheets' do |tag|
res = ''
+ res << ""
res << " "
theme = page.design.themes.detect{ |d| d.id == page.theme_id }
- res << ""
+ res << "" if theme
end
c.define_tag 'javascripts' do |tag|
res = ''
@@ -173,9 +174,10 @@ module Parser
end
c.define_tag 'stylesheets' do |tag|
res = ''
+ res << ""
res << ""
theme = page.design.themes.detect{ |d| d.id == page.theme_id }
- res << ""
+ res << "" if theme
end
c.define_tag 'javascripts' do |tag|
res = ''
@@ -244,8 +246,8 @@ module Parser
res << menu.values["li_class_#{current}"]
res << "_#{i}" if i
res << ">"
- res << page.name
- res << menu_level(page, current + 1, menu) if page.children.size > 0
+ res << "#{page.name}"
+ res << menu_level(page, current + 1, menu) if page.children.size > 0 && !page.is_home?
res << ""
end