90 lines
2.9 KiB
Twig
90 lines
2.9 KiB
Twig
|
{% extends 'base.html.twig' %}
|
||
|
|
||
|
|
||
|
{% block body %}
|
||
|
<h1 class="page-header">
|
||
|
Gestion des Pages
|
||
|
</h1>
|
||
|
|
||
|
<a href="{{ path('app_config_page_submit') }}" class="btn btn-success">Ajouter une Page</a>
|
||
|
|
||
|
<div class="custom-control custom-switch float-right">
|
||
|
<input id="alluser" type="checkbox" class="custom-control-input">
|
||
|
<label id="labelalluser" class="custom-control-label" for="alluser">Afficher les pages créées par des utilisateurs</label>
|
||
|
</div>
|
||
|
<br><br>
|
||
|
|
||
|
<div class="card">
|
||
|
<div class="card-header">
|
||
|
<i class="fa fa-table fa-fw"></i> Liste des Pages
|
||
|
</div>
|
||
|
|
||
|
<div class="card-body">
|
||
|
<div class="dataTable_wrapper">
|
||
|
<table class="table table-striped table-bordered table-hover" id="dataTables" style="width:100%">
|
||
|
<thead>
|
||
|
<tr>
|
||
|
<th width="140px" class="no-sort">Action</th>
|
||
|
<th>Ordre</th>
|
||
|
<th>Nom</th>
|
||
|
<th class="no-sort">Catégorie</th>
|
||
|
<th>Propriétaire</th>
|
||
|
</tr>
|
||
|
</thead>
|
||
|
</table>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
{% endblock %}
|
||
|
|
||
|
{% block localjavascript %}
|
||
|
$(document).ready(function() {
|
||
|
{% if not app.session.get('alluserpage') is empty %}
|
||
|
var state={{ app.session.get('alluserpage') }};
|
||
|
if(state) {
|
||
|
$("#labelalluser").html("Afficher les pages non liées à un utilisateur");
|
||
|
$("#alluser").attr('checked', true);
|
||
|
}
|
||
|
{% endif %}
|
||
|
|
||
|
table = $('#dataTables').DataTable({
|
||
|
columnDefs: [ { "targets": 'no-sort', "orderable": false } ],
|
||
|
responsive: true,
|
||
|
iDisplayLength: 100,
|
||
|
order: [[ 1, "asc" ]],
|
||
|
processing: true,
|
||
|
serverSide: true,
|
||
|
ajax: {
|
||
|
"url": "{{ path('app_config_page_ajax_list') }}",
|
||
|
"data": function ( d ) {
|
||
|
return $.extend( {}, d, {
|
||
|
"alluser": $('#alluser').is(':checked')
|
||
|
});
|
||
|
}
|
||
|
},
|
||
|
|
||
|
drawCallback: function(settings) {
|
||
|
$("a[data-method='delete']").click(function(){
|
||
|
if( !confirm('Êtes-vous sûr de vouloir supprimer cette page ?')) {
|
||
|
return false;
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
});
|
||
|
});
|
||
|
|
||
|
$('#alluser').change(function() {
|
||
|
if (typeof table !== 'undefined') {
|
||
|
table.ajax.reload();
|
||
|
}
|
||
|
|
||
|
var check = $('#alluser').is(':checked');
|
||
|
if(check)
|
||
|
$("#labelalluser").html("Afficher les pages non liées à un utilisateur");
|
||
|
else
|
||
|
$("#labelalluser").html("Afficher les pages créées par des utilisateurs");
|
||
|
|
||
|
});
|
||
|
|
||
|
{% endblock %}
|