Module: HierarchicalPageTitles::ViewHelpers

Includes:
SharedMethods
Defined in:
lib/hierarchical_page_titles/view_helpers.rb

Instance Method Summary (collapse)

Methods included from SharedMethods

#title, #titles

Instance Method Details

- (Object) page_title(*args)

Call this in your view with a string to set the page title to that string. Call this in your layout with no arguments to output the page title.



24
25
26
27
28
29
30
31
# File 'lib/hierarchical_page_titles/view_helpers.rb', line 24

def page_title(*args)
  options = args.extract_options!
  if args.empty?
    @_page_title
  else
    super
  end
end

- (Boolean) page_title?

TODO: Document

Returns:

  • (Boolean)


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

def page_title?
  @_page_title.present?
end

- (Boolean) page_title_set?

TODO: Document

Returns:

  • (Boolean)


44
45
46
# File 'lib/hierarchical_page_titles/view_helpers.rb', line 44

def page_title_set?
  @_window_title_set
end

- (Boolean) title_set?

TODO: Document

Returns:

  • (Boolean)


49
50
51
# File 'lib/hierarchical_page_titles/view_helpers.rb', line 49

def title_set?
  @_title_set
end

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

Call this in your view with a string to add the string to the array of window titles. Call this in your layout to output the window title. You can specify a separator that should be put between the titles by passing :separator => " - ".



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/hierarchical_page_titles/view_helpers.rb', line 10

def window_title(*args, &block)
  options = args.extract_options!
  if args.empty?
    options[:separator] ||= " - "
    @_window_titles ||= []
    prefix = Array(options[:prefix]) || []
    (prefix + @_window_titles).join(options[:separator])
  else
    super
  end
end

- (Boolean) window_title_set?

TODO: Document

Returns:

  • (Boolean)


39
40
41
# File 'lib/hierarchical_page_titles/view_helpers.rb', line 39

def window_title_set?
  @_window_title_set
end