mirror of
https://gitlab.crans.org/bde/nk20
synced 2025-06-21 01:48:21 +02:00
Wrapped apps
This commit is contained in:
8
apps/wrapped/templates/wrapped/1/wrapped_view.html
Normal file
8
apps/wrapped/templates/wrapped/1/wrapped_view.html
Normal file
@ -0,0 +1,8 @@
|
||||
{% comment %}
|
||||
Copyright (C) 2018-2024 by BDE ENS Paris-Saclay
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
{% endcomment %}
|
||||
{% block content %}
|
||||
{{ wrapped.data_json }}
|
||||
{% endblock %}
|
||||
|
62
apps/wrapped/templates/wrapped/wrapped_list.html
Normal file
62
apps/wrapped/templates/wrapped/wrapped_list.html
Normal file
@ -0,0 +1,62 @@
|
||||
{% 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">
|
||||
function refreshTable() {
|
||||
$("#wrapped_table").load(location.pathname + " #wrapped_table");
|
||||
}
|
||||
|
||||
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 %}
|
Reference in New Issue
Block a user