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