Module: CurationConcerns::FileSetHelper

Included in:
MainAppHelpers
Defined in:
app/helpers/curation_concerns/file_set_helper.rb

Instance Method Summary collapse

Instance Method Details

#media_display(file_set, locals = {}) ⇒ Object



10
11
12
13
# File 'app/helpers/curation_concerns/file_set_helper.rb', line 10

def media_display(file_set, locals = {})
  render media_display_partial(file_set),
         locals.merge(file_set: file_set)
end

#media_display_partial(file_set) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'app/helpers/curation_concerns/file_set_helper.rb', line 15

def media_display_partial(file_set)
  'curation_concerns/file_sets/media_display/' +
    if file_set.image?
      'image'
    elsif file_set.video?
      'video'
    elsif file_set.audio?
      'audio'
    elsif file_set.pdf?
      'pdf'
    elsif file_set.office_document?
      'office_document'
    else
      'default'
    end
end

#parent_path(parent) ⇒ Object



2
3
4
5
6
7
8
# File 'app/helpers/curation_concerns/file_set_helper.rb', line 2

def parent_path(parent)
  if parent.is_a?(Collection)
    main_app.collection_path(parent)
  else
    polymorphic_path([main_app, parent])
  end
end