Module: Admin::ReferencesHelper

Included in:
PagesHelper
Defined in:
app/helpers/admin/references_helper.rb

Instance Method Summary collapse

Instance Method Details

#_display_nameObject



23
24
25
26
27
28
29
30
# File 'app/helpers/admin/references_helper.rb', line 23

def _display_name
  case params[:id]
  when 'filters'
    filter ? filter.filter_name : '<none>'
  when 'tags'
    class_of_page.display_name
  end
end

#class_of_pageObject



39
40
41
# File 'app/helpers/admin/references_helper.rb', line 39

def class_of_page
  @page_class ||= (params[:class_name].blank? ? 'Page' : params[:class_name]).constantize
end

#filterObject



32
33
34
35
36
37
# File 'app/helpers/admin/references_helper.rb', line 32

def filter
  @filter ||= begin
    filter_name = params[:filter_name]
    (filter_name.gsub(" ", "") + "Filter").constantize unless filter_name.blank?
  end
end

#filter_referenceObject



11
12
13
14
15
16
17
18
19
20
21
# File 'app/helpers/admin/references_helper.rb', line 11

def filter_reference
  unless filter.blank?
    if filter.description.blank? 
      "There is no documentation on this filter." 
    else
      filter.description
    end
  else
    "There is no filter on the current page part."
  end
end

#tag_referenceObject



2
3
4
5
6
7
8
9
# File 'app/helpers/admin/references_helper.rb', line 2

def tag_reference
  returning String.new do |output|
    class_of_page.tag_descriptions.sort.each do |tag_name, description|
      output << render(:partial => "admin/references/tag_reference.haml", 
          :locals => {:tag_name => tag_name, :description => description})
    end
  end
end