Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

parent-doi: add link to record landing page #2314

Merged
Merged
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
1 change: 1 addition & 0 deletions invenio_app_rdm/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -647,6 +647,7 @@ def files_rest_permission_factory(obj, action):
"robots": "/robots.txt",
"help_search": "/help/search",
"help_statistics": "/help/statistics",
"help_versioning": "/help/versioning",
"record_search": "/search",
"record_detail": "/records/<pid_value>",
"record_export": "/records/<pid_value>/export/<export_format>",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,9 @@
it under the terms of the MIT License; see LICENSE file for more details.
#}

{%- from "invenio_app_rdm/records/macros/doi.html" import show_doi %}

{%- set id_doi = record.pids.get('doi', {}).get('identifier') %}
{% if id_doi %}
<dt class="ui tiny header">{{_('DOI')}}</dt>
<dd>
<span class="get-badge" data-toggle="tooltip" data-placement="bottom" style="cursor: pointer;"
title="{{ _('Get the DOI badge!') }}">
<img id="record-doi-badge" data-target="[data-modal='{{ id_doi }}']"
src="{{ url_for('invenio_formatter_badges.badge', title='DOI', value=id_doi, ext='svg') }}" alt="{{ id_doi }}" />
</span>

<div id="doi-modal" class="ui modal fade badge-modal" data-modal="{{ id_doi }}">
<div class="header">{{ _("DOI Badge") }}</div>
<div class="content">
<h4>
<small>{{ _("DOI") }}</small>
</h4>
<h4>
<pre>{{ id_doi }}</pre>
</h4>
{% from "semantic-ui/invenio_formatter/macros/badges.html" import badges_formats_list %}
{{ badges_formats_list(url_for('invenio_formatter_badges.badge', title='DOI', value=id_doi, ext='svg', _external=True, _scheme='https'), record.links.doi) }}
</div>
</div>
</dd>
{{ show_doi(id_doi, record) }}
{% endif %}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
list_string_values, show_dates, show_detail, show_detail_conference %}

{%- set id_doi = record.pids.get('doi', {}).get('identifier') %}

