Module: Hyrax::FileSetHelper
- Included in:
- BatchEditsController, HyraxHelperBehavior
- Defined in:
- app/helpers/hyrax/file_set_helper.rb
Instance Method Summary collapse
-
#display_media_download_link?(file_set:) ⇒ Boolean
Whether to display the download link for the given file set.
-
#media_display(presenter, locals = {}) ⇒ Object
deprecated
Deprecated.
use render(media_display_partial(file_set), file_set: file_set) instead
- #media_display_partial(file_set) ⇒ Object
- #parent_path(parent) ⇒ Object
Instance Method Details
#display_media_download_link?(file_set:) ⇒ Boolean
TODO:
inline the “workflow restriction” into the ‘can?(:download)` check.
Returns whether to display the download link for the given file set.
10 11 12 13 14 |
# File 'app/helpers/hyrax/file_set_helper.rb', line 10 def display_media_download_link?(file_set:) Hyrax.config.display_media_download_link? && can?(:download, file_set) && !workflow_restriction?(file_set.try(:parent)) end |
#media_display(presenter, locals = {}) ⇒ Object
Deprecated.
use render(media_display_partial(file_set), file_set: file_set) instead
30 31 32 33 34 35 36 37 |
# File 'app/helpers/hyrax/file_set_helper.rb', line 30 def media_display(presenter, locals = {}) Deprecation.warn("the helper `media_display` renders a partial name " \ "provided by `media_display_partial`. Callers " \ "should render `media_display_partial(file_set) directly instead.") render(media_display_partial(presenter), locals.merge(file_set: presenter)) end |
#media_display_partial(file_set) ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'app/helpers/hyrax/file_set_helper.rb', line 39 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 |
#parent_path(parent) ⇒ Object
16 17 18 19 20 21 22 |
# File 'app/helpers/hyrax/file_set_helper.rb', line 16 def parent_path(parent) if parent.is_a?(::Collection) main_app.collection_path(parent) else polymorphic_path([main_app, parent]) end end |