325 lines
14 KiB
Twig
325 lines
14 KiB
Twig
{% extends '@CadolesCore/base.html.twig' %}
|
|
|
|
{% block pagewrapper %}
|
|
<h1>
|
|
Gestion des Annonces
|
|
</h1>
|
|
|
|
<div class="row">
|
|
<div class="col-md-9">
|
|
<p>
|
|
<a href="{{ path('cadoles_portal_config_alert_submit') }}" class="btn btn-success">Ajouter une Annonce</a>
|
|
<a href="{{ path('cadoles_portal_config_alertcategory_submit') }}" class="btn btn-success">Ajouter une Catégorie</a>
|
|
</p>
|
|
|
|
<div id="list" class="panel-group">
|
|
{% for alert in alerts %}
|
|
<div
|
|
class="
|
|
panel
|
|
list-item
|
|
alertcategory-{{ alert.alertcategory.id }}
|
|
{{ alert.isOnline ? "alertstatut-online" : ""}}
|
|
{{ alert.isPending ? "alertstatut-pending" : ""}}
|
|
{{ alert.isArchived ? "alertstatut-archived" : ""}}
|
|
{% for group in alert.groups %}{{ ' group-' ~ group.id }}{% endfor %}
|
|
{% for role in alert.roles %}{{ ' role-' ~ role }}{% endfor %}
|
|
"
|
|
data-alert-category-id="{{ alert.alertcategory.id }}"
|
|
data-alert-id="{{ alert.id }}"
|
|
style="background: {{ alert.alertcategory.color ? '#'~alert.alertcategory.color : '#'~color['main'] }};"
|
|
>
|
|
<div class="panel-heading" role="tab">
|
|
<a href="{{ path('cadoles_portal_config_alert_update', { id: alert.id }) }}" class="panel-heading-icon pull-left">
|
|
{% if alert.alertcategory.icon %}
|
|
<img height="25" src="/{{ alias }}/{{ alert.alertcategory.icon.label }}">
|
|
{% else %}
|
|
<img height="25" src="/{{ alias }}/uploads/icon/icon_megaphone.png">
|
|
{% endif %}
|
|
</a>
|
|
|
|
<a href="{{ path('cadoles_portal_config_alert_update', { id: alert.id }) }}">
|
|
<i class="fa fa-arrows-v" style="color: rgba(255,255,255,.5);"></i>
|
|
{{ alert.title }}
|
|
</a>
|
|
|
|
<a role="button" data-toggle="collapse" data-parent="#accordion" href="#alert-{{ alert.id }}" aria-expanded="true" aria-controls="collapseOne" class="panel-heading-chevron pull-right">
|
|
<i class="fa fa-chevron-down"></i>
|
|
</a>
|
|
</div>
|
|
|
|
<div id="alert-{{ alert.id }}" class="panel-body panel-collapse collapse">
|
|
{{ alert.content|raw }}
|
|
</div>
|
|
|
|
<input type="hidden" name="alert_item[id][]" value="{{ alert.id }}" />
|
|
</div>
|
|
{% endfor %}
|
|
</div>
|
|
</div>
|
|
|
|
<div class="col-md-3">
|
|
<div class="panel panel-default">
|
|
<div class="panel-heading">
|
|
<i class="fa fa-filter"></i>
|
|
Afficher par Catégorie
|
|
</div>
|
|
|
|
<div class="panel-body">
|
|
<div id="category-filter" class="list-group">
|
|
{% for alertcategory in alertcategorys %}
|
|
<div class="clearfix">
|
|
<a class="btn btn-primary pull-right" href="{{ path('cadoles_portal_config_alertcategory_update', { id: alertcategory.id }) }}" style="margin:4px">
|
|
<i class="fa fa-edit"></i>
|
|
</a>
|
|
|
|
<a href="#" class="list-group-item active category-alert-item" data-category="{{ alertcategory.id }}" style="border-left: 15px solid {{ alertcategory.color ? '#'~alertcategory.color : '#'~color['main'] }}; position: inherit;">
|
|
{% if alertcategory.icon %}
|
|
<img height="25" src="/{{ alias }}/{{ alertcategory.icon.label }}">
|
|
{% else %}
|
|
<img height="25" src="/{{ alias }}/uploads/icon/icon_megaphone.png">
|
|
{% endif %}
|
|
|
|
{{ alertcategory.label }}
|
|
</a>
|
|
</div>
|
|
{% endfor %}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="panel panel-default">
|
|
<div class="panel-heading">
|
|
<i class="fa fa-filter"></i>
|
|
Afficher par Rôle
|
|
</div>
|
|
<div class="panel-body">
|
|
<ul id="role-filter" class="list-group">
|
|
<a class="active list-group-item filterfgall" id="allrole" style="cursor:pointer">
|
|
<i class="fa fa-users"></i>
|
|
Toutes les Rôles
|
|
<span class="badge">{{ alerts|length }}</span>
|
|
</a>
|
|
|
|
<a class="list-group-item" data-role="ROLE_ANONYME" style="cursor:pointer">
|
|
<i class="fa fa-user"></i>
|
|
Visiteur
|
|
<span class="badge"></span>
|
|
</a>
|
|
|
|
<a class="list-group-item" data-role="ROLE_USER" style="cursor:pointer">
|
|
<i class="fa fa-user"></i>
|
|
Utilisateur
|
|
<span class="badge"></span>
|
|
</a>
|
|
|
|
<a class="list-group-item" data-role="ROLE_ANIM" style="cursor:pointer">
|
|
<i class="fa fa-user"></i>
|
|
Animateur de Groupe
|
|
<span class="badge"></span>
|
|
</a>
|
|
|
|
<a class="list-group-item" data-role="ROLE_MODO" style="cursor:pointer">
|
|
<i class="fa fa-user"></i>
|
|
Modérateur
|
|
<span class="badge"></span>
|
|
</a>
|
|
|
|
<a class="list-group-item" data-role="ROLE_ADMIN" style="cursor:pointer">
|
|
<i class="fa fa-user"></i>
|
|
Administrateur
|
|
<span class="badge"></span>
|
|
</a>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="panel panel-default">
|
|
<div class="panel-heading">
|
|
<i class="fa fa-filter"></i>
|
|
Afficher par Groupes
|
|
</div>
|
|
|
|
<div class="panel-body">
|
|
<div id="group-filter" class="list-group">
|
|
<a href="#" class="active list-group-item filterfgall">
|
|
<i class="fa fa-users"></i>
|
|
Tout les groupes
|
|
<span class="badge">{{ alerts|length }}</span>
|
|
</a>
|
|
|
|
{% for group in groups %}
|
|
<a class="list-group-item" href="#" data-role="{{ group.id }}">
|
|
<i class="fa fa-user"></i>
|
|
{{ group.label }}
|
|
<span class="badge">{{ group.alerts|length }}</span>
|
|
</a>
|
|
{% endfor %}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="panel panel-default">
|
|
<div class="panel-heading">
|
|
<i class="fa fa-filter"></i>
|
|
Afficher par statut
|
|
</div>
|
|
|
|
<div class="panel-body">
|
|
<div id="statut-filter" class="list-group">
|
|
<a class="list-group-item active filterfgall" data-statut="all" href="#">
|
|
<i class="fa fa-eye-slash"></i>
|
|
Toutes
|
|
</a>
|
|
|
|
<a class="list-group-item" data-statut="online" href="#">
|
|
<i class="fa fa-eye"></i>
|
|
En ligne
|
|
</a>
|
|
|
|
<a class="list-group-item" data-statut="pending" href="#">
|
|
<i class="fa fa-clock-o"></i>
|
|
En attente de publication
|
|
</a>
|
|
|
|
<a class="list-group-item" data-statut="archived" href="#">
|
|
<i class="fa fa-history"></i>
|
|
Archivées
|
|
</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{% endblock %}
|
|
|
|
{% block localjavascript %}
|
|
$( function() {
|
|
$("a[data-role='ROLE_ANONYME']").children("span").html($('.role-ROLE_ANONYME').length);
|
|
$("a[data-role='ROLE_USER']").children("span").html($('.role-ROLE_USER').length);
|
|
$("a[data-role='ROLE_ANIM']").children("span").html($('.role-ROLE_ANIM').length);
|
|
$("a[data-role='ROLE_MODO']").children("span").html($('.role-ROLE_MODO').length);
|
|
$("a[data-role='ROLE_ADMIN']").children("span").html($('.role-ROLE_ADMIN').length);
|
|
|
|
function updateItems() {
|
|
$('.list-item').each(function(i) {
|
|
var itemid = $(this).data('alert-id');
|
|
$(this).find('input[name="alert_item[rowOrder][]"]').val(i);
|
|
|
|
// Mise à jour en base de l'order
|
|
$.ajax({
|
|
method: "POST",
|
|
url: "{{ path('cadoles_portal_config_alert_order') }}",
|
|
data: {
|
|
id:itemid,
|
|
order:i
|
|
}
|
|
});
|
|
|
|
});
|
|
}
|
|
|
|
$( "#list" ).sortable({
|
|
axis: "y",
|
|
placeholder: "list-item placeholder",
|
|
update: updateItems
|
|
});
|
|
|
|
$("#category-filter a.category-alert-item").click(function(){
|
|
// On réactive les auters filtres à tout
|
|
$('#role-filter a').removeClass('active');
|
|
$('#group-filter a').removeClass('active');
|
|
$('#statut-filter a').removeClass('active');
|
|
$(".filterfgall").addClass('active');
|
|
$(this).toggleClass('active');
|
|
|
|
$('.category-alert-item').each(function(i) {
|
|
var $alerts = $('.alertcategory-'+$(this).data('category'));
|
|
if($(this).hasClass('active')){
|
|
$alerts.show();
|
|
} else {
|
|
$alerts.hide();
|
|
}
|
|
});
|
|
|
|
return false;
|
|
});
|
|
|
|
$('#role-filter a').click(function(){
|
|
// On réactive les auters filtres à tout
|
|
$(".category-alert-item").addClass('active');
|
|
$('#group-filter a').removeClass('active');
|
|
$('#statut-filter a').removeClass('active');
|
|
$(".filterfgall").addClass('active');
|
|
|
|
// On rend actif la zone cliquée
|
|
$('#role-filter a').removeClass('active');
|
|
$(this).addClass('active');
|
|
|
|
// On cache l'ensemble des elements
|
|
$(".list-item").hide();
|
|
|
|
// On affiche les elements filtrés
|
|
if($(this).hasClass('filterfgall'))
|
|
var $alerts = $('.list-item');
|
|
else
|
|
var $alerts = $('.role-'+$(this).data('role'));
|
|
|
|
$alerts.show();
|
|
|
|
return false;
|
|
});
|
|
|
|
$('#group-filter a').click(function(){
|
|
// On réactive les auters filtres à tout
|
|
$(".category-alert-item").addClass('active');
|
|
$('#role-filter a').removeClass('active');
|
|
$('#statut-filter a').removeClass('active');
|
|
$(".filterfgall").addClass('active');
|
|
|
|
// On rend actif la zone cliquée
|
|
$('#group-filter a').removeClass('active');
|
|
$(this).addClass('active');
|
|
|
|
// On cache l'ensemble des elements
|
|
$(".list-item").hide();
|
|
|
|
// On affiche les elements filtrés
|
|
if($(this).hasClass('filterfgall'))
|
|
var $alerts = $('.list-item');
|
|
else
|
|
var $alerts = $('.group-'+$(this).data('role'));
|
|
|
|
$alerts.show();
|
|
|
|
return false;
|
|
});
|
|
|
|
$("#statut-filter a").click(function(){
|
|
// On réactive les auters filtres à tout
|
|
$(".category-alert-item").addClass('active');
|
|
$('#group-filter a').removeClass('active');
|
|
$("#group-filter .filterfgall").addClass('active');
|
|
|
|
// On rend actif la zone cliquée
|
|
$('#statut-filter a').removeClass('active');
|
|
$(this).addClass('active');
|
|
|
|
// On cache l'ensemble des elements
|
|
$(".list-item").hide();
|
|
|
|
// On affiche les elements filtrés
|
|
if($(this).hasClass('filterfgall'))
|
|
var $alerts = $('.list-item');
|
|
else
|
|
var $alerts = $('.alertstatut-'+$(this).data('statut'));
|
|
|
|
$alerts.show();
|
|
return false;
|
|
});
|
|
|
|
} );
|
|
{% endblock %}
|
|
|
|
|