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
2 changes: 2 additions & 0 deletions src/core/logic.py
Original file line number Diff line number Diff line change
Expand Up @@ -650,6 +650,8 @@ def get_settings_to_edit(display_group, journal, user):
"suppress_citations_metric",
"display_altmetric_badge",
"altmetric_badge_type",
"display_dimensions_badge",
"dimensions_badge_type",
"hide_author_email_links",
"display_date_submitted",
"display_date_accepted",
Expand Down
5 changes: 5 additions & 0 deletions src/static/common/css/common.css
Original file line number Diff line number Diff line change
Expand Up @@ -327,3 +327,8 @@ a.twitter-x{
font-weight: bold;
line-height: 1.25;
}

.external-badge {
margin-block-start: 15px;
margin-block-end: 15px;
}
16 changes: 16 additions & 0 deletions src/templates/admin/elements/forms/group_article.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,19 @@ <h2>Article Dates</h2>
{% include "admin/elements/forms/field.html" with field=edit_form.display_date_accepted %}
</div>

<div class="title-area">
<h2>Badges</h2>
</div>
<div class="content">
<p>{% trans "These settings allow you to display badges from the external Altmetric and Dimensions platforms. It is recommended that you only enable display of one of these badge types as they may not interact well together." %}.</p>

<div class="bs-callout bs-callout-danger">
<p><i class="fa fa-exclamation-triangle">&nbsp;</i>Note: these feature requires articles to have a DOI assigned.</p>
</div>
{% include "admin/elements/forms/field.html" with field=edit_form.display_dimensions_badge %}
{% include "admin/elements/forms/field.html" with field=edit_form.dimensions_badge_type %}

{% include "admin/elements/forms/field.html" with field=edit_form.display_altmetric_badge %}
{% include "admin/elements/forms/field.html" with field=edit_form.altmetric_badge_type %}
</div>

8 changes: 0 additions & 8 deletions src/templates/common/elements/altmetric_badges.html

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<div class="external-badge{% if class %} {{ class }}{% endif %}">
<div data-badge-popover="left" data-badge-type="{% if journal_settings.article.altmetric_badge_type %}{{ journal_settings.article.altmetric_badge_type }}{% else %}1{% endif %}"
data-doi="{{ doi }}" class="altmetric-embed" data-hide-no-mentions="true"></div>
</div>
10 changes: 10 additions & 0 deletions src/templates/common/elements/journal/external/badges.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{% with article.get_doi as doi %}
{% if doi %}
{% if journal_settings.article.display_altmetric_badge %}
{% include "common/elements/journal/external/altmetric_badges.html" with class=class %}
{% endif %}
{% if journal_settings.article.display_dimensions_badge %}
{% include "common/elements/journal/external/dimensions_badges.html" with class=class %}
{% endif %}
{% endif %}
{% endwith %}
14 changes: 14 additions & 0 deletions src/templates/common/elements/journal/external/badges_js.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{% with article.get_doi as doi %}
{% if doi %}
{% if journal_settings.article.display_altmetric_badge %}
<script type='text/javascript' src='https://d1bxh8uas1mnw7.cloudfront.net/assets/embed.js'></script>
{% endif %}
{% if journal_settings.article.display_dimensions_badge %}
<script async src="https://badge.dimensions.ai/badge.js" charset="utf-8"></script>
{% endif %}
{% endif %}
{% endwith %}




Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<div class="external-badge{% if class %} {{ class }}{% endif %}">
<span
class="__dimensions_badge_embed__"
data-doi="{{ doi }}"
data-style="{% if journal_settings.article.altmetric_badge_type %}{{ journal_settings.article.dimensions_badge_type }}{% else %}large_rectangle{% endif %}"
data-legend="hover-bottom"
></span>
</div>
4 changes: 2 additions & 2 deletions src/themes/OLH/templates/journal/article.html
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ <h2>{% trans 'Files' %}:</h2>
<div class="sticky" data-sticky data-margin-top="0"
data-anchor="content" data-sticky-on="large">

{% include "common/elements/altmetric_badges.html" with article=article class='section' %}
{% include "common/elements/journal/external/badges.html" with article=article class='section' %}
{% if journal_settings.article.disable_article_large_image %}
<div class="section">
<h2>
Expand Down Expand Up @@ -537,7 +537,6 @@ <h2>{% trans "Peer Review" %}</h2>
{% endblock body %}

