Module: Ecm::Downloads::DownloadCategoryHelper

Defined in:
app/helpers/ecm/downloads/download_category_helper.rb

Instance Method Summary collapse

Instance Method Details

#render_download_category(download_category_name, _options = {}) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'app/helpers/ecm/downloads/download_category_helper.rb', line 3

def render_download_category(download_category_name, _options = {})
  download_category = DownloadCategory.where(name: download_category_name).first.decorate
  if download_category.nil?
    I18n.t('ecm.downloads.download_category.messages.not_found', name: download_category_name)
  else
    begin
      o = Ecm::Downloads::Configuration.prevent_textile_rendering_in_html ? '<notextile>' : ''
      o << render(download_category)
      o << '</notextile>' if Ecm::Downloads::Configuration.prevent_textile_rendering_in_html
      return o.html_safe
    rescue => e
      raise e
    end
  end
end