From 6bf4c60d458104de36c0ba3805508014b2f506cf Mon Sep 17 00:00:00 2001 From: Christophe Vilayphiou Date: Thu, 26 Apr 2012 01:49:02 +0800 Subject: [PATCH] Changes for js and ccs load for site's pages --- app/helpers/application_helper.rb | 23 +++++++++++++++++------ app/views/admin/pages/_show.html.erb | 4 ++-- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index b1d190ec..52ad71c0 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -124,11 +124,13 @@ module ApplicationHelper "#{page.title ? page.title[I18n.locale] : page.i18n_variable[I18n.locale]}\n" end - def page_stylesheets(page) + def page_stylesheets(page, edit=nil) stylesheets = '' - stylesheets << "\n" - stylesheets << "\n" - stylesheets << "\n" + unless edit + stylesheets << "\n" + stylesheets << "\n" + stylesheets << "\n" + end stylesheets << "\n" if page.design.reset_css stylesheets << "\n" if page.design.default_css theme = page.design.themes.detect{ |d| d.id == page.theme_id } @@ -136,9 +138,18 @@ module ApplicationHelper stylesheets end - def page_javascripts(page) + def page_javascripts(page, edit=nil) javascripts = '' - javascripts << "\n" + unless edit + javascripts << "\n" + javascripts << "\n" + javascripts << "\n" + javascripts << "\n" + javascripts << "\n" + javascripts << "\n" + javascripts << "\n" + javascripts << "\n" + end javascripts << "\n" javascripts << "\n" page.design.javascripts.each do |js| diff --git a/app/views/admin/pages/_show.html.erb b/app/views/admin/pages/_show.html.erb index ba9bcf48..29d532fb 100644 --- a/app/views/admin/pages/_show.html.erb +++ b/app/views/admin/pages/_show.html.erb @@ -1,7 +1,7 @@ <%= flash_messages %> -<%= page_stylesheets(@item).html_safe %> -<%= page_javascripts(@item).html_safe %> +<%= page_stylesheets(@item, true).html_safe %> +<%= page_javascripts(@item, true).html_safe %> <%= parse_page_edit_noko(@item).html_safe %> \ No newline at end of file