Module: HierarchicalPageTitles::ControllerHelpers::ClassMethods

Defined in:
lib/hierarchical_page_titles/controller_helpers.rb

Instance Method Summary (collapse)

Instance Method Details

- (Object) hide_page_title(options = {})

Call this in the body of your controller to tell page_title to not show anything. You can pass :only and :except to limit this to certain actions.



41
42
43
# File 'lib/hierarchical_page_titles/controller_helpers.rb', line 41

def hide_page_title(options={})
  before_filter(options) {|c| c.page_title(nil) }
end

- (Object) page_title(*args, &block)

Call this in the body of your controller with a string to set the page title globally for each action in your controller. Unlike window_title, this will not work for subcontrollers -- so if you call page_title in a supercontroller and also in a subcontroller, the subcontroller's title will override the supercontroller's. You can pass :only and :except to limit this to certain actions.



25
26
27
28
# File 'lib/hierarchical_page_titles/controller_helpers.rb', line 25

def page_title(*args, &block)
  options = Hash === args.last ? args.last : {}
  before_filter(options) {|c| c.page_title(*args, &block) }
end

- (Object) title(*args, &block)

Call this in the body of your controller with a string to add it to the window title AND set the page title at the same time. See window_title and page_title for more. You can pass :only and :except to limit this to certain actions.



34
35
36
37
# File 'lib/hierarchical_page_titles/controller_helpers.rb', line 34

def title(*args, &block)
  options = Hash === args.last ? args.last : {}
  before_filter(options) {|c| c.title(*args, &block) }
end

- (Object) window_title(*args, &block)

Call this in the body of your controller with a string to add the string to the window title before each action in your controller. This will work for subcontrollers too -- so if you call window_title in a supercontroller and also in a subcontroller, there will be two strings when you go to output the window title. You can pass :only and :except to limit this to certain actions.



15
16
17
18
# File 'lib/hierarchical_page_titles/controller_helpers.rb', line 15

def window_title(*args, &block)
  options = Hash === args.last ? args.last : {}
  before_filter(options) {|c| c.window_title(*args, &block) }
end