Module: Hyrax::FileSetFormHelper

Included in:
HyraxHelperBehavior
Defined in:
app/helpers/hyrax/file_set_form_helper.rb

Instance Method Summary collapse

Instance Method Details

#render_transcript_ids_field?(file_set) ⇒ Boolean

Returns:

  • (Boolean)


5
6
7
8
9
10
11
12
13
14
15
# File 'app/helpers/hyrax/file_set_form_helper.rb', line 5

def render_transcript_ids_field?(file_set)
  return unless file_set.persisted?
  return if @parent.nil?
  case file_set
  when ActiveFedora::Base
    file_set.video? || file_set.audio?
  when Valkyrie::Resource
    service = Hyrax::FileSetTypeService.new(file_set: file_set)
    service.video? || service.audio?
  end
end

#transcript_ids_select_optionsObject



17
18
19
20
21
22
# File 'app/helpers/hyrax/file_set_form_helper.rb', line 17

def transcript_ids_select_options
  options = Forms::FileSetForm.available_transcripts(parent: @parent, current_ability: current_ability)
  options.each_with_object({}) do |doc, hash|
    hash[doc.title_or_label] = doc.id.to_s
  end
end