Sha256: 0818703bd9e514bef39d47704d977b1e06cdb683a3a0a23ae737150bad01dfef

Contents?: true

Size: 1.23 KB

Versions: 126

Compression:

Stored size: 1.23 KB

Contents

require "RedCloth"

module Admin::ReferencesHelper
  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(TrustyCms::Taggable::Util.strip_leading_whitespace(value)).to_html
                       })
      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[:type]
    when 'filters'
      filter ? filter.filter_name : t('select.none')
    when 'tags'
      class_of_page.display_name
    end
  end

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

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

Version data entries

126 entries across 126 versions & 1 rubygems

Version Path
trusty-cms-4.1.2 app/helpers/admin/references_helper.rb
trusty-cms-4.1.1 app/helpers/admin/references_helper.rb
trusty-cms-4.1.0 app/helpers/admin/references_helper.rb
trusty-cms-4.0.2 app/helpers/admin/references_helper.rb
trusty-cms-3.9.7 app/helpers/admin/references_helper.rb
trusty-cms-3.9.6 app/helpers/admin/references_helper.rb
trusty-cms-3.9.5 app/helpers/admin/references_helper.rb
trusty-cms-4.0.1 app/helpers/admin/references_helper.rb
trusty-cms-3.9.4 app/helpers/admin/references_helper.rb
trusty-cms-3.9.3 app/helpers/admin/references_helper.rb
trusty-cms-3.9.2 app/helpers/admin/references_helper.rb
trusty-cms-4.0.0 app/helpers/admin/references_helper.rb
trusty-cms-3.9.1 app/helpers/admin/references_helper.rb
trusty-cms-3.9.0 app/helpers/admin/references_helper.rb
trusty-cms-3.8.4 app/helpers/admin/references_helper.rb
trusty-cms-3.8.3 app/helpers/admin/references_helper.rb
trusty-cms-3.8.2 app/helpers/admin/references_helper.rb
trusty-cms-3.8.1 app/helpers/admin/references_helper.rb
trusty-cms-3.8.0 app/helpers/admin/references_helper.rb
trusty-cms-3.7.1 app/helpers/admin/references_helper.rb