<div class="sidebar-container">
<h2 class="ui medium top attached header mt-0">{{ _('Details')}}</h2>
<div id="record-details" class="ui segment bottom attached rdm-sidebar">
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{#
Copyright (C) 2023 CERN.

Invenio RDM Records is free software; you can redistribute it and/or modify
it under the terms of the MIT License; see LICENSE file for more details.
#}

{% macro show_doi(doi_value, record, badge_id="record-doi-badge", modal_id="doi-modal", subheader=None) %}
<dt class="ui tiny header">{{_('DOI')}}
{% if subheader %}
<i><span class="doi sub header">{{subheader}}</span></i></dt>
{% endif %}
<dd>
<span class="get-badge" data-toggle="tooltip" data-placement="bottom" style="cursor: pointer;"
title="{{ _('Get the DOI badge!') }}">
<img id='{{badge_id}}' data-target="[data-modal='{{ doi_value }}']"
src="{{ url_for('invenio_formatter_badges.badge', title='DOI', value=doi_value, ext='svg') }}" alt="{{ doi_value }}" />
</span>

<div id="{{modal_id}}" class="ui modal fade badge-modal" data-modal="{{ doi_value }}">
<div class="header">{{ _("DOI Badge") }}</div>
<div class="content">
<h4>
<small>{{ _("DOI") }}</small>
</h4>
<h4>
<pre>{{ doi_value }}</pre>
</h4>
{% from "semantic-ui/invenio_formatter/macros/badges.html" import badges_formats_list %}
{{ badges_formats_list(url_for('invenio_formatter_badges.badge', title='DOI', value=doi_value, ext='svg', _external=True, _scheme='https'), record.links.doi) }}
</div>
</div>
</dd>
{%- endmacro %}
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@ import React, { useEffect, useState } from "react";
import { Grid, Icon, Message, Placeholder, List, Divider } from "semantic-ui-react";
import { i18next } from "@translations/invenio_app_rdm/i18next";
import PropTypes from "prop-types";
import { Trans } from "react-i18next";

const deserializeRecord = (record) => ({
id: record.id,
parent: record.parent,
parent_id: record.parent.id,
publication_date: record.ui.publication_date_l10n_medium,
version: record.ui.version,
Expand Down Expand Up @@ -81,6 +83,7 @@ const PreviewMessage = () => {

export const RecordVersionsList = ({ record, isPreview }) => {
const recordDeserialized = deserializeRecord(record);
const recordParentDOI = recordDeserialized?.parent?.pids?.doi?.identifier;
const recid = recordDeserialized.id;
const [loading, setLoading] = useState(true);
const [currentRecordInResults, setCurrentRecordInResults] = useState(false);
Expand Down Expand Up @@ -152,6 +155,21 @@ export const RecordVersionsList = ({ record, isPreview }) => {
</Grid.Row>
</Grid>
)}
{recordParentDOI && (
<List.Item className="parent-doi pr-0">
<List.Content floated="left">
<Trans>
<p>
<strong>Cite all versions?</strong> You can cite all versions by using
the DOI{" "}
<a href={recordDeserialized.links.parent_doi}>{recordParentDOI}</a>.
This DOI represents all versions, and will always resolve to the latest
one. <a href="/help/versioning">Read more</a>.
</p>
</Trans>
</List.Content>
</List.Item>
)}
</List>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,8 @@ aside.sidebar {
&.text-muted {
color: @mutedTextColor;
}

.doi.sub.header {
display: inline-block;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,15 @@
word-wrap: break-word;
font-size: 80%;
}

&.parent-doi:last-child {
border-top: none;
}

&.parent-doi {
margin-top: .5rem;
word-wrap: break-word;
Comment on lines +63 to +64
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these already exist for class .doi, see list.overrides line 50, could be reused?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried it but display: block and font-size is not what we want for the parent doi....

}
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
{#
Copyright (C) 2021-2023 CERN.
Copyright (C) 2021 Northwestern University.

Invenio App RDM is free software; you can redistribute it and/or modify it
under the terms of the MIT License; see LICENSE file for more details.
#}
{%- set title = _("FAQ versioning") %}
{%- extends config.BASE_TEMPLATE %}

{%- block page_body %}
<div class="ui two column grid container rel-mt-2">
<div class="ui row">
<div class="ui sixteen wide column">
<h2 id="versioning">DOI versioning</h2>
</div>
<div class="ui eight wide column">
<h5>
<p>What is DOI versioning?</p>
</h5>
<p>DOI versioning allows you to:</p>
<ul>
<li>edit/update the record’s files after they have been published.</li>
<li>cite a specific version of a record.</li>
<li>cite all of versions of a record.</li>
</ul>
<h5>
<p>How does DOI versioning work?</p>
</h5>
<p>
When you publish an upload for the first time, we register two DOIs:
</p>
<ul>
<li>
a DOI representing the <strong>specific version</strong> of your record.
</li>
<li>
a DOI representing <strong>all of the versions</strong> of your record.
</li>
</ul>
<p>Afterwards, we register a DOI for every new version of your upload.</p>
<p>
This is best illustrated by an example of a software package. If the
software has been released in two versions (v1.0 and v1.1), then
the following DOIs would have been registered:
</p>
<ul>
<li><strong>v1.0 (specific version):</strong> 10.1234/7s0da-05p39</li>
<li><strong>v1.1 (specific version):</strong> 10.1234/chc5z-w0r30</li>
<li><strong>Concept (all versions):</strong> 10.1234/3s67k-pd636</li>
</ul>
<p>
The first two DOIs for versions <strong>v1.0</strong> and
<strong>v.1.1</strong> represent the specific versions of the software.
The last DOI represents all the versions of the given software package,
i.e. the concept of the software package and the ensemble of versions. We
therefore also call the them <strong>Version DOIs</strong> and
<strong>Concept DOIs</strong> (note, technically both are just normal
DOIs).
</p>
<p>
You may notice that the version DOIs do not include a “.v1”-suffix. Read
below to find out why.
</p>
<h5>
<p>Which DOI should I use in citations?</p>
</h5>
<p>
You should normally always use the DOI for the
<strong>specific version</strong> of your record in citations. This is to
ensure that other researchers can access the
<strong>exact</strong> research artefact you used for reproducibility. By
default, we use the specific version to generate citations.
</p>
<p>
You can use the Concept DOI representing all versions in citations when it
is desirable to cite an evolving research artifact, without being specific
about the version.
</p>
<h5>
<p>Where does the Concept DOI resolve to?</p>
</h5>
<p>
The Concept DOI resolves to the landing page of the latest
version of your record.
</p>
</div>
<div class="ui eight wide column">
<h5>
<p>
I only want to change the title of my upload, do I still get a new DOI?
</p>
</h5>
<p>
No, you can continue to edit the metadata of your upload without
creating a new version of a record. You should only create a new version
if you want to update the files of your record.
</p>

<h5>
<p>Why don’t the DOIs have a version number suffix like “.v1”?</p>
</h5>
<p>
Including semantic information such as the version number in a DOI is bad
practice, because this information may change over time, while DOIs must
remain persistent and should not change.
</p>
<p>
Moreover, DOI versioning is linear, which means that the version number may
in fact not be the real version number of the resource.
Take for instance software, where it is common practice to have dot
versions and make new releases in a non-linear order (e.g. first v1.0,
then v1.1, then v2.0, then v1.2).
</p>
<p>
The versioning suffix is also not a functionality of the DOI system, i.e.
adding .v2 to a DOI will not resolve to version 2 of a resource for any DOI
from any provider. Different providers also use different patterns such as
e.g. .v2, .2, /2.
</p>
<p>
Most importantly, version suffixes are not machine readable. A discovery
system that understands DOIs, will not know that .v1 and .v2 of a DOI are
in fact two versions of the same resource.
</p>
<p>
A better solution to this problem is to semantically link two DOIs in the
metadata of a DOI. This ensures that discovery systems have a
machine-readable way to discover that two DOIs are versions of the same
resource.
</p>
<p>
See also <a href="https://doi.org/10.5438/55E5-T5C0">Cool DOIs</a> for
further information.
</p>

<h5>
<p>Do you duplicate all the files for every new version of a record?</p>
</h5>
<p>
No, if you change a 10kb README file in 50GB dataset we do not duplicate
the entire 50GB dataset. InvenioRDM, the underlying technical software
platform, efficiently handles the file storage so we only store the new
extra 10kb.
</p>
</div>
</div>
</div>
{% endblock page_body %}
15 changes: 15 additions & 0 deletions invenio_app_rdm/theme/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ def create_blueprint(app):
blueprint.add_url_rule(
**create_url_rule(routes["help_statistics"], default_view_func=help_statistics)
)
blueprint.add_url_rule(
**create_url_rule(routes["help_versioning"], default_view_func=help_versioning)
)

@blueprint.before_app_first_request
def init_menu():
Expand Down Expand Up @@ -115,6 +118,18 @@ def help_statistics():
)


def help_versioning():
"""DOI versioning help guide."""
# Default to rendering english page if locale page not found.
locale = get_locale()
return render_template(
[
f"invenio_app_rdm/help/versioning.{locale}.html",
"invenio_app_rdm/help/versioning.en.html",
]
)


def notification_settings():
"""View for notification settings."""
preferences_notifications_form = NotificationsForm(
Expand Down