Changeset View
Changeset View
Standalone View
Standalone View
swh/web/templates/includes/show-swh-ids.html
{% comment %} | {% comment %} | ||||
Copyright (C) 2017-2019 The Software Heritage developers | Copyright (C) 2017-2020 The Software Heritage developers | ||||
See the AUTHORS file at the top-level directory of this distribution | See the AUTHORS file at the top-level directory of this distribution | ||||
License: GNU Affero General Public License version 3, or any later version | License: GNU Affero General Public License version 3, or any later version | ||||
See top-level LICENSE file for more information | See top-level LICENSE file for more information | ||||
{% endcomment %} | {% endcomment %} | ||||
{% load swh_templatetags %} | {% load swh_templatetags %} | ||||
{% if swh_ids %} | {% if swhids_info %} | ||||
<div id="swh-identifiers" style="display: none;"> | <div id="swh-identifiers" style="display: none;"> | ||||
{% if swh_ids|length > 1 %} | {% if swhids_info|length > 1 %} | ||||
<a id="right-handle" class="handle ui-slideouttab-handle ui-slideouttab-handle-rounded"><i class="fa fa-link fa-rotate-90 fa-fw"></i>Permalinks</a> | <a id="right-handle" class="handle ui-slideouttab-handle ui-slideouttab-handle-rounded"><i class="fa fa-link fa-rotate-90 fa-fw"></i>Permalinks</a> | ||||
{% else %} | {% else %} | ||||
<a id="right-handle" class="handle ui-slideouttab-handle ui-slideouttab-handle-rounded"><i class="fa fa-link fa-rotate-90 fa-fw"></i>Permalink</a> | <a id="right-handle" class="handle ui-slideouttab-handle ui-slideouttab-handle-rounded"><i class="fa fa-link fa-rotate-90 fa-fw"></i>Permalink</a> | ||||
{% endif %} | {% endif %} | ||||
<div id="swh-identifiers-content"> | <div id="swh-identifiers-content"> | ||||
<p> | <p> | ||||
To reference or cite the objects present in the Software Heritage archive, permalinks based on <a href="https://docs.softwareheritage.org/devel/swh-model/persistent-identifiers.html">persistent identifiers</a> | To reference or cite the objects present in the Software Heritage archive, permalinks based on <a href="https://docs.softwareheritage.org/devel/swh-model/persistent-identifiers.html">persistent identifiers</a> | ||||
must be used instead of copying and pasting the url from the address bar of the browser (as there is no guarantee the current URI | must be used instead of copying and pasting the url from the address bar of the browser (as there is no guarantee the current URI | ||||
scheme will remain the same over time). | scheme will remain the same over time). | ||||
<br/> | <br/> | ||||
<br/> | <br/> | ||||
Select below a type of object currently browsed in order to display its associated persistent identifier and permalink. | Select below a type of object currently browsed in order to display its associated persistent identifier and permalink. | ||||
</p> | </p> | ||||
<ul class="nav nav-pills ml-auto p-2"> | <ul class="nav nav-pills ml-auto p-2"> | ||||
{% for swh_id in swh_ids %} | {% for swhid_info in swhids_info %} | ||||
{% if forloop.first %} | {% if forloop.first %} | ||||
<li class="nav-item"> | <li class="nav-item"> | ||||
<a class="nav-link active" href="#swh-id-tab-{{ swh_id.object_type }}" data-toggle="tab" onclick="swh.browse.swhIdObjectTypeToggled(event)"> | <a class="nav-link active" href="#swh-id-tab-{{ swhid_info.object_type }}" data-toggle="tab" onclick="swh.browse.swhIdObjectTypeToggled(event)"> | ||||
<i class="{{ swh_id.object_icon }} fa-fw"></i>{{ swh_id.object_type }} | <i class="{{ swh_object_icons|key_value:swhid_info.object_type }} fa-fw"></i>{{ swhid_info.object_type }} | ||||
ardumont: `swh_id` or `swhid`?
I recall you changed those to no longer use `_`? | |||||
Done Inline ActionsMy loop variable is badly named here, it should be swhid_info instead. Also I should rename swh_ids to swhids_info and the function get_swh_persistent_ids to get_swhids_info for consistency. I will update the diff accordingly. anlambert: My loop variable is badly named here, it should be `swhid_info` instead.
Also I should rename… | |||||
</a> | </a> | ||||
</li> | </li> | ||||
{% else %} | {% else %} | ||||
<li class="nav-item"> | <li class="nav-item"> | ||||
<a class="nav-link" href="#swh-id-tab-{{ swh_id.object_type }}" data-toggle="tab" onclick="swh.browse.swhIdObjectTypeToggled(event)"> | <a class="nav-link" href="#swh-id-tab-{{ swhid_info.object_type }}" data-toggle="tab" onclick="swh.browse.swhIdObjectTypeToggled(event)"> | ||||
<i class="{{ swh_id.object_icon }} fa-fw"></i>{{ swh_id.object_type }} | <i class="{{ swh_object_icons|key_value:swhid_info.object_type }} fa-fw"></i>{{ swhid_info.object_type }} | ||||
</a> | </a> | ||||
</li> | </li> | ||||
{% endif %} | {% endif %} | ||||
{% endfor %} | {% endfor %} | ||||
</ul> | </ul> | ||||
<div class="tab-content"> | <div class="tab-content"> | ||||
{% for swh_id in swh_ids %} | {% for swhid_info in swhids_info %} | ||||
{% if forloop.first %} | {% if forloop.first %} | ||||
Not Done Inline Actionsnice trick i just noticed! ardumont: nice trick i just noticed! | |||||
<div class="tab-pane active" id="swh-id-tab-{{ swh_id.object_type }}"> | <div class="tab-pane active" id="swh-id-tab-{{ swhid_info.object_type }}"> | ||||
{% else %} | {% else %} | ||||
<div class="tab-pane" id="swh-id-tab-{{ swh_id.object_type }}"> | <div class="tab-pane" id="swh-id-tab-{{ swhid_info.object_type }}"> | ||||
{% endif %} | {% endif %} | ||||
<div class="card"> | <div class="card"> | ||||
<div class="card-body swh-id-ui"> | <div class="card-body swh-id-ui"> | ||||
{% if snapshot_context and snapshot_context.origin_info %} | {% if snapshot_context and snapshot_context.origin_info %} | ||||
<img class="swh-badge swh-badge-origin" src="{% url 'swh-badge' 'origin' snapshot_context.origin_info.url %}" | <img class="swh-badge swh-badge-origin" src="{% url 'swh-badge' 'origin' snapshot_context.origin_info.url %}" | ||||
onclick="swh.webapp.showBadgeInfoModal('origin', '{{ snapshot_context.origin_info.url }}')" | onclick="swh.webapp.showBadgeInfoModal('origin', '{{ snapshot_context.origin_info.url }}')" | ||||
title="Click to display badge integration info"> | title="Click to display badge integration info"> | ||||
{% endif %} | {% endif %} | ||||
<img class="swh-badge swh-badge-{{ swh_id.object_type }}" src="{% url 'swh-badge' swh_id.object_type swh_id.object_id %}" | {% if swhid_info.object_id %} | ||||
onclick="swh.webapp.showBadgeInfoModal('{{ swh_id.object_type }}', $(this).parent().find('.swh-id').text())" | <img class="swh-badge swh-badge-{{ swhid_info.object_type }}" src="{% url 'swh-badge' swhid_info.object_type swhid_info.object_id %}" | ||||
onclick="swh.webapp.showBadgeInfoModal('{{ swhid_info.object_type }}', $(this).parent().find('.swh-id').text())" | |||||
title="Click to display badge integration info"> | title="Click to display badge integration info"> | ||||
<pre><a class="swh-id" id="{{ swh_id.swh_id }}" href="{{ swh_id.swh_id_url }}">{{ swh_id.swh_id }}</a></pre> | <pre><a class="swh-id" id="{{ swhid_info.swhid }}" href="{{ swhid_info.swhid_url }}">{{ swhid_info.swhid }}</a></pre> | ||||
{% if swh_id.show_options %} | {% endif %} | ||||
{% if swhid_info.swhid_with_context is not None %} | |||||
<div class="float-left"> | <div class="float-left"> | ||||
<form id="swh-id-options"> | <form id="swh-id-options"> | ||||
{% if snapshot_context and snapshot_context.origin_info %} | {% if snapshot_context and snapshot_context.origin_info %} | ||||
<div class="form-check swh-id-option"> | <div class="form-check swh-id-option"> | ||||
<input class="form-check-input swh-id-option-origin" value="option-origin" type="checkbox" | <input class="form-check-input swh-id-option-origin" value="option-origin" type="checkbox" | ||||
id="swh-id-option-origin-{{ swh_id.object_type }}" | id="swh-id-option-origin-{{ swhid_info.object_type }}" | ||||
data-swh-origin="{{ snapshot_context.origin_info.url }}" | data-swh-origin="{{ snapshot_context.origin_info.url }}" | ||||
onclick="swh.browse.swhIdOptionOriginToggled(event)"> | onclick="swh.browse.swhIdOptionOriginToggled(event)"> | ||||
<label class="form-check-label" for="swh-id-option-origin-{{ swh_id.object_type }}">Add origin info</label> | <label class="form-check-label" for="swh-id-option-origin-{{ swhid_info.object_type }}">Add origin info</label> | ||||
</div> | </div> | ||||
{% endif %} | {% endif %} | ||||
{% if swh_id.object_type == 'content' %} | {% if swhid_info.object_type == 'content' %} | ||||
<div class="form-check swh-id-option"> | <div class="form-check swh-id-option"> | ||||
<input class="form-check-input swh-id-option-lines" value="option-lines" type="checkbox" | <input class="form-check-input swh-id-option-lines" value="option-lines" type="checkbox" | ||||
id="swh-id-option-lines-{{ swh_id.object_type }}" | id="swh-id-option-lines-{{ swhid_info.object_type }}" | ||||
onclick="swh.browse.swhIdOptionLinesToggled(event)"> | onclick="swh.browse.swhIdOptionLinesToggled(event)"> | ||||
<label class="form-check-label" for="swh-id-option-lines-{{ swh_id.object_type }}">Add selected lines info</label> | <label class="form-check-label" for="swh-id-option-lines-{{ swhid_info.object_type }}">Add selected lines info</label> | ||||
</div> | </div> | ||||
{% endif %} | {% endif %} | ||||
</form> | </form> | ||||
</div> | </div> | ||||
{% endif %} | {% endif %} | ||||
<div class="float-right"> | <div class="float-right"> | ||||
<button type="button" class="btn btn-default btn-sm btn-swh-id-copy" | <button type="button" class="btn btn-default btn-sm btn-swh-id-copy" | ||||
title="Copy persistent identifier to clipboard"> | title="Copy persistent identifier to clipboard"> | ||||
<i class="fa fa-clipboard fa-fw" aria-hidden="true"></i>Copy identifier | <i class="fa fa-clipboard fa-fw" aria-hidden="true"></i>Copy identifier | ||||
<button type="button" class="btn btn-default btn-sm btn-swh-id-url-copy" | <button type="button" class="btn btn-default btn-sm btn-swh-id-url-copy" | ||||
title="Copy url resolving the persistent identifier to clipboard"> | title="Copy url resolving the persistent identifier to clipboard"> | ||||
<i class="fa fa-clipboard fa-fw" aria-hidden="true"></i>Copy permalink | <i class="fa fa-clipboard fa-fw" aria-hidden="true"></i>Copy permalink | ||||
</button> | </button> | ||||
</div> | </div> | ||||
</div> | </div> | ||||
</div> | </div> | ||||
</div> | </div> | ||||
{% endfor %} | {% endfor %} | ||||
</div> | </div> | ||||
</div> | </div> | ||||
</div> | </div> | ||||
<script> | <script> | ||||
swh.webapp.setSwhIdsContext({{ swh_ids|jsonify }}); | swh.webapp.setSwhIdsContext({{ swhids_info|jsonify }}); | ||||
</script> | </script> | ||||
{% endif %} | {% endif %} |
swh_id or swhid?
I recall you changed those to no longer use _?