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

View File

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

View File

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