improve CRUD and switch to symfony3

This commit is contained in:
2018-06-05 14:53:30 +02:00
parent a1ee85b0c0
commit eda8f2c033
11 changed files with 167 additions and 78 deletions

View File

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

View File

@@ -23,11 +23,26 @@
{% block personcontent %}
<h1>{{ 'Edit Document' | trans }}</h1>
{{ form_start(form) }}
{{ include('ChillDocStoreBundle:PersonDocument:_form.html.twig', {'button_label': 'Update'}) }}
<a href="{{ path('person_document_index', {'person': person.id}) }} " class="sc-button">
{{ 'Back to list' | trans }}
</a>
<ul class="record_actions">
<li class="cancel">
<a href="{{ path('person_document_index', {'person': person.id}) }}" class="sc-button bt-cancel">
{{ 'Back to the list' | trans }}
</a>
</li>
<li class="edit">
<button class="sc-button bt-edit">{{ 'Edit'|trans }}</button>
</li>
{% if is_granted('CHILL_PERSON_DOCUMENT_DELETE', document) %}
<li class="delete">
{{ include('ChillDocStoreBundle:PersonDocument:_delete_form.html.twig') }}
</li>
{% endif %}
</ul>
{{ form_end(form) }}
{{ include('ChillDocStoreBundle:PersonDocument:_delete_form.html.twig') }}
{% endblock %}

View File

@@ -28,10 +28,8 @@
<thead>
<tr>
<th>{{ 'Title' | trans }}</th>
<th>{{ 'Description' | trans }}</th>
<th>{{ 'Content' | trans }}</th>
<th>{{ 'Last modification by' | trans }}</th>
<th>{{ 'Last update' | trans }}</th>
<th>{{ 'Category'|trans }}</th>
<th>{{ 'Circle' | trans }}</th>
<th>{{ 'Actions' | trans }}</th>
</tr>
</thead>
@@ -39,28 +37,42 @@
{% for document in documents %}
<tr>
<td>{{ document.title }}</td>
<td>{{ document.description }}</td>
<td>{{ document.content }}</td>
<td>{{ document.user }}</td>
<td>{{ document.date ? document.date|date('Y-m-d H:i:s') : '' }}</td>
<td>{{ document.category.name|localize_translatable_string }}</td>
<td>{{ document.scope.name|localize_translatable_string }}</td>
<td>
<a href="{{ path('person_document_show', {'person': person.id, 'id': document.id}) }}" class="sc-button">
show
</a>
<a href="{{ path('person_document_edit', {'person': person.id, 'id': document.id}) }}" class="sc-button bt-edit">
edit
</a>
<ul class="record_actions">
{% if is_granted('CHILL_PERSON_DOCUMENT_SEE_DETAILS', document) %}
<li>
<a href="{{ path('person_document_show', {'person': person.id, 'id': document.id}) }}" class="sc-button">
{{ 'See'|trans }}
</a>
</li>
{% endif %}
{% if is_granted('CHILL_PERSON_DOCUMENT_UPDATE', document) %}
<li>
<a href="{{ path('person_document_edit', {'person': person.id, 'id': document.id}) }}" class="sc-button bt-edit">
{{ 'Edit'|trans }}
</a>
</li>
{% endif %}
</ul>
</td>
</tr>
{% else %}
<tr>
<td colspan="9">no records found</td>
<td colspan="9"><span class="chill-no-data-statement">{{ 'Any document found'|trans }}</span></td>
</tr>
{% endfor %}
</tbody>
</table>
<a href="{{ path('person_document_new', {'person': person.id}) }}" class="sc-button bt-create">
{{ 'Create new' | trans }}
</a>
{% if is_granted('CHILL_PERSON_DOCUMENT_CREATE', person) %}
<ul class="record_actions">
<li class="create">
<a href="{{ path('person_document_new', {'person': person.id}) }}" class="sc-button bt-create">
{{ 'Create new document' | trans }}
</a>
</li>
</ul>
{% endif %}
{% endblock %}

View File

@@ -23,9 +23,18 @@
{% block personcontent %}
<h1>{{ 'Create new Document' | trans }}</h1>
{{ form_start(form) }}
{{ include('ChillDocStoreBundle:PersonDocument:_form.html.twig') }}
<a href="{{ path('person_document_index', {'person': person.id}) }}" class="sc-button bt-create">
{{ 'back to list' | trans }}
</a>
<ul class="record_actions">
<li class="cancel">
<a href="{{ path('person_document_index', {'person': person.id}) }}" class="sc-button bt-cancel">
{{ 'Back to the list' | trans }}
</a>
</li>
<li class="create">
<button class="sc-button bt-create">{{ 'Create'|trans }}</button>
</li>
</ul>
{{ form_end(form) }}
{% endblock %}