mirror of
https://gitlab.crans.org/bde/nk20
synced 2025-04-25 08:02:37 +00:00
70 lines
1.9 KiB
HTML
70 lines
1.9 KiB
HTML
{% extends "base.html" %}
|
|
{% comment %}
|
|
SPDX-License-Identifier: GPL-3.0-or-later
|
|
{% endcomment %}
|
|
{% load render_table from django_tables2 %}
|
|
{% load i18n %}
|
|
|
|
{% block content %}
|
|
<div class="row justify-content-center">
|
|
<div class="col-md-10">
|
|
<div class="card card-border shadow">
|
|
<div class="card-header text-center">
|
|
<h5> {{ title }}</h5>
|
|
</div>
|
|
<div class="card-body px-0 py-0" id="wrapped_table">
|
|
{% render_table table %}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{% endblock %}
|
|
|
|
{% block extrajavascript %}
|
|
<script type="text/javascript">
|
|
let club_not_public = {{ club_not_public }};
|
|
if (club_not_public) { (addMsg("{% trans "Do not forget to ask permission to people who are in your wrapped before to make them public" %}", 'warning'));}
|
|
function refreshTable() {
|
|
$("#wrapped_table").load(location.pathname + " #wrapped_table");
|
|
}
|
|
|
|
function copylink(id) {
|
|
navigator.clipboard.writeText({{ request.get_full_path }} + id)
|
|
.then(() => { addMsg("{% trans "Link copied" %}", 'success', 1000);});
|
|
}
|
|
|
|
function makepublic(id, isprivate) {
|
|
const makepublic_obj = $('#makepublic_'+id)
|
|
|
|
if (makepublic_obj.data('pending'))
|
|
// The button is already clicked
|
|
{ return }
|
|
|
|
makepublic_obj.html('<strong style="font-size: 16pt;">⟳</strong>')
|
|
makepublic_obj.data('pending', true)
|
|
|
|
$.ajax({
|
|
url: '/api/wrapped/wrapped/' + id + '/',
|
|
type: 'PATCH',
|
|
dataType: 'json',
|
|
headers: {
|
|
'X-CSRFTOKEN': CSRF_TOKEN
|
|
},
|
|
data: {
|
|
public: isprivate
|
|
},
|
|
success: function() {
|
|
if(!isprivate)
|
|
addMsg("{% trans "Wrapped is private" %}", 'success', 2000)
|
|
else addMsg("{% trans "Wrapped is public" %}", 'success', 2000)
|
|
refreshTable()
|
|
},
|
|
error: function (err) {
|
|
addMsg("{% trans "An error occured" %}", 'danger')
|
|
refreshTable()
|
|
}
|
|
})
|
|
}
|
|
</script>
|
|
{% endblock %}
|