Improve edit buttons

Signed-off-by: Emmy D'Anello <emmy.danello@animath.fr>
This commit is contained in:
Emmy D'Anello 2024-03-31 21:36:09 +02:00
parent 37b86d4ea0
commit 9092cf1846
Signed by: ynerant
GPG Key ID: 3A75C55819C8CF85
4 changed files with 24 additions and 13 deletions

View File

@ -128,7 +128,7 @@ class ValidateParticipationForm(forms.Form):
class TournamentForm(forms.ModelForm):
class Meta:
model = Tournament
fields = '__all__'
exclude = ('notes_sheet_id', )
widgets = {
'date_start': forms.DateInput(attrs={'type': 'date'}, format='%Y-%m-%d'),
'date_end': forms.DateInput(attrs={'type': 'date'}, format='%Y-%m-%d'),

View File

@ -6,7 +6,16 @@
{% trans "any" as any %}
<div class="card bg-body shadow">
<div class="card-header text-center">
<h4>{{ passage }}</h4>
<h4>
{{ passage }}
{% if user.registration.is_admin or user.registration in passage.pool.tournament.organizers.all %}
<button class="btn btn-sm btn-secondary"
data-bs-toggle="modal" data-bs-target="#updatePassageModal">
<i class="fas fa-edit"></i>
{% trans "Update" %}
</button>
{% endif %}
</h4>
</div>
<div class="card-body">
<dl class="row">
@ -51,7 +60,6 @@
{% if my_note is not None %}
<button class="btn btn-info" data-bs-toggle="modal" data-bs-target="#{{ my_note.modal_name }}Modal">{% trans "Update notes" %}</button>
{% endif %}
<button class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#updatePassageModal">{% trans "Update" %}</button>
</div>
{% elif user.registration.participates %}
<div class="card-footer text-center">

View File

@ -5,7 +5,15 @@
{% block content %}
<div class="card bg-body shadow">
<div class="card-header text-center">
<h4>{{ pool }}</h4>
<h4>
{{ pool }}
{% if user.registration.is_admin or user.registration in pool.tournament.organizers.all %}
<button class="btn btn-sm btn-secondary" data-bs-toggle="modal" data-bs-target="#updatePoolModal">
<i class="fas fa-edit"></i>
{% trans "Update" %}
</button>
{% endif %}
</h4>
</div>
<div class="card-body">
<dl class="row">
@ -137,14 +145,6 @@
{% endif %}
</div>
</div>
{% if user.registration.is_volunteer %}
<div class="card-footer text-center">
<button class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#updatePoolModal">
<i class="fas fa-edit"></i>
{% trans "Update" %}
</button>
</div>
{% endif %}
</div>
<hr>

View File

@ -61,7 +61,10 @@
{% if user.registration.is_admin or user.registration in tournament.organizers.all %}
<div class="card-footer text-center">
<a href="{% url "participation:tournament_update" pk=tournament.pk %}"><button class="btn btn-secondary">{% trans "Edit tournament" %}</button></a>
<a class="btn btn-secondary" href="{% url "participation:tournament_update" pk=tournament.pk %}">
<i class="fas fa-edit"></i>
{% trans "Edit tournament" %}
</a>
</div>
{% endif %}
</div>