Skip to content

Instantly share code, notes, and snippets.

@millisami
Created September 2, 2013 13:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save millisami/6412819 to your computer and use it in GitHub Desktop.
Save millisami/6412819 to your computer and use it in GitHub Desktop.
layout helpers
# These helper methods can be called in your template to set variables to be used in the layout
# This module should be included in all views globally,
# to do so you may need to add this line to your ApplicationController
# helper :layout
module LayoutHelper
def title(page_title, show_title = true)
content_for(:title) { h(page_title.to_s) }
@show_title = show_title
end
def show_title?
@show_title
end
def stylesheet(*args)
content_for(:head) { stylesheet_link_tag(*args) }
end
def javascript(*args)
content_for(:head) { javascript_include_tag(*args) }
end
def javascript_footer(*args)
content_for(:javascript_footer) { javascript_include_tag(*args) }
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment