Fix bugs in design.

The static js were loaded after the page js.
parser_back_end.rb wasn't changed for the new routes.
The themes weren't parsed and saved correctly.
This commit is contained in:
Christophe Vilayphiou 2012-01-31 16:38:25 +08:00
parent 4906894fb5
commit ccbde122df
3 changed files with 6 additions and 22 deletions

View File

@ -70,26 +70,10 @@ class Design
end end
if (self.default_css && self.default_css.changed) if (self.default_css && self.default_css.changed)
self.default_css.parse_urls self.default_css.parse_urls
attrs = self.default_css.attributes
file = self.default_css.file
file_orig = self.default_css.file_orig
self.default_css.destroy
d = self.build_default_css(attrs)
d.file = file
d.file_orig = file_orig
d.save
end end
self.themes.each do |theme| self.themes.each do |theme|
if theme.changed if theme.changed?
theme.parse_urls theme.parse_urls
attrs = theme.attributes
file = theme.file
file_orig = theme.file_orig
theme.destroy
t = self.themes.build(attrs)
t.file = file
t.file_orig = file_orig
t.save
end end
end end
end end

View File

@ -67,11 +67,11 @@ module ParserBackEnd
end end
c.define_tag 'javascripts' do |tag| c.define_tag 'javascripts' do |tag|
res = '' res = ''
res << "<script type='text/javascript' src='/static/jquery.js'></script>"
res << "<script type='text/javascript' src='/static/kernel.js'></script>"
page.design.javascripts.each do |js| page.design.javascripts.each do |js|
res << "<script type='text/javascript' src='#{js.file.url}'></script>" res << "<script type='text/javascript' src='#{js.file.url}'></script>"
end end
res << "<script type='text/javascript' src='/static/jquery.js'></script>"
res << "<script type='text/javascript' src='/static/kernel.js'></script>"
res res
end end
c.define_tag 'layout_part' do |tag| c.define_tag 'layout_part' do |tag|
@ -84,7 +84,7 @@ module ParserBackEnd
c.define_tag 'content' do |tag| c.define_tag 'content' do |tag|
ret = '' ret = ''
if (tag.attributes["main"] == "true" && !page.module_app.nil?) if (tag.attributes["main"] == "true" && !page.module_app.nil?)
ret << "<div id='appfrontend' class='dymanic_load' path='/panel/#{page.module_app.title}/front_end/#{page.app_frontend_url}'></div>" ret << "<div id='appfrontend' class='dymanic_load' path='/panel/#{page.module_app.title}/front_end/#{page.app_frontend_url}?inner=true'></div>"
else else
part = page.page_parts.detect{ |p| p.name.to_s == tag.attr['name'].to_s } part = page.page_parts.detect{ |p| p.name.to_s == tag.attr['name'].to_s }
ret << "<div id='#{tag.attr['name']}' part_id='#{part.id}' class='editable' style='border:solid 1px; margin:5px; padding:5px;'>" ret << "<div id='#{tag.attr['name']}' part_id='#{part.id}' class='editable' style='border:solid 1px; margin:5px; padding:5px;'>"

View File

@ -75,11 +75,11 @@ module ParserFrontEnd
end end
c.define_tag 'javascripts' do |tag| c.define_tag 'javascripts' do |tag|
res = '' res = ''
res << "<script type='text/javascript' src='/static/jquery.js'></script>"
res << "<script type='text/javascript' src='/static/kernel.js'></script>"
page.design.javascripts.each do |js| page.design.javascripts.each do |js|
res << "<script type='text/javascript' src='#{js.file.url}'></script>" res << "<script type='text/javascript' src='#{js.file.url}'></script>"
end end
res << "<script type='text/javascript' src='/static/jquery.js'></script>"
res << "<script type='text/javascript' src='/static/kernel.js'></script>"
res res
end end
c.define_tag 'image' do |tag| c.define_tag 'image' do |tag|