This repository has been archived on 2020-05-27. You can view files and clone it, but cannot push or open issues/pull-requests.
2007-09-27 01:15:22 -04:00
|
|
|
module ApplicationHelper
|
2007-10-03 02:34:21 -04:00
|
|
|
##
|
|
|
|
# Returns the title for a page. This could be a Page title or something else.
|
|
|
|
#
|
|
|
|
def page_title
|
2007-11-15 01:49:33 -05:00
|
|
|
return @page_title if @page_title
|
2007-10-03 02:34:21 -04:00
|
|
|
return @page.title if @page
|
|
|
|
"BarleySodas :: #{controller_class_name.gsub(/Controller/, '')}"
|
|
|
|
end
|
2007-10-04 00:54:21 -04:00
|
|
|
|
2007-11-15 01:49:33 -05:00
|
|
|
##
|
|
|
|
# Returns a secondary title for a page. Returns @secondary_title or the
|
|
|
|
# action in the controller.
|
|
|
|
#
|
|
|
|
def secondary_title
|
|
|
|
return @secondary_title if @secondary_title
|
|
|
|
return params[:action].to_s.capitalize.gsub(/_/) do |x|
|
|
|
|
$1.capitalize
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2007-10-04 00:54:21 -04:00
|
|
|
##
|
|
|
|
# Returns a link for a Page model.
|
|
|
|
#
|
|
|
|
def link_to_page(page)
|
|
|
|
link_to page.title, page_path({ :id => page.title_for_url })
|
|
|
|
end
|
2007-09-27 01:15:22 -04:00
|
|
|
end
|