#42: allow updates to menuitems
This commit is contained in:
parent
0068654885
commit
674adcba60
14 changed files with 258 additions and 7 deletions
|
@ -5,7 +5,14 @@
|
|||
<title>{% block title %}Welcome!{% endblock %}</title>
|
||||
<link rel="icon" type="image/svg+xml"
|
||||
href="{{ favicon }}" />
|
||||
<link rel="stylesheet" href="/static/css/new.min.css">
|
||||
{% set currentDate = "now"|date("d") %}
|
||||
{% if currentDate % 3 == 0 %}
|
||||
<link rel="stylesheet" href="/static/css/new.min.css">
|
||||
{% elseif currentDate % 3 == 1 %}
|
||||
<link rel="stylesheet" href="/static/css/simple.min.css">
|
||||
{% else %}
|
||||
<link rel="stylesheet" href="/static/css/water.min.css">
|
||||
{% endif %}
|
||||
<style>
|
||||
label{
|
||||
display: block;
|
||||
|
|
|
@ -16,9 +16,13 @@
|
|||
|
||||
<section>
|
||||
<h2>known menuitems</h2>
|
||||
{% for item in food_vendor.menuItems %}
|
||||
<code>{{ item.name }}</code>
|
||||
{% endfor %}
|
||||
<ul>
|
||||
{% for item in food_vendor.menuItems %}
|
||||
<li>
|
||||
<a href="{{ path('app_menu_item_show', {'id': item.id}) }}">{{ item.name }}</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
|
||||
</section>
|
||||
|
||||
|
|
4
templates/menu_item/_delete_form.html.twig
Normal file
4
templates/menu_item/_delete_form.html.twig
Normal file
|
@ -0,0 +1,4 @@
|
|||
<form method="post" action="{{ path('app_menu_item_delete', {'id': menu_item.id}) }}" onsubmit="return confirm('Are you sure you want to delete this item?');">
|
||||
<input type="hidden" name="_token" value="{{ csrf_token('delete' ~ menu_item.id) }}">
|
||||
<button class="btn">Delete</button>
|
||||
</form>
|
4
templates/menu_item/_form.html.twig
Normal file
4
templates/menu_item/_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) }}
|
11
templates/menu_item/edit.html.twig
Normal file
11
templates/menu_item/edit.html.twig
Normal file
|
@ -0,0 +1,11 @@
|
|||
{% extends 'base.html.twig' %}
|
||||
|
||||
{% block title %}Edit MenuItem{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
<h1>Edit MenuItem</h1>
|
||||
|
||||
{{ include('menu_item/_form.html.twig', {'button_label': 'Update'}) }}
|
||||
|
||||
{{ include('menu_item/_delete_form.html.twig') }}
|
||||
{% endblock %}
|
35
templates/menu_item/index.html.twig
Normal file
35
templates/menu_item/index.html.twig
Normal file
|
@ -0,0 +1,35 @@
|
|||
{% extends 'base.html.twig' %}
|
||||
|
||||
{% block title %}MenuItem index{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
<h1>MenuItem index</h1>
|
||||
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Id</th>
|
||||
<th>Name</th>
|
||||
<th>actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for menu_item in menu_items %}
|
||||
<tr>
|
||||
<td>{{ menu_item.id }}</td>
|
||||
<td>{{ menu_item.name }}</td>
|
||||
<td>
|
||||
<a href="{{ path('app_menu_item_show', {'id': menu_item.id}) }}">show</a>
|
||||
<a href="{{ path('app_menu_item_edit', {'id': menu_item.id}) }}">edit</a>
|
||||
</td>
|
||||
</tr>
|
||||
{% else %}
|
||||
<tr>
|
||||
<td colspan="3">no records found</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<a href="{{ path('app_menu_item_new') }}">Create new</a>
|
||||
{% endblock %}
|
11
templates/menu_item/new.html.twig
Normal file
11
templates/menu_item/new.html.twig
Normal file
|
@ -0,0 +1,11 @@
|
|||
{% extends 'base.html.twig' %}
|
||||
|
||||
{% block title %}New MenuItem{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
<h1>Create new MenuItem</h1>
|
||||
|
||||
{{ include('menu_item/_form.html.twig') }}
|
||||
|
||||
<a href="{{ path('app_menu_item_index') }}">back to list</a>
|
||||
{% endblock %}
|
26
templates/menu_item/show.html.twig
Normal file
26
templates/menu_item/show.html.twig
Normal file
|
@ -0,0 +1,26 @@
|
|||
{% extends 'base.html.twig' %}
|
||||
|
||||
{% block title %}MenuItem{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
<h1>MenuItem</h1>
|
||||
|
||||
<table class="table">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>Id</th>
|
||||
<td>{{ menu_item.id }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<td>{{ menu_item.name }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<a href="{{ path('app_food_vendor_show', { 'id': menu_item.foodVendor.id}) }}">back to list</a>
|
||||
|
||||
<a href="{{ path('app_menu_item_edit', {'id': menu_item.id}) }}">edit</a>
|
||||
|
||||
{{ include('menu_item/_delete_form.html.twig') }}
|
||||
{% endblock %}
|
Loading…
Add table
Add a link
Reference in a new issue