UNC-Libraries/hy-c

View on GitHub
app/views/hyrax/file_sets/media_display/_audio.html.erb

Summary

Maintainability
Test Coverage
<%# [hyc-override] https://github.com/samvera/hyrax/tree/hyrax-v4.0.0/app/views/hyrax/file_sets/media_display/_audio.html.erb %>
<% if display_media_download_link?(file_set: file_set) %>
    <div>
      <h2 class="sr-only"><%= t('hyrax.file_set.show.downloadable_content.heading') %></h2>
      <audio controls="controls" class="audiojs" style="width:100%" controlsList="nodownload" preload="auto">
        <source src="<%= hyrax.download_path(file_set, file: 'ogg') %>" type="audio/ogg" />
        <source src="<%= hyrax.download_path(file_set, file: 'mp3') %>" type="audio/mpeg" />
        <%= t('hyrax.file_set.show.downloadable_content.audio_tag_not_supported') %>
      </audio>
      <%# [hyc-override] Style download link %>
      <%= link_to t('hyrax.file_set.show.downloadable_content.audio_link'),
                  hyrax.download_path(file_set),
                  data: { label: file_set.id, work_id: @presenter.id, collection_ids: @presenter.member_of_collection_ids },
                  target: :_blank,
                  class: "btn btn-info",
                  id: "file_download" %>
    </div>
<%# [hyc-override] No thumbnail when not showing download link %>
<%# else %>
    <%# <div> %>
      <%# <audio controls="controls" class="audiojs" style="width:100%" controlsList="nodownload" preload="auto"> %>
        <%# <source src="< %= hyrax.download_path(file_set, file: 'ogg') % >" type="audio/ogg" /> %>
        <%# <source src="< %= hyrax.download_path(file_set, file: 'mp3') % >" type="audio/mpeg" /> %>
        <%#= t('hyrax.file_set.show.downloadable_content.audio_tag_not_supported') %>
      <%# </audio> %>
    <%# </div> %>
<% end %>