small fixes for various stuff

This commit is contained in:
Harry Bomrah 2015-07-15 14:00:48 +08:00
parent 8b8dd22e88
commit 898059c6d2
3 changed files with 9 additions and 5 deletions

View File

@ -384,7 +384,7 @@ class PagesController < ApplicationController
def render_final_page(original_view=get_view,page,layout)
final_html_for_render = ""
OrbitHelper.set_css_to_render_to_empty
if layout
parts = $mobile.blank? ? (page.page_parts rescue []) : (page.mobile_page_parts rescue [])
@ -437,7 +437,6 @@ class PagesController < ApplicationController
@layout_html = render_to_string(@file)
doc = Nokogiri::HTML(@layout_html, nil, "UTF-8")
head = doc.css("head")
head[0].inner_html = head.inner_html + OrbitHelper.get_css_to_render_in_head
@part_partials.each do |key, partial|
html_string = ""
partial.each do |p|
@ -470,6 +469,7 @@ class PagesController < ApplicationController
viewarea.inner_html = render_to_string(original_view) rescue "<div></div>"
head[0].inner_html = OrbitHelper.meta_tags_html + head.inner_html
end
head[0].inner_html = head.inner_html + OrbitHelper.get_css_to_render_in_head
link = doc.css("link")[0]
link.attributes["href"].value = current_site.favicon.url.nil? ? "/assets/favicon.ico" : current_site.favicon.url
final_html_for_render = doc.to_html

View File

@ -347,8 +347,12 @@ module OrbitHelper
!$mobile.blank?
end
def self.set_css_to_render_to_empty
@css_to_render_in_head = []
end
def self.render_css_in_head(css=[])
@css_to_render_in_head = css
@css_to_render_in_head.concat(css)
end
def self.get_css_to_render_in_head

View File

@ -145,8 +145,8 @@
<% end %>
<% end %>
<% end %>
<% end %>
</ul>
</ul>
<% end %>
<% end %>
</li>
<% if !current_user.nil? %>