Add public shareable link for galleries
This commit is contained in:
parent
b76a350c28
commit
a875c2707b
7 changed files with 126 additions and 14 deletions
24
photo21/static/copy-button.js
Normal file
24
photo21/static/copy-button.js
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
document.querySelectorAll('[data-clipboard-text]').forEach(function(btn) {
|
||||
btn.addEventListener('click', function() {
|
||||
var text = btn.dataset.clipboardText;
|
||||
if (navigator.clipboard) {
|
||||
navigator.clipboard.writeText(text);
|
||||
} else {
|
||||
var ta = document.createElement('textarea');
|
||||
ta.value = text;
|
||||
ta.style.position = 'fixed';
|
||||
ta.style.opacity = '0';
|
||||
document.body.appendChild(ta);
|
||||
ta.select();
|
||||
document.execCommand('copy');
|
||||
document.body.removeChild(ta);
|
||||
}
|
||||
var original = btn.textContent;
|
||||
btn.textContent = '✓ Copied!';
|
||||
btn.disabled = true;
|
||||
setTimeout(function() {
|
||||
btn.textContent = original;
|
||||
btn.disabled = false;
|
||||
}, 2000);
|
||||
});
|
||||
});
|
||||
|
|
@ -36,6 +36,7 @@ SPDX-License-Identifier: GPL-3.0-or-later
|
|||
</button>
|
||||
<div class="collapse navbar-collapse" id="navbarSupportedContent">
|
||||
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
|
||||
{% if not request.guest_mode %}
|
||||
<li class="nav-item">
|
||||
{% url 'photologue:pl-gallery-archive' as url %}
|
||||
<a class="nav-link {% if request.path_info == url %}active{% endif %}" href="{{ url }}">{% trans 'Galleries' %}</a>
|
||||
|
|
@ -51,6 +52,7 @@ SPDX-License-Identifier: GPL-3.0-or-later
|
|||
<a class="nav-link" href="{% url 'admin:index' %}">{% trans 'Manage' %}</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</ul>
|
||||
<ul class="navbar-nav">
|
||||
{% if request.user.is_authenticated %}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue