Module: PreviewHelper

Defined in:
app/helpers/preview_helper.rb

Instance Method Summary collapse

Instance Method Details

#material_preview(material) ⇒ Object


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

def material_preview(material)
  return "" if material.preview_type.nil? or material.preview_type == 'none'

  if material.preview_type == 'video'
     :div, class: 'preview video' do
      material.preview_code.html_safe
    end
  elsif material.preview_type == 'image'
     :div, class: 'preview image' do
      link_to material.url, title: material.name do
        image_tag(material.preview_code, alt: material.name)
      end
    end
  end
end