on traduit les boutons d'ajout

This commit is contained in:
Jean-Marie Favreau 2024-01-03 10:44:43 +01:00
parent 0c5dea8e18
commit a6f9b55c68
4 changed files with 60 additions and 4 deletions

View File

@ -1,6 +1,6 @@
from django.forms import ModelForm, ValidationError, TextInput, Form, URLField, MultipleHiddenInput, Textarea, CharField
from datetime import date
from django_better_admin_arrayfield.forms.widgets import DynamicArrayWidget
from .models import Event, BatchImportation
from django.utils.translation import gettext_lazy as _
@ -9,6 +9,12 @@ class EventSubmissionForm(Form):
url = URLField(max_length=512)
class DynamicArrayWidgetURLs(DynamicArrayWidget):
template_name = "agenda_culturel/widgets/widget-urls.html"
class DynamicArrayWidgetTags(DynamicArrayWidget):
template_name = "agenda_culturel/widgets/widget-tags.html"
class EventForm(ModelForm):
class Meta:
@ -21,6 +27,8 @@ class EventForm(ModelForm):
'end_time': TextInput(attrs={'type': 'time'}),
'uuids': MultipleHiddenInput(),
'import_sources': MultipleHiddenInput(),
'reference_urls': DynamicArrayWidgetURLs(),
'tags': DynamicArrayWidgetTags(),
}
@ -77,3 +85,5 @@ class BatchImportationForm(ModelForm):
# Always return a value to use as the new cleaned data, even if
# this method didn't change it.
return cleaned_data

View File

@ -6,12 +6,14 @@
<a href="{% url 'change_status_event' event.id 'published' %}" role="button">publier {% picto_from_name "eye" %}</a>
{% endif %}
{% if event.status != "draft" %}
<a href="{% url 'change_status_event' event.id 'draft' %}" role="button">brouillon {% picto_from_name "eye-off" %}</a>
{% if event.status == "published" %}
<a href="{% url 'change_status_event' event.id 'draft' %}" role="button">dépublier {% picto_from_name "eye-off" %}</a>
{% elif event.status == "trash" %}
<a href="{% url 'change_status_event' event.id 'draft' %}" role="button">restaurer {% picto_from_name "eye-off" %}</a>
{% endif %}
{% if event.status != "trash" %}
<a href="{% url 'change_status_event' event.id 'trash' %}" role="button">corbeille {% picto_from_name "trash-2" %}</a>
<a href="{% url 'change_status_event' event.id 'trash' %}" role="button">supprimer {% picto_from_name "trash-2" %}</a>
{% endif %}
{% if event.status == "trash" %}

View File

@ -0,0 +1,22 @@
{% load static %}
{% load i18n %}
{% spaceless %}
<div class="related-widget-wrapper">
<div class="dynamic-array-widget">
<ul>
{% for subwidget in widget.subwidgets %}
<li class="array-item" {% if widget.is_none %}data-isNone="true" style="display: none"{% endif %}>
{% with widget=subwidget %}
{% include widget.template_name %}
{% endwith %}
<div class="remove">
<div class="inline-deletelink"></div>
</div>
</li>
{% endfor %}
</ul>
<div><input type="button" class="add-array-item" value="Ajouter une autre étiquette"></div>
</div>
</div>
{% endspaceless %}

View File

@ -0,0 +1,22 @@
{% load static %}
{% load i18n %}
{% spaceless %}
<div class="related-widget-wrapper">
<div class="dynamic-array-widget">
<ul>
{% for subwidget in widget.subwidgets %}
<li class="array-item" {% if widget.is_none %}data-isNone="true" style="display: none"{% endif %}>
{% with widget=subwidget %}
{% include widget.template_name %}
{% endwith %}
<div class="remove">
<div class="inline-deletelink"></div>
</div>
</li>
{% endfor %}
</ul>
<div><input type="button" class="add-array-item" value="Ajouter une autre URL"></div>
</div>
</div>
{% endspaceless %}