From ccbde122dfedeebae769a704a55bf368d2bfef47 Mon Sep 17 00:00:00 2001 From: Christophe Vilayphiou Date: Tue, 31 Jan 2012 16:38:25 +0800 Subject: [PATCH] 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. --- app/models/design/design.rb | 18 +----------------- lib/parsers/parser_back_end.rb | 6 +++--- lib/parsers/parser_front_end.rb | 4 ++-- 3 files changed, 6 insertions(+), 22 deletions(-) diff --git a/app/models/design/design.rb b/app/models/design/design.rb index f4dcb18b..c909bbcb 100644 --- a/app/models/design/design.rb +++ b/app/models/design/design.rb @@ -70,26 +70,10 @@ class Design end if (self.default_css && self.default_css.changed) 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 self.themes.each do |theme| - if theme.changed + if theme.changed? 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 diff --git a/lib/parsers/parser_back_end.rb b/lib/parsers/parser_back_end.rb index 3960d2cd..07a1159a 100644 --- a/lib/parsers/parser_back_end.rb +++ b/lib/parsers/parser_back_end.rb @@ -67,11 +67,11 @@ module ParserBackEnd end c.define_tag 'javascripts' do |tag| res = '' + res << "" + res << "" page.design.javascripts.each do |js| res << "" end - res << "" - res << "" res end c.define_tag 'layout_part' do |tag| @@ -84,7 +84,7 @@ module ParserBackEnd c.define_tag 'content' do |tag| ret = '' if (tag.attributes["main"] == "true" && !page.module_app.nil?) - ret << "
" + ret << "
" else part = page.page_parts.detect{ |p| p.name.to_s == tag.attr['name'].to_s } ret << "
" diff --git a/lib/parsers/parser_front_end.rb b/lib/parsers/parser_front_end.rb index d36bf654..085da831 100644 --- a/lib/parsers/parser_front_end.rb +++ b/lib/parsers/parser_front_end.rb @@ -75,11 +75,11 @@ module ParserFrontEnd end c.define_tag 'javascripts' do |tag| res = '' + res << "" + res << "" page.design.javascripts.each do |js| res << "" end - res << "" - res << "" res end c.define_tag 'image' do |tag|