From a440076916e72613d97548761bc37cb141206a7c Mon Sep 17 00:00:00 2001 From: Harry Bomrah Date: Wed, 20 May 2015 21:13:39 +0800 Subject: [PATCH] fix orbit bar css for the software --- app/controllers/pages_controller.rb | 3 ++- app/helpers/orbit_helper.rb | 12 ++++++++++++ app/views/orbit_bar/index.html.erb | 6 ++++-- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/app/controllers/pages_controller.rb b/app/controllers/pages_controller.rb index 639d46d..cb17e1a 100644 --- a/app/controllers/pages_controller.rb +++ b/app/controllers/pages_controller.rb @@ -432,7 +432,8 @@ class PagesController < ApplicationController end @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| diff --git a/app/helpers/orbit_helper.rb b/app/helpers/orbit_helper.rb index 9bd7eb1..ffc1def 100644 --- a/app/helpers/orbit_helper.rb +++ b/app/helpers/orbit_helper.rb @@ -339,6 +339,18 @@ module OrbitHelper !$mobile.blank? end + def self.render_css_in_head(css=[]) + @css_to_render_in_head = css + end + + def self.get_css_to_render_in_head + css_html = "" + @css_to_render_in_head.each do |css| + css_html = css_html + "\n" + end + return css_html + end + # =============================================================== # Breadcrumbs # =============================================================== diff --git a/app/views/orbit_bar/index.html.erb b/app/views/orbit_bar/index.html.erb index ddabfbc..228b9b2 100644 --- a/app/views/orbit_bar/index.html.erb +++ b/app/views/orbit_bar/index.html.erb @@ -1,7 +1,9 @@ -<%# content_for :page_specific_css do -%> +<% if params[:is_frontend_view] == "true" %> + <% OrbitHelper.render_css_in_head(["basic/icon","lib/orbit_bar/orbit-bar"]) %> +<% else %> <%= stylesheet_link_tag "basic/icon" %> <%= stylesheet_link_tag "lib/orbit_bar/orbit-bar" %> -<%# end -%> +<% end %>
<% if current_user.nil? %>