Skip to content

Commit

Permalink
Merge pull request #89 from rebeccacremona/link-to-json-and-pdfs
Browse files Browse the repository at this point in the history
Link to PDFs
  • Loading branch information
rebeccacremona committed Mar 6, 2024
2 parents a068619 + 931d92c commit db89516
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 1 deletion.
25 changes: 25 additions & 0 deletions src/components/cap-case.js
Expand Up @@ -109,6 +109,14 @@ export default class CapCase extends LitElement {
font-style: italic;
}
/* PDF link */
.pdf-link {
font-family: var(--font-sans-text);
text-align: center;
margin: var(--spacing-50) auto -1em;
}
/**/
/* Styles that apply to the injected HTML */
/**/
Expand Down Expand Up @@ -444,6 +452,22 @@ export default class CapCase extends LitElement {
}
}

getPDFLink() {
if (this.caseMetadata.provenance.source === "Harvard") {
return html`
<div class="pdf-link">
<a
href="${window.BUCKET_ROOT}/${this.reporter}/${this
.volume}.pdf#page=${this.caseMetadata.first_page_order}"
>
View scanned PDF</a
>
</div>
`;
}
return nothing;
}

removeLink = (a) => {
a.replaceWith(a.innerHTML);
};
Expand Down Expand Up @@ -527,6 +551,7 @@ export default class CapCase extends LitElement {
<div class="metadata">
<div class="case-name">${this.caseMetadata.name}</div>
</div>
${this.getPDFLink()}
<!--section.casebody -->
${unsafeHTML(this.caseBody)}
</div>
Expand Down
13 changes: 12 additions & 1 deletion src/components/cap-volume.js
Expand Up @@ -110,6 +110,17 @@ export default class CapVolume extends LitElement {
);
}

getPDFLink() {
if (this.casesData[0].provenance.source === "Harvard") {
return html`<a
href="${window.BUCKET_ROOT}/${this.reporter}/${this.volume}.pdf"
>
View scanned PDF.</a
>`;
}
return nothing;
}

render() {
if (
!isEmpty(this.casesData) &&
Expand All @@ -130,7 +141,7 @@ export default class CapVolume extends LitElement {
<p class="volume__subHeading">
${this.reporterData.full_name}
(${this.reporterData.start_year}-${this.reporterData.end_year})
volume ${this.volume}.
volume ${this.volume}. ${this.getPDFLink()}
</p>
</hgroup>
<ul class="volume__caseList">
Expand Down

0 comments on commit db89516

Please sign in to comment.