ajout des messages d'information
This commit is contained in:
parent
165a3d3156
commit
7587c7605b
@ -223,4 +223,16 @@ msgid "Illustration (local image)"
|
|||||||
msgstr "Illustration (image locale)"
|
msgstr "Illustration (image locale)"
|
||||||
|
|
||||||
msgid "Illustration image stored in the agenda server"
|
msgid "Illustration image stored in the agenda server"
|
||||||
msgstr "Image d'illustration stockée sur le serveur de l'agenda"
|
msgstr "Image d'illustration stockée sur le serveur de l'agenda"
|
||||||
|
|
||||||
|
msgid "The event has been successfully modified."
|
||||||
|
msgstr "L'événement a été modifié avec succès."
|
||||||
|
|
||||||
|
msgid "The event has been successfully deleted."
|
||||||
|
msgstr "L'événement a été supprimé avec succès"
|
||||||
|
|
||||||
|
msgid "The URL has been submitted and the associated event will be integrated in the agenda after validation."
|
||||||
|
msgstr "L'adresse a été soumise et l'événement associé sera prochainement intégré à l'agenda après validation."
|
||||||
|
|
||||||
|
msgid "The static content has been successfully updated."
|
||||||
|
msgstr "Le contenu statique a été modifié avec succès."
|
@ -335,4 +335,53 @@ article#filters {
|
|||||||
display: inline-block;
|
display: inline-block;
|
||||||
margin-right: 2em;
|
margin-right: 2em;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Basic picocss alerts */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// import some colors from pico _colors.scss
|
||||||
|
$amber-50: #fff8e1 !default;
|
||||||
|
$amber-900: #ff6f00 !default;
|
||||||
|
$green-50: #e8f5e9 !default;
|
||||||
|
$green-800: #1b5e20 !default;
|
||||||
|
$red-50: #ffebee !default;
|
||||||
|
$red-900: #b71c1c !default;
|
||||||
|
|
||||||
|
|
||||||
|
// simple picocss alerts
|
||||||
|
// inherit responsive typography, responsive spacing, icons and size
|
||||||
|
.message {
|
||||||
|
$iconsize: calc(var(--font-size) * 1.5); // 24px / 30px if $enable-responsive-spacings
|
||||||
|
margin-bottom: var(--spacing); // some default space below alert element
|
||||||
|
padding: var(--form-element-spacing-vertical) var(--form-element-spacing-horizontal); // same as forms .input
|
||||||
|
border-radius: var(--border-radius);
|
||||||
|
//font-weight: 500; // var(--font-weight);
|
||||||
|
//font-size: 1rem;
|
||||||
|
//line-height: var(--line-height);
|
||||||
|
color: var(--color);
|
||||||
|
background-color: var(--background-color);
|
||||||
|
border: 1px solid var(--background-color); // compensate for 1px border
|
||||||
|
|
||||||
|
// icon
|
||||||
|
background-image: var(--icon);
|
||||||
|
background-position: center left var(--form-element-spacing-vertical); // use vertical for icon left align
|
||||||
|
background-size: $iconsize auto;
|
||||||
|
padding-left: calc(var(--form-element-spacing-vertical) * 2 + #{$iconsize});
|
||||||
|
}
|
||||||
|
.message.danger {
|
||||||
|
--background-color: #{$red-50};
|
||||||
|
--icon: var(--icon-invalid);
|
||||||
|
--color: #{$red-900};
|
||||||
|
}
|
||||||
|
.message.warning {
|
||||||
|
--background-color: #{$amber-50};
|
||||||
|
--icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='#{rgba(darken($amber-900, 15%), .999)}' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'%3E%3C/circle%3E%3Cline x1='12' y1='8' x2='12' y2='12'%3E%3C/line%3E%3Cline x1='12' y1='16' x2='12.01' y2='16'%3E%3C/line%3E%3C/svg%3E");
|
||||||
|
--color: #{darken($amber-900, 20%)};
|
||||||
|
}
|
||||||
|
.message.success {
|
||||||
|
--background-color: #{$green-50};
|
||||||
|
--icon: var(--icon-valid);
|
||||||
|
--color: #{$green-800};
|
||||||
}
|
}
|
@ -67,6 +67,12 @@
|
|||||||
</ul>
|
</ul>
|
||||||
</nav>
|
</nav>
|
||||||
<main class="container{% block main-fluid %}{% endblock %}">
|
<main class="container{% block main-fluid %}{% endblock %}">
|
||||||
|
{% if messages %}
|
||||||
|
{% for message in messages %}
|
||||||
|
<p {% if message.tags %} class="message {{ message.tags }} " {% endif %}> {{ message }}</p>
|
||||||
|
{% endfor %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
{% block content %}{% endblock %}
|
{% block content %}{% endblock %}
|
||||||
</main>
|
</main>
|
||||||
|
|
||||||
|
@ -24,6 +24,9 @@ import django_filters
|
|||||||
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
|
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
|
||||||
from django.contrib.auth.decorators import login_required
|
from django.contrib.auth.decorators import login_required
|
||||||
|
|
||||||
|
from django.contrib import messages
|
||||||
|
from django.contrib.messages.views import SuccessMessageMixin
|
||||||
|
|
||||||
import unicodedata
|
import unicodedata
|
||||||
|
|
||||||
|
|
||||||
@ -318,10 +321,11 @@ class StaticContentCreateView(LoginRequiredMixin, CreateView):
|
|||||||
form.instance.url_path = self.request.GET["url_path"]
|
form.instance.url_path = self.request.GET["url_path"]
|
||||||
return super().form_valid(form)
|
return super().form_valid(form)
|
||||||
|
|
||||||
class StaticContentUpdateView(LoginRequiredMixin, UpdateView):
|
|
||||||
|
class StaticContentUpdateView(SuccessMessageMixin, LoginRequiredMixin, UpdateView):
|
||||||
model = StaticContent
|
model = StaticContent
|
||||||
fields = ['text']
|
fields = ['text']
|
||||||
|
success_message = _('The static content has been successfully updated.')
|
||||||
|
|
||||||
|
|
||||||
class EventForm(forms.ModelForm):
|
class EventForm(forms.ModelForm):
|
||||||
@ -344,14 +348,17 @@ class EventCreateView(CreateView):
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
class EventUpdateView(LoginRequiredMixin, UpdateView):
|
class EventUpdateView(SuccessMessageMixin, LoginRequiredMixin, UpdateView):
|
||||||
model = Event
|
model = Event
|
||||||
form_class = EventForm
|
form_class = EventForm
|
||||||
|
success_message = _('The event has been successfully modified.')
|
||||||
|
|
||||||
|
|
||||||
class EventDeleteView(LoginRequiredMixin, DeleteView):
|
|
||||||
|
class EventDeleteView(SuccessMessageMixin, LoginRequiredMixin, DeleteView):
|
||||||
model = Event
|
model = Event
|
||||||
success_url = reverse_lazy('view_all_events')
|
success_url = reverse_lazy('view_all_events')
|
||||||
|
success_message = _('The event has been successfully deleted.')
|
||||||
|
|
||||||
|
|
||||||
class EventDetailView(DetailView):
|
class EventDetailView(DetailView):
|
||||||
@ -377,6 +384,7 @@ class EventSubmissionFormView(FormView):
|
|||||||
|
|
||||||
def create_event(self, valid_data):
|
def create_event(self, valid_data):
|
||||||
url = valid_data["url"]
|
url = valid_data["url"]
|
||||||
|
messages.success(self.request, _("The URL has been submitted and the associated event will be integrated in the agenda after validation."))
|
||||||
create_event_from_submission.delay(url)
|
create_event_from_submission.delay(url)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user