Module: ApplicationHelper

Includes:
MenuHelper
Defined in:
app/helpers/application_helper.rb

Overview

Methods added to this helper will be available to all templates in the application.

Instance Method Summary collapse

Methods included from MenuHelper

#display_menu_front

Instance Method Details

#block_content_by_key(single_key) ⇒ Object



22
23
24
25
# File 'app/helpers/application_helper.rb', line 22

def block_content_by_key(single_key)
  block = Block.find_by_single_key(single_key)
  block.content if block
end

#meta_info(page, meta) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
# File 'app/helpers/application_helper.rb', line 4

def meta_info(page, meta)
  if page && page.meta_info
    case meta
    when :title
      return page.meta_info.title
    when :keywords
      return page.meta_info.keywords
    when :description
      return page.meta_info.description
    end
  end
end

#page_by_key(single_key) ⇒ Object



17
18
19
20
# File 'app/helpers/application_helper.rb', line 17

def page_by_key(single_key)
  page = Page.find_by_single_key(single_key)
  return page ? page : @page
end

#page_category_path(object) ⇒ Object



27
28
29
# File 'app/helpers/application_helper.rb', line 27

def page_category_path(object)
  super(:id => nil, :category_name => object.name)
end

#render_block(id) ⇒ Object



31
32
33
34
35
36
37
38
39
40
41
42
# File 'app/helpers/application_helper.rb', line 31

def render_block(id)
  block = case id
  when Integer
    Block.find_by_id(id)
  when Block
    id
  when String, Symbol
    Block.find_by_single_key(id)
  end

  block ? block.content : nil
end