scinder les annonces à publier en ligne archivées (fixes #32602)

This commit is contained in:
afornerot 2021-06-10 11:26:55 +02:00
parent 4399db9498
commit 9d40aa6575
2 changed files with 161 additions and 43 deletions

View File

@ -149,7 +149,7 @@ class Alert
{
$today = new \DateTime();
if (null === $this->unpublishedat) {
return true;
return false;
}
if ($this->unpublishedat->getTimestamp() < $today->getTimestamp()) {
return true;

View File

@ -12,49 +12,163 @@
<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>
<div id="listpending" class="panel panel-default">
<div class="panel-heading">
<h3 style="margin:0px">En Attente Publication</h2>
</div>
<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>
<div class="panel-body">
<div class="list panel-group">
{% for alert in alerts if alert.isPending %}
<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 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>
<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>
<div id="alert-{{ alert.id }}" class="panel-body panel-collapse collapse">
{{ alert.content|raw }}
</div>
<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>
<input type="hidden" name="alert_item[id][]" value="{{ alert.id }}" />
<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>
{% endfor %}
</div>
</div>
<div id="listonline" class="panel panel-default">
<div class="panel-heading">
<h3 style="margin:0px">En Ligne</h2>
</div>
<div class="panel-body">
<div id="listonline" class="list panel-group">
{% for alert in alerts if alert.isOnline %}
<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>
<div id="listarchived" class="panel panel-default">
<div class="panel-heading">
<h3 style="margin:0px">Archivées</h2>
</div>
<div class="panel-body">
<div id="listarchived" class="list panel-group">
{% for alert in alerts if alert.isArchived %}
<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>
</div>
@ -219,7 +333,11 @@
});
}
$( "#list" ).sortable({
if($(".alertstatut-pending").length==0) $("#listpending").hide();
if($(".alertstatut-online").length==0) $("#listonline").hide();
if($(".alertstatut-archived").length==0) $("#listarchived").hide();
$( ".list" ).sortable({
axis: "y",
placeholder: "list-item placeholder",
update: updateItems