Skip to content

Commit

Permalink
Added a g_inject_styles view helper that must be called at end of app…
Browse files Browse the repository at this point in the history
…licaiton layout to overcome Rails 3 renderring changes.
  • Loading branch information
Jason Harrelson committed May 11, 2010
1 parent 78e4ba9 commit 177445f
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions lib/guilded/rails/view_helpers.rb
Expand Up @@ -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

Expand All @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 177445f

Please sign in to comment.