Skip to content

Commit

Permalink
add book_author to abstract pages
Browse files Browse the repository at this point in the history
  • Loading branch information
thostetler committed Feb 12, 2022
1 parent 2b0d2ba commit d147bad
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 15 deletions.
37 changes: 23 additions & 14 deletions src/js/widgets/abstract/templates/abstract_template.html
Original file line number Diff line number Diff line change
Expand Up @@ -64,20 +64,20 @@ <h2 class="s-abstract-title">
{{/compare}}
{{/compare}}
{{/compare}}
</span>
</span>
<span class="affiliation hide"> (<i>{{this.[1]}}</i>)</span>{{#if @last}}{{else}};{{/if}}
</li>
{{/each}}
{{/each}}

{{#if hasMoreAuthors}}
<li class="author">
;
;
<span class="extra-dots">
<a data-target="more-authors" title="Show all authors">...</a>
</span>
</li>
{{/if}}
{{/if}}

{{#each authorAffExtra}}
<li class="author extra hide">
<a href="#search/q=author:{{this.[5]}}&sort=date%20desc,%20bibcode%20desc">
Expand All @@ -104,11 +104,11 @@ <h2 class="s-abstract-title">
{{/compare}}
{{/compare}}
{{/compare}}
</span>
</span>
<span class="affiliation hide"> (<i>{{this.[1]}}</i>)</span>{{#if @last}}{{else}};{{/if}}
</li>
{{/each}}

</ul>
</div>
{{/if}}
Expand All @@ -129,7 +129,16 @@ <h4 class="sr-only">Abstract</h4>
<dd>
<div id="article-publication">{{{pub_raw}}}</div>
</dd>
{{/if}} {{#if formattedDate}}
{{/if}}
{{#if book_author}}
<dt>
Book Author{{#compare book_author.length 1 operator='>'}}(s){{/compare}}:
</dt>
<dd>
{{#each book_author}}<a href="{{href}}">{{name}}</a>{{delim}}{{/each}}
</dd>
{{/if}}
{{#if formattedDate}}
<dt>Pub Date:</dt>
<dd>{{formattedDate}}</dd>
{{/if}} {{#if doi}}
Expand All @@ -152,11 +161,11 @@ <h4 class="sr-only">Abstract</h4>

<dt>Bibcode:</dt>
<dd>
<button
class="btn btn-link copy-btn"
style="padding: 0px"
id="abs-bibcode-copy"
data-clipboard-text="{{bibcode}}"
<button
class="btn btn-link copy-btn"
style="padding: 0px"
id="abs-bibcode-copy"
data-clipboard-text="{{bibcode}}"
aria-label="copy bibcode">
{{ bibcode }}
<i
Expand Down
15 changes: 14 additions & 1 deletion src/js/widgets/abstract/widget.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,19 @@ define([
doc.pubnote = _.unescape(doc.pubnote);
}

// handle book_author field
if (
doc.book_author &&
Array.isArray(doc.book_author) &&
doc.book_author.length > 0
) {
doc.book_author = doc.book_author.map((name, i) => ({
name,
href: `#search?q=book_author:"${name}"&sort=date%20desc,%20bibcode%20desc`,
delim: i < doc.book_author.length - 1 ? '; ' : '',
}));
}

const ids = Array.isArray(doc.identifier)
? doc.identifier
: doc.original_identifier;
Expand Down Expand Up @@ -346,7 +359,7 @@ define([

defaultQueryArguments: {
fl:
'identifier,[citations],abstract,author,orcid_pub,orcid_user,orcid_other,bibcode,citation_count,comment,doi,id,keyword,page,property,pub,pub_raw,pubdate,pubnote,read_count,title,volume',
'identifier,[citations],abstract,author,book_author,orcid_pub,orcid_user,orcid_other,bibcode,citation_count,comment,doi,id,keyword,page,property,pub,pub_raw,pubdate,pubnote,read_count,title,volume',
rows: 1,
},

Expand Down

0 comments on commit d147bad

Please sign in to comment.