Display pools only when necessary
This commit is contained in:
parent
364025b195
commit
70d2ade6a3
|
@ -63,10 +63,12 @@
|
||||||
|
|
||||||
<hr>
|
<hr>
|
||||||
|
|
||||||
<h3>{% trans "Pools" %}</h3>
|
{% if pools.data %}
|
||||||
<div id="pools_table">
|
<h3>{% trans "Pools" %}</h3>
|
||||||
{% render_table pools %}
|
<div id="pools_table">
|
||||||
</div>
|
{% render_table pools %}
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
{% if user.registration.is_admin %}
|
{% if user.registration.is_admin %}
|
||||||
<button class="btn btn-block btn-success" data-toggle="modal" data-target="#addPoolModal">{% trans "Add new pool" %}</button>
|
<button class="btn btn-block btn-success" data-toggle="modal" data-target="#addPoolModal">{% trans "Add new pool" %}</button>
|
||||||
|
@ -87,20 +89,24 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% trans "Add pool" as modal_title %}
|
{% if user.registration.is_admin %}
|
||||||
{% trans "Add" as modal_button %}
|
{% trans "Add pool" as modal_title %}
|
||||||
{% url "participation:pool_create" as modal_action %}
|
{% trans "Add" as modal_button %}
|
||||||
{% include "base_modal.html" with modal_id="addPool" %}
|
{% url "participation:pool_create" as modal_action %}
|
||||||
|
{% include "base_modal.html" with modal_id="addPool" %}
|
||||||
|
{% endif %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block extrajavascript %}
|
{% block extrajavascript %}
|
||||||
<script>
|
<script>
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
$('button[data-target="#addPoolModal"]').click(function() {
|
{% if user.registration.is_admin %}
|
||||||
let modalBody = $("#addPoolModal div.modal-body");
|
$('button[data-target="#addPoolModal"]').click(function() {
|
||||||
if (!modalBody.html().trim())
|
let modalBody = $("#addPoolModal div.modal-body");
|
||||||
modalBody.load("{% url "participation:pool_create" %} #form-content")
|
if (!modalBody.html().trim())
|
||||||
});
|
modalBody.load("{% url "participation:pool_create" %} #form-content")
|
||||||
|
});
|
||||||
|
{% endif %}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
Loading…
Reference in New Issue