Skip to content

Commit 876d287

Browse files
authored
Feature: added "award" for publications (cotes2020#2324)
This PR adds an "award" button to publications. It takes the `award` value from the bibtex entry and displays(incl. Markdown rendering) the text in a box similarly to abstract and bibtex. User can set the entry `award_name` to configure the value. See example config with `award_name: Nobel Prize`. The color of the award box can be configured in `_base.scss`. Note, there is a similar PR cotes2020#2175, it I saw to issues with: 1. There was no progress 2. The award button just prints the text directly in the button, similarly to `award_name`. Long award names could clutter the webpage. 3. IMHO, it brokes the current al-folio design, since butons do have a fixed size/text. However, variable prize names are also possible with this PR. *** Pictures: Default. Text are hidden: <img width="708" alt="grafik" src="https://github.com/alshedivat/al-folio/assets/1998723/1221c82c-c384-4297-807e-39385e2ce4fd"> Additional info is shown when the button is clicked. Markdown supported. <img width="684" alt="grafik" src="https://github.com/alshedivat/al-folio/assets/1998723/2354aeee-12b0-4d32-b194-5d2ea80d8363"> Only one text box shown at the same time, like it is with "ABS" and "BIB": <img width="691" alt="grafik" src="https://github.com/alshedivat/al-folio/assets/1998723/d3937bb9-d9c2-47ac-b819-b92aec3d916a"> *** Feedback welcome. You can also check [my website](https://christianmainka.de/publications/awarded), which was the base for this PR.
1 parent 1e00eb0 commit 876d287

File tree

6 files changed

+46
-3
lines changed

6 files changed

+46
-3
lines changed

_bibliography/papers.bib

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,22 @@ @article{einstein1905electrodynamics
8383
year={1905}
8484
}
8585

86+
@Article{einstein1905photoelectriceffect,
87+
bibtex_show={true},
88+
abbr={Ann. Phys.},
89+
title="{{\"U}ber einen die Erzeugung und Verwandlung des Lichtes betreffenden heuristischen Gesichtspunkt}",
90+
author={Albert Einstein},
91+
abstract={This is the abstract text.},
92+
journal={Ann. Phys.},
93+
volume={322},
94+
number={6},
95+
pages={132--148},
96+
year={1905},
97+
doi={10.1002/andp.19053220607},
98+
award={Albert Einstein receveid the **Nobel Prize in Physics** 1921 *for his services to Theoretical Physics, and especially for his discovery of the law of the photoelectric effect*},
99+
award_name={Nobel Prize}
100+
}
101+
86102
@book{przibram1967letters,
87103
bibtex_show={true},
88104
title={Letters on wave mechanics},

_config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ enable_publication_badges:
323323

324324
# Filter out certain bibtex entry keywords used internally from the bib output
325325
filtered_bibtex_keywords:
326-
[abbr, abstract, altmetric, arxiv, bibtex_show, blog, code, html, pdf, poster, preview, selected, slides, supp, video, website]
326+
[abbr, abstract, altmetric, arxiv, award, award_name, bibtex_show, blog, code, html, pdf, poster, preview, selected, slides, supp, video, website]
327327

328328
# Maximum number of authors to be shown for each publication (more authors are visible on click)
329329
max_author_limit: 3 # leave blank to always show all authors

_layouts/bib.liquid

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,9 @@
156156

157157
<!-- Links/Buttons -->
158158
<div class="links">
159+
{% if entry.award %}
160+
<a class="award btn btn-sm z-depth-0" role="button">{{ entry.award_name ? entry.award_name : "Awarded" }}</a>
161+
{% endif %}
159162
{% if entry.abstract %}
160163
<a class="abstract btn btn-sm z-depth-0" role="button">Abs</a>
161164
{% endif %}
@@ -271,6 +274,13 @@
271274
{% endif %}
272275
{% endif %}
273276

277+
{% if entry.award %}
278+
<!-- Hidden Award block -->
279+
<div class="award hidden d-print-inline">
280+
<p>{{ entry.award | markdownify }}</p>
281+
</div>
282+
{% endif %}
283+
274284
{% if entry.abstract %}
275285
<!-- Hidden abstract block -->
276286
<div class="abstract hidden">

_sass/_base.scss

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -769,6 +769,9 @@ footer.sticky-bottom {
769769
border-color: var(--global-theme-color);
770770
}
771771
}
772+
a.award.btn {
773+
border-color: var(--global-highlight-color);
774+
}
772775
}
773776

774777
.badges {
@@ -826,6 +829,12 @@ footer.sticky-bottom {
826829
border-color: var(--global-text-color);
827830
}
828831
}
832+
div.award.hidden {
833+
border: dashed 1px var(--global-bg-color);
834+
}
835+
div.award.hidden.open {
836+
border-color: var(--global-highlight-color);
837+
}
829838
}
830839
}
831840

_sass/_themes.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
--global-distill-app-color: #{$grey-color};
1717
--global-divider-color: rgba(0, 0, 0, 0.1);
1818
--global-card-bg-color: #{$white-color};
19+
--global-highlight-color: #{$red-color-dark};
1920

2021
--global-tip-block: #42b983;
2122
--global-tip-block-bg: #e2f5ec;

assets/js/common.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,19 @@
11
$(document).ready(function () {
2-
// add toggle functionality to abstract and bibtex buttons
2+
// add toggle functionality to abstract, award and bibtex buttons
33
$("a.abstract").click(function () {
44
$(this).parent().parent().find(".abstract.hidden").toggleClass("open");
5+
$(this).parent().parent().find(".award.hidden.open").toggleClass("open");
6+
$(this).parent().parent().find(".bibtex.hidden.open").toggleClass("open");
7+
});
8+
$("a.award").click(function () {
9+
$(this).parent().parent().find(".abstract.hidden.open").toggleClass("open");
10+
$(this).parent().parent().find(".award.hidden").toggleClass("open");
511
$(this).parent().parent().find(".bibtex.hidden.open").toggleClass("open");
612
});
713
$("a.bibtex").click(function () {
8-
$(this).parent().parent().find(".bibtex.hidden").toggleClass("open");
914
$(this).parent().parent().find(".abstract.hidden.open").toggleClass("open");
15+
$(this).parent().parent().find(".award.hidden.open").toggleClass("open");
16+
$(this).parent().parent().find(".bibtex.hidden").toggleClass("open");
1017
});
1118
$("a").removeClass("waves-effect waves-light");
1219

0 commit comments

Comments
 (0)