diff --git a/src/agenda_culturel/static/style.scss b/src/agenda_culturel/static/style.scss
index 19b5ba3..f189cef 100644
--- a/src/agenda_culturel/static/style.scss
+++ b/src/agenda_culturel/static/style.scss
@@ -1820,4 +1820,16 @@ dialog {
height: 1.3em;
vertical-align: middle;
margin-bottom: .2em;
-}
\ No newline at end of file
+}
+
+.status_trash header, .status_trash footer,
+.status_draft header, .status_draft footer {
+ background: repeating-linear-gradient(
+ 45deg,
+ rgba(80, 80, 80, 0.1),
+ rgba(80, 80, 80, 0.1) 10px,
+ rgba(80, 80, 80, 0.25) 10px,
+ rgba(80, 80, 80, 0.25) 20px
+ ),
+
+}
diff --git a/src/agenda_culturel/templates/agenda_culturel/administration.html b/src/agenda_culturel/templates/agenda_culturel/administration.html
index 795c496..ab9325b 100644
--- a/src/agenda_culturel/templates/agenda_culturel/administration.html
+++ b/src/agenda_culturel/templates/agenda_culturel/administration.html
@@ -86,7 +86,7 @@
Derniers événements soumis
{% for e in events %}
- {% include "agenda_culturel/single-event/event-in-flat-list-inc.html" with event=e %}
+ {% include "agenda_culturel/single-event/event-in-flat-list-inc.html" with event=e %}
{% endfor %}
diff --git a/src/agenda_culturel/templates/agenda_culturel/edit-buttons-inc.html b/src/agenda_culturel/templates/agenda_culturel/edit-buttons-inc.html
index be737e6..fc15cad 100644
--- a/src/agenda_culturel/templates/agenda_culturel/edit-buttons-inc.html
+++ b/src/agenda_culturel/templates/agenda_culturel/edit-buttons-inc.html
@@ -2,38 +2,36 @@
{% load utils_extra %}
{% if event.moderated_date %}
-Modérer de nouveau {% picto_from_name "check-square" %}
+modérer de nouveau {% picto_from_name "check-square" %}
{% else %}
-Modérer {% picto_from_name "check-square" %}
+modérer {% picto_from_name "check-square" %}
{% endif %}
{% if event.pure_import %}
{% with event.get_local_version as local %}
{% if local %}
- voir la version locale {% picto_from_name "eye" %}
+ Voir la version locale {% picto_from_name "eye" %}
{% else %}
- modifier {% picto_from_name "edit-3" %}
+ modifier & modérer {% picto_from_name "edit-3" %}
{% endif %}
{% endwith %}
{% else %}
-modifier {% picto_from_name "edit-3" %}
+modifier & modérer {% picto_from_name "edit-3" %}
{% endif %}
{% if event.is_updateable %}
-Réimporter {% picto_from_name "download-cloud" %}
+réimporter {% picto_from_name "download-cloud" %}
{% endif %}
-{% if event.status != "published" %}
+{% if event.status == "draft" and details == 1 %}
publier {% picto_from_name "eye" %}
{% endif %}
-{% if event.status == "published" %}
-dépublier {% picto_from_name "eye-off" %}
-{% elif event.status == "trash" %}
-restaurer {% picto_from_name "eye-off" %}
-{% endif %}
-
-{% if event.status != "trash" %}
+{% if event.status == "trash" %}
+ {% if details == 1 %}
+ restaurer {% picto_from_name "eye-off" %}
+ {% endif %}
+{% else %}
supprimer {% picto_from_name "trash-2" %}
{% endif %}
@@ -41,6 +39,6 @@
supprimer définitivement {% picto_from_name "x-circle" %}
{% endif %}
-{% if with_clone %}
-Dupliquer {% picto_from_name "copy" %}
+{% if details == 1 %}
+dupliquer {% picto_from_name "copy" %}
{% endif %}
diff --git a/src/agenda_culturel/templates/agenda_culturel/recent.html b/src/agenda_culturel/templates/agenda_culturel/recent.html
index fe0001a..5ef791c 100644
--- a/src/agenda_culturel/templates/agenda_culturel/recent.html
+++ b/src/agenda_culturel/templates/agenda_culturel/recent.html
@@ -40,7 +40,7 @@
{% for obj in paginator_filter %}
-
{% include "agenda_culturel/single-event/event-in-flat-list-inc.html" with event=obj %}
+ {% include "agenda_culturel/single-event/event-in-flat-list-inc.html" with event=obj %}
{% endfor %}
diff --git a/src/agenda_culturel/templates/agenda_culturel/search.html b/src/agenda_culturel/templates/agenda_culturel/search.html
index aa3c6dd..9d4bbb6 100644
--- a/src/agenda_culturel/templates/agenda_culturel/search.html
+++ b/src/agenda_culturel/templates/agenda_culturel/search.html
@@ -102,10 +102,8 @@
{{ paginator_filter.paginator.count }} événement{{paginator_filter.object_list.count | pluralize }} correspond{{paginator_filter.object_list.count | pluralize:"ent" }} à la recherche.
- {% for obj in paginator_filter %}
-
+ {% for obj in paginator_filter %}
{% include "agenda_culturel/single-event/event-in-flat-list-inc.html" with event=obj %}
-
{% endfor %}
diff --git a/src/agenda_culturel/templates/agenda_culturel/single-event/event-elegant-inc.html b/src/agenda_culturel/templates/agenda_culturel/single-event/event-elegant-inc.html
index 057e2c8..5fb95b4 100644
--- a/src/agenda_culturel/templates/agenda_culturel/single-event/event-elegant-inc.html
+++ b/src/agenda_culturel/templates/agenda_culturel/single-event/event-elegant-inc.html
@@ -90,7 +90,7 @@
{% if perms.agenda_culturel.change_event %}
- {% include "agenda_culturel/edit-buttons-inc.html" with event=event %}
+ {% include "agenda_culturel/edit-buttons-inc.html" with event=event details=0 %}
{% endif %}
diff --git a/src/agenda_culturel/templates/agenda_culturel/single-event/event-in-flat-list-inc.html b/src/agenda_culturel/templates/agenda_culturel/single-event/event-in-flat-list-inc.html
index 3b51df0..890b4b9 100644
--- a/src/agenda_culturel/templates/agenda_culturel/single-event/event-in-flat-list-inc.html
+++ b/src/agenda_culturel/templates/agenda_culturel/single-event/event-in-flat-list-inc.html
@@ -3,71 +3,73 @@
{% load tag_extra %}
{% load event_extra %}
-
- {% picto_from_name "calendar" %}
- {% if event.end_day and event.end_day != event.start_day %}du{% else %}le{% endif %}
- {{ event.start_day|date|frdate }}
- {% if event.start_time %} {% if not event.end_day or event.end_day == event.start_day %}{% if event.end_time %}de{% else %}à{% endif %}{% endif %}
- {{ event.start_time }}
- {% endif %}
- {% if event.end_day and event.end_day != event.start_day %}
- au {% if event.end_day and event.end_day != event.start_day %}{{ event.end_day|date|frdate }}{% endif %}
- {% endif %}
- {% if event.end_time %} {% if not event.end_day|date|frdate or event.end_day == event.start_day %}jusqu'à{% endif %} {{ event.end_time }}{% endif %}
-
- {% if not no_location %}
- {% if event.location or event.exact_location %}
- {% picto_from_name "map-pin" %}
-
- {% if event.exact_location %}
- {{ event.exact_location.name }}, {{ event.exact_location.city }}
- {% else %}
- {% if perms.agenda_culturel.change_event and perms.agenda_culturel.change_place %}
- {{ event.location }}
- {% else %}
- {{ event.location }}
- {% endif %}
- {% endif %}
-
+
+
+ {% picto_from_name "calendar" %}
+ {% if event.end_day and event.end_day != event.start_day %}du{% else %}le{% endif %}
+ {{ event.start_day|date|frdate }}
+ {% if event.start_time %} {% if not event.end_day or event.end_day == event.start_day %}{% if event.end_time %}de{% else %}à{% endif %}{% endif %}
+ {{ event.start_time }}
{% endif %}
- {% endif %}
-
-
- {% if event.has_recurrences %}
+ {% if event.end_day and event.end_day != event.start_day %}
+ au {% if event.end_day and event.end_day != event.start_day %}{{ event.end_day|date|frdate }}{% endif %}
+ {% endif %}
+ {% if event.end_time %} {% if not event.end_day|date|frdate or event.end_day == event.start_day %}jusqu'à{% endif %} {{ event.end_time }}{% endif %}
- {% picto_from_name "repeat" %}
-
- {% for r in event.recurrences.rrules %}
- {{ r.to_text }}{% if not forloop.first %}, {% endif %}{% endfor %}, depuis le
- {% if event.recurrences.dtstart.date %}
- {{ event.recurrences.dtstart.date }}
- {% else %}
- {{ event.start_day }}
- {% endif %}
-
- {% endif %}
- {% if event.tags %}
-
- {% picto_from_name "tag" %}
- {% for tag in event.sorted_tags %}
- {{ tag|tw_highlight }}
- {% if not forloop.last %}, {% endif %}
- {% endfor %}
-
- {% endif %}
-
- {% if event.description_hl %}{{ event.description_hl | safe }} [...]{% else %}{% if event.description %}{{ event.description |truncatewords:60 }}{% else %}pas de description {% endif %}{% endif %}
+ {% if not no_location %}
+ {% if event.location or event.exact_location %}
+ {% picto_from_name "map-pin" %}
-
- {% if perms.agenda_culturel.change_event %}
-
- {% endif %}
+ {% if event.exact_location %}
+ {{ event.exact_location.name }}, {{ event.exact_location.city }}
+ {% else %}
+ {% if perms.agenda_culturel.change_event and perms.agenda_culturel.change_place %}
+ {{ event.location }}
+ {% else %}
+ {{ event.location }}
+ {% endif %}
+ {% endif %}
+
+ {% endif %}
+ {% endif %}
+
+
+ {% if event.has_recurrences %}
+
+ {% picto_from_name "repeat" %}
+
+ {% for r in event.recurrences.rrules %}
+ {{ r.to_text }}{% if not forloop.first %}, {% endif %}{% endfor %}, depuis le
+ {% if event.recurrences.dtstart.date %}
+ {{ event.recurrences.dtstart.date }}
+ {% else %}
+ {{ event.start_day }}
+ {% endif %}
+
+ {% endif %}
+ {% if event.tags %}
+
+ {% picto_from_name "tag" %}
+ {% for tag in event.sorted_tags %}
+ {{ tag|tw_highlight }}
+ {% if not forloop.last %}, {% endif %}
+ {% endfor %}
+
+ {% endif %}
+
+ {% if event.description_hl %}{{ event.description_hl | safe }} [...]{% else %}{% if event.description %}{{ event.description |truncatewords:60 }}{% else %}pas de description {% endif %}{% endif %}
+
+
+ {% if perms.agenda_culturel.change_event %}
+
+ {% endif %}
+
\ No newline at end of file
diff --git a/src/agenda_culturel/templates/agenda_culturel/single-event/event-single-inc.html b/src/agenda_culturel/templates/agenda_culturel/single-event/event-single-inc.html
index 8c3480a..30a886c 100644
--- a/src/agenda_culturel/templates/agenda_culturel/single-event/event-single-inc.html
+++ b/src/agenda_culturel/templates/agenda_culturel/single-event/event-single-inc.html
@@ -159,9 +159,9 @@
{% endif %}
{% else %}
- Exporter ical {% picto_from_name "calendar" %}
+ exporter ical {% picto_from_name "calendar" %}
{% if perms.agenda_culturel.change_event and not noedit %}
- {% include "agenda_culturel/edit-buttons-inc.html" with event=event with_clone=1 %}
+ {% include "agenda_culturel/edit-buttons-inc.html" with event=event details=1 %}
{% endif %}
{% endif %}
diff --git a/src/agenda_culturel/views.py b/src/agenda_culturel/views.py
index 409ab12..cfd90f8 100644
--- a/src/agenda_culturel/views.py
+++ b/src/agenda_culturel/views.py
@@ -327,6 +327,11 @@ class EventUpdateView(
txt = _(" A message has been sent to the person who proposed the event.") if hasattr(self, "with_msg") and self.with_msg else ""
return mark_safe(_('The event has been successfully modified.') + txt)
+ def get_object(self, queryset=None):
+ event = super().get_object(queryset)
+ if event.status == Event.STATUS.DRAFT:
+ event.status = Event.STATUS.PUBLISHED
+ return event
def form_valid(self, form):
form.instance.set_processing_user(self.request.user)
@@ -420,9 +425,12 @@ class EventModerateView(
def get_object(self, queryset=None):
if self.is_starting_moderation():
now = datetime.now()
- return EventModerateView.get_next_event(now.date(), now.time())
+ event = EventModerateView.get_next_event(now.date(), now.time())
else:
- return super().get_object(queryset)
+ event = super().get_object(queryset)
+ if event.status == Event.STATUS.DRAFT:
+ event.status = Event.STATUS.PUBLISHED
+ return event
def post(self, request, *args, **kwargs):
try:
@@ -550,7 +558,12 @@ def change_status_event(request, pk, status):
if request.method == "POST":
event.status = Event.STATUS(status)
- event.save(update_fields=["status"])
+ fields = ["status"]
+ if event.status == Event.STATUS.PUBLISHED:
+ event.set_in_moderation_process()
+ event.update_modification_dates()
+ fields += ["moderated_date", "moderated_by_user"]
+ event.save(update_fields=fields)
with_msg = event.notify_if_required(request)
if with_msg:
messages.success(request, _("The status has been successfully modified and a message has been sent to the person who proposed the event."))