Module: C80Catoffers::Inner::ModalHelper

Defined in:
app/helpers/c80_catoffers/inner/modal_helper.rb

Instance Method Summary collapse

Instance Method Details

#_render_bs_modal(content = '', title = '') ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'app/helpers/c80_catoffers/inner/modal_helper.rb', line 5

def _render_bs_modal(content='', title='')

  # Если имеется загруженный прайс (в виде файла) - допишем к title ссылку на скачивание
  if Price.all.count > 0
    p = Price.first
    file_url = p.file.url
    file_ext = File.extname(file_url).split('.').join('')
    title = "#{title} (<a href='#{file_url}' title='Откроется в новом окне' target='_blank'>скачать #{file_ext}</a>)"
  end

  render :partial => 'c80_catoffers/bs_modal',
         :locals => {
             title: title,
             content: content,
             close_label: 'Закрыть'
         }
end