diff --git a/src/core/logic.py b/src/core/logic.py index c37a42bf7f..6643da24e1 100755 --- a/src/core/logic.py +++ b/src/core/logic.py @@ -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", diff --git a/src/static/common/css/common.css b/src/static/common/css/common.css index 980b68587e..b183f00bc4 100644 --- a/src/static/common/css/common.css +++ b/src/static/common/css/common.css @@ -327,3 +327,8 @@ a.twitter-x{ font-weight: bold; line-height: 1.25; } + +.external-badge { + margin-block-start: 15px; + margin-block-end: 15px; +} \ No newline at end of file diff --git a/src/templates/admin/elements/forms/group_article.html b/src/templates/admin/elements/forms/group_article.html index 9ed6376877..3e0928af80 100644 --- a/src/templates/admin/elements/forms/group_article.html +++ b/src/templates/admin/elements/forms/group_article.html @@ -39,3 +39,19 @@

Article Dates

{% include "admin/elements/forms/field.html" with field=edit_form.display_date_accepted %} +
+

Badges

+
+
+

{% 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." %}.

+ +
+

 Note: these feature requires articles to have a DOI assigned.

+
+ {% 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 %} +
+ diff --git a/src/templates/common/elements/altmetric_badges.html b/src/templates/common/elements/altmetric_badges.html deleted file mode 100644 index 880ac30ccf..0000000000 --- a/src/templates/common/elements/altmetric_badges.html +++ /dev/null @@ -1,8 +0,0 @@ -{% with article.get_doi as doi %} -{% if doi and journal_settings.article.display_altmetric_badge %} - -
- -{% endif %} -{% endwith %} \ No newline at end of file diff --git a/src/templates/common/elements/journal/external/altmetric_badges.html b/src/templates/common/elements/journal/external/altmetric_badges.html new file mode 100644 index 0000000000..10ae423718 --- /dev/null +++ b/src/templates/common/elements/journal/external/altmetric_badges.html @@ -0,0 +1,4 @@ +
+
+
\ No newline at end of file diff --git a/src/templates/common/elements/journal/external/badges.html b/src/templates/common/elements/journal/external/badges.html new file mode 100644 index 0000000000..102aac36e9 --- /dev/null +++ b/src/templates/common/elements/journal/external/badges.html @@ -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 %} \ No newline at end of file diff --git a/src/templates/common/elements/journal/external/badges_js.html b/src/templates/common/elements/journal/external/badges_js.html new file mode 100644 index 0000000000..3faba4ab8e --- /dev/null +++ b/src/templates/common/elements/journal/external/badges_js.html @@ -0,0 +1,14 @@ +{% with article.get_doi as doi %} + {% if doi %} + {% if journal_settings.article.display_altmetric_badge %} + + {% endif %} + {% if journal_settings.article.display_dimensions_badge %} + + {% endif %} + {% endif %} +{% endwith %} + + + + diff --git a/src/templates/common/elements/journal/external/dimensions_badges.html b/src/templates/common/elements/journal/external/dimensions_badges.html new file mode 100644 index 0000000000..93d6f1e53c --- /dev/null +++ b/src/templates/common/elements/journal/external/dimensions_badges.html @@ -0,0 +1,8 @@ +
+ +
\ No newline at end of file diff --git a/src/themes/OLH/templates/journal/article.html b/src/themes/OLH/templates/journal/article.html index 7e51b9c1e7..a6f88be29a 100644 --- a/src/themes/OLH/templates/journal/article.html +++ b/src/themes/OLH/templates/journal/article.html @@ -317,7 +317,7 @@

{% trans 'Files' %}:

- {% 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 %}

@@ -537,7 +537,6 @@

{% trans "Peer Review" %}

{% endblock body %} {% block js %} - {% hook 'article_js_block' %} + {% include "common/elements/journal/external/badges_js.html" %} {% endblock js %} diff --git a/src/themes/clean/templates/journal/article.html b/src/themes/clean/templates/journal/article.html index da96c40565..f35e3c138f 100644 --- a/src/themes/clean/templates/journal/article.html +++ b/src/themes/clean/templates/journal/article.html @@ -134,7 +134,7 @@

{% trans "Publisher Notes" %}

- {% include "common/elements/altmetric_badges.html" with article=article %} + {% include "common/elements/journal/external/badges.html" %} {% if journal_settings.article.disable_article_large_image %}

{% blocktrans count counter=article.frozen_authors.count %} @@ -390,7 +390,6 @@

{% trans "Table of Contents" %}

{% endblock body %} {% block js %} - {% hook 'article_js_block' %} @@ -404,4 +403,5 @@

{% trans "Table of Contents" %}

+ {% include "common/elements/journal/external/badges_js.html" %} {% endblock js %} diff --git a/src/themes/material/templates/journal/article.html b/src/themes/material/templates/journal/article.html index df7273c87b..c205878a8a 100644 --- a/src/themes/material/templates/journal/article.html +++ b/src/themes/material/templates/journal/article.html @@ -240,7 +240,7 @@

{% trans 'Metrics' %}

- {% 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 %}
@@ -549,7 +549,7 @@

}); - + {% include "common/elements/journal/external/badges_js.html" %} {% endblock %} diff --git a/src/utils/install/journal_defaults.json b/src/utils/install/journal_defaults.json index 321648e08e..064e865503 100644 --- a/src/utils/install/journal_defaults.json +++ b/src/utils/install/journal_defaults.json @@ -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" + ] } ]