Sha256: 86d94de1ecde6312e1793ae752efb890d0e3e93418a229d7de134c8c46c4efec

Contents?: true

Size: 1.04 KB

Versions: 2

Compression:

Stored size: 1.04 KB

Contents

module Admin::ReferencesHelper
  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", 
            :locals => {:tag_name => tag_name, :description => description})
      end
    end
  end
  
  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
  
  def _display_name
    case params[:id]
    when 'filters'
      filter ? filter.filter_name : '<none>'
    when 'tags'
      class_of_page.display_name
    end
  end
  
  def filter
    @filter ||= begin
      filter_name = params[:filter_name]
      (filter_name.gsub(" ", "") + "Filter").constantize unless filter_name.blank?
    end
  end

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
radiant-0.7.2 app/helpers/admin/references_helper.rb
radiant-0.7.1 app/helpers/admin/references_helper.rb