Sha256: 5bdd2fb60fc0067bd9c273ce75d20ed9b6126227f1f3105902ad1371d7787d29

Contents?: true

Size: 1.21 KB

Versions: 69

Compression:

Stored size: 1.21 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
    if filter.blank?
      'There is no filter on the current page part.'
    else
      if filter.description.blank?
        'There is no documentation on this filter.'
      else
        filter.description
      end
    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

69 entries across 69 versions & 1 rubygems

Version Path
trusty-cms-6.3.1 app/helpers/admin/references_helper.rb
trusty-cms-7.0.0 app/helpers/admin/references_helper.rb
trusty-cms-6.3 app/helpers/admin/references_helper.rb
trusty-cms-6.2.1 app/helpers/admin/references_helper.rb
trusty-cms-6.2.2.1 app/helpers/admin/references_helper.rb
trusty-cms-6.2.0 app/helpers/admin/references_helper.rb
trusty-cms-6.1.2 app/helpers/admin/references_helper.rb
trusty-cms-6.1.1 app/helpers/admin/references_helper.rb
trusty-cms-6.0.5 app/helpers/admin/references_helper.rb
trusty-cms-6.0.4 app/helpers/admin/references_helper.rb
trusty-cms-6.0.3 app/helpers/admin/references_helper.rb
trusty-cms-6.0.2 app/helpers/admin/references_helper.rb
trusty-cms-6.0.1 app/helpers/admin/references_helper.rb
trusty-cms-5.6.1 app/helpers/admin/references_helper.rb
trusty-cms-6.0.0 app/helpers/admin/references_helper.rb
trusty-cms-5.6.0 app/helpers/admin/references_helper.rb
trusty-cms-5.5.9 app/helpers/admin/references_helper.rb
trusty-cms-5.5.8 app/helpers/admin/references_helper.rb
trusty-cms-5.5.7 app/helpers/admin/references_helper.rb
trusty-cms-5.5.6 app/helpers/admin/references_helper.rb