From 898059c6d2137b22a4ff162984721901ebae09a8 Mon Sep 17 00:00:00 2001 From: Harry Bomrah Date: Wed, 15 Jul 2015 14:00:48 +0800 Subject: [PATCH] small fixes for various stuff --- app/controllers/pages_controller.rb | 4 ++-- app/helpers/orbit_helper.rb | 6 +++++- app/views/orbit_bar/index.html.erb | 4 ++-- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/app/controllers/pages_controller.rb b/app/controllers/pages_controller.rb index b2c5c98..2737ece 100644 --- a/app/controllers/pages_controller.rb +++ b/app/controllers/pages_controller.rb @@ -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 "
" 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 diff --git a/app/helpers/orbit_helper.rb b/app/helpers/orbit_helper.rb index aefa2ea..d9c4be2 100644 --- a/app/helpers/orbit_helper.rb +++ b/app/helpers/orbit_helper.rb @@ -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 diff --git a/app/views/orbit_bar/index.html.erb b/app/views/orbit_bar/index.html.erb index 1be6fd1..47d63c9 100644 --- a/app/views/orbit_bar/index.html.erb +++ b/app/views/orbit_bar/index.html.erb @@ -145,8 +145,8 @@ <% end %> <% end %> <% end %> - <% end %> - + + <% end %> <% end %> <% if !current_user.nil? %>