Add post and species forms
Squashed commit of the following: Author: Hugo PRADIER <Hugo.PRADIER2@etu.uca.fr> Author: bastien ollier <bastien.ollier@etu.uca.fr> Author: clfreville2 <clement.freville2@etu.uca.fr> Reviewed on #7
This commit is contained in:
4
templates/species/_delete_form.html.twig
Normal file
4
templates/species/_delete_form.html.twig
Normal 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>
|
4
templates/species/_form.html.twig
Normal file
4
templates/species/_form.html.twig
Normal file
@@ -0,0 +1,4 @@
|
||||
{{ form_start(form) }}
|
||||
{{ form_widget(form) }}
|
||||
<button class="btn">{{ button_label|default('Save') }}</button>
|
||||
{{ form_end(form) }}
|
@@ -1,43 +0,0 @@
|
||||
{% extends 'base.html.twig' %}
|
||||
|
||||
{% block title %}Herbarium - Détail de l'espèces{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
<style>
|
||||
.example-wrapper { margin: 1em auto; max-width: 800px; width: 95%; font: 18px/1.5 sans-serif; }
|
||||
.example-wrapper code { background: #F5F5F5; padding: 2px 6px; }
|
||||
</style>
|
||||
|
||||
<div class="example-wrapper">
|
||||
<h1>{{ specie.vernacularName }}</h1>
|
||||
<p>
|
||||
🔬 Nom Scientifique : {{ specie.scientificName }}<br/>
|
||||
📍 Region : {{ specie.region }}
|
||||
</p>
|
||||
<div>
|
||||
<h2>Posts :</h2>
|
||||
|
||||
{% for post in specie.posts %}
|
||||
<div>
|
||||
<dt>
|
||||
<h3>
|
||||
<a href="">
|
||||
📅 {{ post.publicationDate | date }}
|
||||
</a>
|
||||
</h3>
|
||||
</dt>
|
||||
<dd>
|
||||
📍 géolocalisation :<br/>
|
||||
- Longitude : {{ post.longitude }}<br/>
|
||||
- Latitude : {{ post.latitude }}<br/>
|
||||
- Altitude : {{ post.altitude }}<br/><br/>
|
||||
|
||||
💬 Commentaire :<br/>
|
||||
- {{ post.getCommentary }}
|
||||
</dd>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
{% endblock %}
|
13
templates/species/edit.html.twig
Normal file
13
templates/species/edit.html.twig
Normal 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 %}
|
@@ -1,6 +1,6 @@
|
||||
{% extends 'base.html.twig' %}
|
||||
|
||||
{% block title %}Herbarium - Espèces{% endblock %}
|
||||
{% block title %}Species{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
<style>
|
||||
@@ -14,16 +14,17 @@
|
||||
<dl>
|
||||
{% for specie in species %}
|
||||
<dt>
|
||||
<a href={{ url('app_species') ~ '/' ~ specie.getId }}>
|
||||
🌿 {{ specie.getVernacularName }}
|
||||
<a href={{ path('app_species_show', {'id': specie.id}) }}>
|
||||
🌿 {{ specie.vernacularName }}
|
||||
</a>
|
||||
</dt>
|
||||
<dd >
|
||||
🔬 Nom Scientifique : {{ specie.getScientificName }}<br/>
|
||||
📍 Region : {{ specie.getRegion }}
|
||||
🔬 Nom Scientifique : {{ specie.scientificName }}<br/>
|
||||
📍 Region : {{ specie.region }}
|
||||
</dd><br/>
|
||||
{% endfor %}
|
||||
</dl>
|
||||
|
||||
<a href="{{ path('app_species_new') }}">Create new</a>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
11
templates/species/new.html.twig
Normal file
11
templates/species/new.html.twig
Normal 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 %}
|
36
templates/species/show.html.twig
Normal file
36
templates/species/show.html.twig
Normal file
@@ -0,0 +1,36 @@
|
||||
{% extends 'base.html.twig' %}
|
||||
|
||||
{% block title %}Species{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
<h1>{{ species.vernacularName }}</h1>
|
||||
<p>
|
||||
🔬 Nom Scientifique : {{ species.scientificName }}<br/>
|
||||
📍 Region : {{ species.region }}
|
||||
</p>
|
||||
|
||||
<div>
|
||||
<h2>Posts :</h2>
|
||||
|
||||
{% for post in species.posts %}
|
||||
<div>
|
||||
<dt>
|
||||
<h3>{{ post.publicationDate | date }}</h3>
|
||||
</dt>
|
||||
<dl>
|
||||
<dt>📍Géolocalisation</dt>
|
||||
<dd>{{ post.longitude }} - {{ post.latitude }}</dd>
|
||||
|
||||
<dt>📍Commentaire</dt>
|
||||
<dd>{{ post.getCommentary }}</dd>
|
||||
</dl>
|
||||
</div>
|
||||
{% endfor %}
|
||||
|
||||
<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') }}
|
||||
</div>
|
||||
{% endblock %}
|
39
templates/species/table.html.twig
Normal file
39
templates/species/table.html.twig
Normal 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 %}
|
Reference in New Issue
Block a user