Module: Activa::PagesHelper

Defined in:
app/helpers/activa/pages_helper.rb

Instance Method Summary collapse

Instance Method Details

#form_url(page) ⇒ Object

Generate url for page form



11
12
13
# File 'app/helpers/activa/pages_helper.rb', line 11

def form_url(page)
  page.new_record? ? pages_path : activa.page_path(page)
end

#heading(heading, tag = :h1, options = {}) ⇒ Object



33
34
35
36
# File 'app/helpers/activa/pages_helper.rb', line 33

def heading(heading, tag=:h1, options = {})
  tag = :h1 if tag.nil?
  (tag, heading, options)
end

#heading_with_title(heading, tag = :h1) ⇒ Object

Print heading (h1 by default) and set page title at the same time. Use this method in your views



23
24
25
26
# File 'app/helpers/activa/pages_helper.rb', line 23

def heading_with_title(heading, tag=:h1)
  title(heading)
  heading(heading, tag)
end

#page_titleObject

This prints page title. Call this helper inside title tag of your layout



17
18
19
# File 'app/helpers/activa/pages_helper.rb', line 17

def page_title
  @page_title
end

#select_options_for(page) ⇒ Object

Generate select tag options with pages tree (excludes passed page)



4
5
6
7
8
# File 'app/helpers/activa/pages_helper.rb', line 4

def select_options_for(page)
  nested_set_options(Activa::Page, page) do |i|
    raw "#{' ' * i.level} #{i.title}"
  end
end

#title(page_title) ⇒ Object

Set page title. Use this method in your views



29
30
31
# File 'app/helpers/activa/pages_helper.rb', line 29

def title(page_title)
  @page_title = Activa.title_proc.call(page_title)
end