Module: Ecm::Downloads::DownloadHelper

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

Instance Method Summary collapse

Instance Method Details

#render_download(download_name, _options = {}) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
# File 'app/helpers/ecm/downloads/download_helper.rb', line 3

def render_download(download_name, _options = {})
  download = Download.where(name: download_name).first.decorate
  if download.nil?
    I18n.t('ecm.downloads.download.messages.not_found', name: download_name)
  else
    o = Ecm::Downloads::Configuration.prevent_textile_rendering_in_html ? '<notextile>' : ''
    o << render(download)
    o << '</notextile>' if Ecm::Downloads::Configuration.prevent_textile_rendering_in_html
    return o.html_safe
  end
end