{% block js %}
<script type='text/javascript' src='https://d1bxh8uas1mnw7.cloudfront.net/assets/embed.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/MathJax.js?config=TeX-MML-AM_CHTML'></script>
{% hook 'article_js_block' %}
<script>
Expand All @@ -549,4 +548,5 @@ <h2>{% trans "Peer Review" %}</h2>
<script src="{% static "common/lightbox/js/lightbox.js" %}"></script>
<script src="{% static "common/js/clipboard.js" %}"></script>
<script src="{% static "common/js/reversable-links.js" %}"></script>
{% include "common/elements/journal/external/badges_js.html" %}
{% endblock js %}
4 changes: 2 additions & 2 deletions src/themes/clean/templates/journal/article.html
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ <h2>{% trans "Publisher Notes" %}</h2>
<div class="col-md-4 offset-md-1 left-bar">
<section aria-label="{% trans 'Article Information' %}">
<div class="article-menu">
{% include "common/elements/altmetric_badges.html" with article=article %}
{% include "common/elements/journal/external/badges.html" %}
{% if journal_settings.article.disable_article_large_image %}
<h2>
{% blocktrans count counter=article.frozen_authors.count %}
Expand Down Expand Up @@ -390,7 +390,6 @@ <h2 id="toc-title">{% trans "Table of Contents" %}</h2>
{% endblock body %}

{% block js %}
<script type='text/javascript' src='https://d1bxh8uas1mnw7.cloudfront.net/assets/embed.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/MathJax.js?config=TeX-MML-AM_CHTML'></script>
<script src="{% static 'material/toc.js' %}"></script>
{% hook 'article_js_block' %}
Expand All @@ -404,4 +403,5 @@ <h2 id="toc-title">{% trans "Table of Contents" %}</h2>
<script src="{% static "common/js/clipboard.js" %}"></script>
<script src="{% static "clean/js/tooltip-init.js" %}"></script>
<script src="{% static "common/js/reversable-links.js" %}"></script>
{% include "common/elements/journal/external/badges_js.html" %}
{% endblock js %}
4 changes: 2 additions & 2 deletions src/themes/material/templates/journal/article.html
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ <h2 class="sr-only"> {% trans 'Metrics' %} </h2>
<div class="card">
<section aria-label="{% trans 'Article Information' %}">
<div class="card-content">
{% include "common/elements/altmetric_badges.html" with article=article %}
{% include "common/elements/journal/external/badges.html" with article=article %}
{% include "elements/journal/share.html" %}
{% if article.frozen_authors.exists %}
<div class="spacer">
Expand Down Expand Up @@ -549,7 +549,7 @@ <h2 id="toc-title">
});
</script>
<script src="{% static "common/lightbox/js/lightbox.js" %}"></script>
<script type='text/javascript' src='https://d1bxh8uas1mnw7.cloudfront.net/assets/embed.js'></script>
<script src="{% static "common/js/clipboard.js" %}"></script>
<script src="{% static "common/js/reversable-links.js" %}"></script>
{% include "common/elements/journal/external/badges_js.html" %}
{% endblock %}
38 changes: 38 additions & 0 deletions src/utils/install/journal_defaults.json
Original file line number Diff line number Diff line change
Expand Up @@ -5596,5 +5596,43 @@
"editor",
"journal-manager"
]
},
{
"group": {
"name": "article"
},
"setting": {
"description": "If enabled dimensions badges will be displayed in the sidebar.",
"is_translatable": false,
"name": "display_dimensions_badge",
"pretty_name": "Display Dimensions Badges",
"type": "boolean"
},
"value": {
"default": ""
},
"editable_by": [
"editor",
"journal-manager"
]
},
{
"group": {
"name": "article"
},
"setting": {
"description": "Select a badge type. Options: large_rectangle, small_rectangle, large_circle, small_circle.",
"is_translatable": false,
"name": "dimensions_badge_type",
"pretty_name": "Dimensions Badge Type",
"type": "char"
},
"value": {
"default": "large_rectangle"
},
"editable_by": [
"editor",
"journal-manager"
]
}
]