Permalink
Browse files

Added a g_inject_styles view helper that must be called at end of app…

…licaiton layout to overcome Rails 3 renderring changes.
  • Loading branch information...
1 parent 78e4ba9 commit 177445f1649f8bf1370d34fcc3717820c2ec7673 @midas committed May 11, 2010
Showing with 9 additions and 4 deletions.
  1. +9 −4 lib/guilded/rails/view_helpers.rb
@@ -9,7 +9,7 @@ module ViewHelpers
# tag of your application layout. If no Guilded elements were called in the template, the
# call to g_apply_behavior will not output anything.
#
- def g_apply_behavior
+ def g_apply_behavior
Guilded::Guilder.instance.generate_javascript_init
end
@@ -22,9 +22,6 @@ def g_apply_behavior
def g_apply_includes
g = Guilded::Guilder.instance
g.generate_asset_lists
-
- # CSS
- self.output_buffer.sub!( /<!-- guilded.styles -->/, stylesheet_link_tag( g.combined_css_srcs, :cache => "cache/#{g.css_cache_name}" ) )
# JavaScript
if g.production? && g.use_remote_jquery
@@ -40,6 +37,14 @@ def g_apply_includes
def g_apply_style
"<!-- guilded.styles -->"
end
+
+ # Injects the CSS into the header. Must be called once per rendered page and within a scope that allows access
+ # to the output buffer of the tempalte system being used.
+ #
+ def g_inject_styles
+ g = Guilded::Guilder.instance
+ self.output_buffer.sub!( /<!-- guilded.styles -->/, stylesheet_link_tag( g.combined_css_srcs, :cache => "cache/#{g.css_cache_name}" ) )
+ end
# Creates a javascript include tag for a Guilded specific file. The only difference
# being that it adds the file to a sources array to be concatenated and included at the

0 comments on commit 177445f

Please sign in to comment.