update form

This commit is contained in:
bastien ollier
2024-06-07 15:54:49 +02:00
parent 541ec566d1
commit b7a750604a
20 changed files with 582 additions and 57 deletions

View File

@@ -0,0 +1,4 @@
<form method="post" action="{{ path('app_species_delete', {'id': species.id}) }}" onsubmit="return confirm('Are you sure you want to delete this item?');">
<input type="hidden" name="_token" value="{{ csrf_token('delete' ~ species.id) }}">
<button class="btn">Delete</button>
</form>

View File

@@ -0,0 +1,4 @@
{{ form_start(form) }}
{{ form_widget(form) }}
<button class="btn">{{ button_label|default('Save') }}</button>
{{ form_end(form) }}

View File

@@ -0,0 +1,13 @@
{% extends 'base.html.twig' %}
{% block title %}Edit Species{% endblock %}
{% block body %}
<h1>Edit Species</h1>
{{ include('species/_form.html.twig', {'button_label': 'Update'}) }}
<a href="{{ path('app_species_index') }}">back to list</a>
{{ include('species/_delete_form.html.twig') }}
{% endblock %}

View File

@@ -0,0 +1,39 @@
{% extends 'base.html.twig' %}
{% block title %}Species index{% endblock %}
{% block body %}
<h1>Species index</h1>
<table class="table">
<thead>
<tr>
<th>Id</th>
<th>Scientific_name</th>
<th>Vernacular_name</th>
<th>Region</th>
<th>actions</th>
</tr>
</thead>
<tbody>
{% for species in species %}
<tr>
<td>{{ species.id }}</td>
<td>{{ species.scientificName }}</td>
<td>{{ species.vernacularName }}</td>
<td>{{ species.region }}</td>
<td>
<a href="{{ path('app_species_show', {'id': species.id}) }}">show</a>
<a href="{{ path('app_species_edit', {'id': species.id}) }}">edit</a>
</td>
</tr>
{% else %}
<tr>
<td colspan="5">no records found</td>
</tr>
{% endfor %}
</tbody>
</table>
<a href="{{ path('app_species_new') }}">Create new</a>
{% endblock %}

View File

@@ -0,0 +1,11 @@
{% extends 'base.html.twig' %}
{% block title %}New Species{% endblock %}
{% block body %}
<h1>Create new Species</h1>
{{ include('species/_form.html.twig') }}
<a href="{{ path('app_species_index') }}">back to list</a>
{% endblock %}

View File

@@ -0,0 +1,34 @@
{% extends 'base.html.twig' %}
{% block title %}Species{% endblock %}
{% block body %}
<h1>Species</h1>
<table class="table">
<tbody>
<tr>
<th>Id</th>
<td>{{ species.id }}</td>
</tr>
<tr>
<th>Scientific_name</th>
<td>{{ species.scientificName }}</td>
</tr>
<tr>
<th>Vernacular_name</th>
<td>{{ species.vernacularName }}</td>
</tr>
<tr>
<th>Region</th>
<td>{{ species.region }}</td>
</tr>
</tbody>
</table>
<a href="{{ path('app_species_index') }}">back to list</a>
<a href="{{ path('app_species_edit', {'id': species.id}) }}">edit</a>
{{ include('species/_delete_form.html.twig') }}
{% endblock %}

View File

@@ -1,3 +0,0 @@
{{ form_start(form, {'attr': {'novalidate': 'novalidate'}}) }}
{{ form_widget(form) }}
{{ form_end(form) }}