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

Show the ID in plugin detail page #344

Merged
merged 1 commit into from
Jan 31, 2024
Merged
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
69 changes: 69 additions & 0 deletions qgis-app/plugins/templates/plugins/plugin_detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,59 @@
})

});

function copyToClipBoard(plugin_id) {
navigator.clipboard.writeText(plugin_id);

var tooltip = document.getElementById("copyTooltip");
tooltip.innerHTML = "Plugin ID copied!";
}
</script>
{% endblock %}
{% block extracss %}
<link type="text/css" href="{% static "jquery-ratings/jquery.ratings.css" %}" rel="stylesheet" />
{{ block.super }}
<style>
.tooltip {
position: relative;
display: inline-block;
opacity: 1 !important;
margin-left: 10px;
}

.tooltip .tooltiptext {
visibility: hidden;
width: 140px;
background-color: #555;
color: #fff;
text-align: center;
border-radius: 6px;
padding: 5px;
position: absolute;
z-index: 1;
bottom: 150%;
left: 50%;
margin-left: -75px;
opacity: 0;
transition: opacity 0.3s;
}

.tooltip .tooltiptext::after {
content: "";
position: absolute;
top: 100%;
left: 50%;
margin-left: -5px;
border-width: 5px;
border-style: solid;
border-color: #555 transparent transparent transparent;
}

.tooltip:hover .tooltiptext {
visibility: visible;
opacity: 1;
}
</style>
{% endblock %}
{% block content %}
<div class="row">
Expand All @@ -101,6 +149,15 @@ <h2>{{ object.name }}
{% endthumbnail %}
{% endif %}
</h2>
<div>
<span style="color:gray;">{% trans "Plugin ID:" %} {{ object.pk }}</span>
<div class="tooltip">
<button class="btn btn-default" onclick="copyToClipBoard('{{ object.pk }}')">
<span class="tooltiptext" id="copyTooltip">{% trans "Copy to clipboard" %}</span>
<i class="icon-copy icon-white"></i>
</button>
</div>
</div>
</div>
</div>
<div>
Expand Down Expand Up @@ -212,6 +269,18 @@ <h2>{{ object.name }}
<dt>{% trans "Latest experimental version"%}:</dt>
<dd> <a title="{% trans "Click to download" %}" href="{% url "version_detail" object.package_name object.experimental.version %}">{{ object.experimental.version }}</a></dd>
{% endif %}
{% if object.pk %}
<dt>{% trans "Plugin ID"%}</dt>
<dd style="margin-top: -3px;">
<span>{{ object.pk }}</span>
<div class="tooltip">
<button class="btn btn-default" onclick="copyToClipBoard('{{ object.pk }}')">
<span class="tooltiptext" id="copyTooltip">{% trans "Copy to clipboard" %}</span>
<i class="icon-copy icon-white"></i>
</button>
</div>
</dd>
{% endif %}
</dl>
</div>
<div class="tab-pane" id="plugin-versions">
Expand Down
Loading