Sha256: 3f74315e5604c8552cb28ac7c56d1981e02abc8523d0b145c5546754ef5678f3

Contents?: true

Size: 976 Bytes

Versions: 36

Compression:

Stored size: 976 Bytes

Contents

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

  # REVIEW: Since this media display could theoretically work for
  #         any object that inplements to_s and the Mime Type methos (image? audio? ...),
  #         Should this really be in file_set or could it be in it's own helper class like media_helper?
  def media_display(presenter, locals = {})
    render media_display_partial(presenter),
           locals.merge(file_set: presenter)
  end

  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
end

Version data entries

36 entries across 36 versions & 1 rubygems

Version Path
curation_concerns-1.7.8 app/helpers/curation_concerns/file_set_helper.rb
curation_concerns-1.7.7 app/helpers/curation_concerns/file_set_helper.rb
curation_concerns-2.0.0 app/helpers/curation_concerns/file_set_helper.rb
curation_concerns-2.0.0.rc2 app/helpers/curation_concerns/file_set_helper.rb
curation_concerns-1.7.6 app/helpers/curation_concerns/file_set_helper.rb
curation_concerns-1.7.5 app/helpers/curation_concerns/file_set_helper.rb
curation_concerns-1.7.4 app/helpers/curation_concerns/file_set_helper.rb
curation_concerns-1.7.3 app/helpers/curation_concerns/file_set_helper.rb
curation_concerns-1.7.2 app/helpers/curation_concerns/file_set_helper.rb
curation_concerns-2.0.0.rc1 app/helpers/curation_concerns/file_set_helper.rb
curation_concerns-1.7.1 app/helpers/curation_concerns/file_set_helper.rb
curation_concerns-1.7.0 app/helpers/curation_concerns/file_set_helper.rb
curation_concerns-1.7.0.beta1 app/helpers/curation_concerns/file_set_helper.rb
curation_concerns-1.6.3 app/helpers/curation_concerns/file_set_helper.rb
curation_concerns-1.6.2 app/helpers/curation_concerns/file_set_helper.rb
curation_concerns-1.6.1 app/helpers/curation_concerns/file_set_helper.rb
curation_concerns-1.6.0 app/helpers/curation_concerns/file_set_helper.rb
curation_concerns-1.5.0 app/helpers/curation_concerns/file_set_helper.rb
curation_concerns-1.4.0 app/helpers/curation_concerns/file_set_helper.rb
curation_concerns-1.3.3 app/helpers/curation_concerns/file_set_helper.rb