Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion app/assets/stylesheets/local/oh_audio.scss
Original file line number Diff line number Diff line change
Expand Up @@ -198,11 +198,18 @@
}
}

.tab-content {
.tab-pane:not(.pdf-transcript) {
// hacky, match attribute-table width
max-width: ($max-readable-width / 0.67);
}

.pdf-transcript object {
// try to make the embed <object> tag kind of take up a lot of space,
// full page of PDF, full screen, sort of kind of.
width: 100%;
height: 120vh;
}

// When we're two column, add more spacer than default
@include media-breakpoint-up(lg) {
.col-files {
Expand Down
5 changes: 5 additions & 0 deletions app/decorators/oh_audio_work_show_decorator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ def representative_member
@representative_member = all_members.find { |m| m.id == model.representative_id }
end

def pdf_transcript_member
# For now we're just assuming the first PDF found is it, which is not quite right. TODO.
@pdf_transcript_member = all_members.find { |m| m.leaf_representative&.content_type&.start_with?("application/pdf") }
end

def audio_members
@audio_members ||= all_members.select { |m| m.leaf_representative&.content_type&.start_with?("audio/") }
end
Expand Down
16 changes: 16 additions & 0 deletions app/views/works/oh_audio_work_show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@
Transcript <span data-ohms-hitcount="transcript"></span>
</a>
</li>
<% elsif decorator.pdf_transcript_member.present? %>
<li class="nav-item">
<a class="nav-link btn btn-emphasis" id="ohTranscriptPdfTab" data-toggle="tab" href="#ohTranscriptPdf" role="tab" aria-controls="home" aria-selected="false">
Transcript
</a>
</li>
<% end %>

<li class="nav-item">
Expand Down Expand Up @@ -113,8 +119,18 @@
<div class="tab-pane long-text-line-height" id="ohTranscript" role="tabpanel" aria-labelledby="ohTranscriptTab">
<%= OhmsTranscriptDisplay.new(decorator.oral_history_content.ohms_xml).display %>
</div>
<% elsif decorator.pdf_transcript_member.present? %>
<div class="tab-pane pdf-transcript" id="ohTranscriptPdf" role="tabpanel" aria-labelledby="ohTranscriptPdfTab">
<object data="<%= decorator.pdf_transcript_member.file.url %>" type="application/pdf">
<%# content of object tag only shows up if browser can't do object tag for this content type %>
<p>Sorry, this transcript is in PDF format, and your browser does not support displaying PDF. You can download the Transcript PDF on the Downloads tab.</p>
</object>
</div>
<% end %>




<div class="tab-pane downloads" id="ohDownloads" role="tabpanel" aria-labelledby="ohDownloadsTab">
<%= render 'show_with_audio_downloads', decorator: decorator %>
</div>
Expand Down