Sha256: b8c25095622d6233f385113b3b0d5a3f76155631ae34991159258b34eee99839

Contents?: true

Size: 993 Bytes

Versions: 35

Compression:

Stored size: 993 Bytes

Contents

module Hyrax::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)
    'hyrax/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
  # rubocop:enable Metrics/MethodLength
end

Version data entries

35 entries across 35 versions & 1 rubygems

Version Path
hyrax-2.9.6 app/helpers/hyrax/file_set_helper.rb
hyrax-2.9.5 app/helpers/hyrax/file_set_helper.rb
hyrax-2.9.4 app/helpers/hyrax/file_set_helper.rb
hyrax-2.9.3 app/helpers/hyrax/file_set_helper.rb
hyrax-2.9.2 app/helpers/hyrax/file_set_helper.rb
hyrax-2.9.1 app/helpers/hyrax/file_set_helper.rb
hyrax-2.9.0 app/helpers/hyrax/file_set_helper.rb
hyrax-2.8.0 app/helpers/hyrax/file_set_helper.rb
hyrax-2.7.2 app/helpers/hyrax/file_set_helper.rb
hyrax-2.7.1 app/helpers/hyrax/file_set_helper.rb
hyrax-2.7.0 app/helpers/hyrax/file_set_helper.rb
hyrax-2.6.0 app/helpers/hyrax/file_set_helper.rb
hyrax-3.0.0.pre.rc1 app/helpers/hyrax/file_set_helper.rb
hyrax-3.0.0.pre.beta3 app/helpers/hyrax/file_set_helper.rb
hyrax-2.5.1 app/helpers/hyrax/file_set_helper.rb
hyrax-2.5.0 app/helpers/hyrax/file_set_helper.rb
hyrax-3.0.0.pre.beta2 app/helpers/hyrax/file_set_helper.rb
hyrax-2.4.1 app/helpers/hyrax/file_set_helper.rb
hyrax-3.0.0.pre.beta1 app/helpers/hyrax/file_set_helper.rb
hyrax-2.4.0 app/helpers/hyrax/file_set_helper.rb