Module: Admin::ReferencesHelper

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

Instance Method Summary collapse

Instance Method Details

#_display_nameObject



26
27
28
29
30
31
32
33
# File 'app/helpers/admin/references_helper.rb', line 26

def _display_name
  case params[:type]
  when 'filters'
    filter ? filter.filter_name : t('select.none')
  when 'tags'
    class_of_page.display_name
  end
end

#class_of_pageObject



41
42
43
# File 'app/helpers/admin/references_helper.rb', line 41

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

#filterObject



35
36
37
38
39
# File 'app/helpers/admin/references_helper.rb', line 35

def filter
  @filter ||= begin
    TextFilter.find_descendant(params[:filter_name])
  end
end

#filter_referenceObject



14
15
16
17
18
19
20
21
22
23
24
# File 'app/helpers/admin/references_helper.rb', line 14

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
10
11
12
# File 'app/helpers/admin/references_helper.rb', line 2

def tag_reference
  String.new.tap do |output|
    class_of_page.tag_descriptions.sort.each do |tag_name, description|
      value = t("desc.#{tag_name.gsub(':','-')}").match('desc') ? description : t("desc.#{tag_name.gsub(':','-')}")
      output << render(:partial => "admin/references/tag_reference.haml", 
          :locals => {:tag_name => tag_name, 
                      :description =>  RedCloth.new(Radiant::Taggable::Util.strip_leading_whitespace(value)).to_html
                     })
    end
  end.html_safe
end