adding Beer entity, migration and crud
This commit is contained in:
5
app/templates/beer/_delete_form.html.twig
Normal file
5
app/templates/beer/_delete_form.html.twig
Normal file
@@ -0,0 +1,5 @@
|
||||
<form method="post" action="{{ path('beer_delete', {'id': beer.id}) }}" onsubmit="return confirm('Are you sure you want to delete this item?');">
|
||||
<input type="hidden" name="_method" value="DELETE">
|
||||
<input type="hidden" name="_token" value="{{ csrf_token('delete' ~ beer.id) }}">
|
||||
<button class="btn">Delete</button>
|
||||
</form>
|
4
app/templates/beer/_form.html.twig
Normal file
4
app/templates/beer/_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) }}
|
13
app/templates/beer/edit.html.twig
Normal file
13
app/templates/beer/edit.html.twig
Normal file
@@ -0,0 +1,13 @@
|
||||
{% extends 'base.html.twig' %}
|
||||
|
||||
{% block title %}Edit Beer{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
<h1>Edit Beer</h1>
|
||||
|
||||
{{ include('beer/_form.html.twig', {'button_label': 'Update'}) }}
|
||||
|
||||
<a href="{{ path('beer_index') }}">back to list</a>
|
||||
|
||||
{{ include('beer/_delete_form.html.twig') }}
|
||||
{% endblock %}
|
37
app/templates/beer/index.html.twig
Normal file
37
app/templates/beer/index.html.twig
Normal file
@@ -0,0 +1,37 @@
|
||||
{% extends 'base.html.twig' %}
|
||||
|
||||
{% block title %}Beer index{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
<h1>Beer index</h1>
|
||||
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Id</th>
|
||||
<th>Name</th>
|
||||
<th>Alcool</th>
|
||||
<th>actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for beer in beers %}
|
||||
<tr>
|
||||
<td>{{ beer.id }}</td>
|
||||
<td>{{ beer.name }}</td>
|
||||
<td>{{ beer.alcool }}</td>
|
||||
<td>
|
||||
<a href="{{ path('beer_show', {'id': beer.id}) }}">show</a>
|
||||
<a href="{{ path('beer_edit', {'id': beer.id}) }}">edit</a>
|
||||
</td>
|
||||
</tr>
|
||||
{% else %}
|
||||
<tr>
|
||||
<td colspan="4">no records found</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<a href="{{ path('beer_new') }}">Create new</a>
|
||||
{% endblock %}
|
11
app/templates/beer/new.html.twig
Normal file
11
app/templates/beer/new.html.twig
Normal file
@@ -0,0 +1,11 @@
|
||||
{% extends 'base.html.twig' %}
|
||||
|
||||
{% block title %}New Beer{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
<h1>Create new Beer</h1>
|
||||
|
||||
{{ include('beer/_form.html.twig') }}
|
||||
|
||||
<a href="{{ path('beer_index') }}">back to list</a>
|
||||
{% endblock %}
|
30
app/templates/beer/show.html.twig
Normal file
30
app/templates/beer/show.html.twig
Normal file
@@ -0,0 +1,30 @@
|
||||
{% extends 'base.html.twig' %}
|
||||
|
||||
{% block title %}Beer{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
<h1>Beer</h1>
|
||||
|
||||
<table class="table">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>Id</th>
|
||||
<td>{{ beer.id }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<td>{{ beer.name }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Alcool</th>
|
||||
<td>{{ beer.alcool }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<a href="{{ path('beer_index') }}">back to list</a>
|
||||
|
||||
<a href="{{ path('beer_edit', {'id': beer.id}) }}">edit</a>
|
||||
|
||||
{{ include('beer/_delete_form.html.twig') }}
|
||||
{% endblock %}
|
Reference in New Issue
Block a user