Changes for js and ccs load for site's pages

This commit is contained in:
Christophe Vilayphiou 2012-04-26 01:49:02 +08:00
parent 6f1eb97ace
commit 6bf4c60d45
2 changed files with 19 additions and 8 deletions

View File

@ -124,11 +124,13 @@ module ApplicationHelper
"<title>#{page.title ? page.title[I18n.locale] : page.i18n_variable[I18n.locale]}</title>\n"
end
def page_stylesheets(page)
def page_stylesheets(page, edit=nil)
stylesheets = ''
unless edit
stylesheets << "<link href='/assets/bootstrap.css' rel='stylesheet' type='text/css' />\n"
stylesheets << "<link href='/assets/bootstrap-orbit.css' rel='stylesheet' type='text/css' />\n"
stylesheets << "<link href='/assets/style.css' rel='stylesheet' type='text/css' />\n"
end
stylesheets << "<link href='#{page.design.reset_css.file.url}' rel='stylesheet' type='text/css' />\n" if page.design.reset_css
stylesheets << "<link href='#{page.design.default_css.file.url}' rel='stylesheet' type='text/css' />\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 = ''
unless edit
javascripts << "<script type='text/javascript' src='/static/jquery.js'></script>\n"
javascripts << "<script type='text/javascript' src='/static/jquery.cycle.all.latest.js'></script>\n"
javascripts << "<script type='text/javascript' src='/assets/bootstrap.js'></script>\n"
javascripts << "<script type='text/javascript' src='/assets/jquery.tinyscrollbar.min.js'></script>\n"
javascripts << "<script type='text/javascript' src='/assets/jquery.isotope.min.js'></script>\n"
javascripts << "<script type='text/javascript' src='/assets/orbit-bar-member.js'></script>\n"
javascripts << "<script type='text/javascript' src='/assets/orbit-bar-search.js'></script>\n"
javascripts << "<script type='text/javascript' src='/assets/orbit_bar.js'></script>\n"
end
javascripts << "<script type='text/javascript' src='/static/kernel.js'></script>\n"
javascripts << "<script type='text/javascript' src='/assets/event.js'></script>\n"
page.design.javascripts.each do |js|

View File

@ -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 %>