Skip to content

Commit

Permalink
Simplifie les data attributes utilisés pour la copie du permalien
Browse files Browse the repository at this point in the history
  • Loading branch information
Migwel committed Sep 13, 2023
1 parent 6fa7900 commit 5c1dadd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
6 changes: 3 additions & 3 deletions assets/js/message-permalink.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
(function() {
'use strict'

$('.topic-message').on('click', "[data-ajax-input='copy-hyperlink']", function(e) {
$('.topic-message').on('click', '[data-copy-permalink]', function(e) {
e.stopPropagation()
e.preventDefault()
navigator.clipboard.writeText($(this).attr("data-message-url"));
const dropdown = e.target.closest(".dropdown")
navigator.clipboard.writeText($(this).attr('data-copy-permalink'))
const dropdown = e.target.closest('.dropdown')
dropdown.removeAttribute('open')
})
})(jQuery)
3 changes: 1 addition & 2 deletions templates/misc/message.part.html
Original file line number Diff line number Diff line change
Expand Up @@ -144,12 +144,11 @@

{% if not is_mp %}
<li>
<a data-ajax-input="copy-hyperlink" data-message-url="{{ request.build_absolute_uri }}#p{{ message.pk }}" class="ico-after import">
<a data-copy-permalink="{{ request.build_absolute_uri }}#p{{ message.pk }}" class="ico-after import">
<span>{% trans "Copier le permalien" %}</span>
</a>
</li>
{% endif %}

{% if not is_mp %}
<li>
<a href="#signal-message-{{ message.id }}" class="ico-after alert open-modal">
Expand Down

0 comments on commit 5c1dadd

Please sign in to comment.