mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
layout and clean activity type CRUD
This commit is contained in:
parent
216d0c55be
commit
795c1a74ed
@ -101,11 +101,8 @@ class ActivityTypeController extends Controller
|
||||
throw $this->createNotFoundException('Unable to find ActivityType entity.');
|
||||
}
|
||||
|
||||
$deleteForm = $this->createDeleteForm($id);
|
||||
|
||||
return $this->render('ChillActivityBundle:ActivityType:show.html.twig', array(
|
||||
'entity' => $entity,
|
||||
'delete_form' => $deleteForm->createView(),
|
||||
));
|
||||
}
|
||||
|
||||
@ -124,12 +121,10 @@ class ActivityTypeController extends Controller
|
||||
}
|
||||
|
||||
$editForm = $this->createEditForm($entity);
|
||||
$deleteForm = $this->createDeleteForm($id);
|
||||
|
||||
return $this->render('ChillActivityBundle:ActivityType:edit.html.twig', array(
|
||||
'entity' => $entity,
|
||||
'edit_form' => $editForm->createView(),
|
||||
'delete_form' => $deleteForm->createView(),
|
||||
'edit_form' => $editForm->createView()
|
||||
));
|
||||
}
|
||||
|
||||
@ -164,8 +159,7 @@ class ActivityTypeController extends Controller
|
||||
if (!$entity) {
|
||||
throw $this->createNotFoundException('Unable to find ActivityType entity.');
|
||||
}
|
||||
|
||||
$deleteForm = $this->createDeleteForm($id);
|
||||
|
||||
$editForm = $this->createEditForm($entity);
|
||||
$editForm->handleRequest($request);
|
||||
|
||||
@ -178,47 +172,6 @@ class ActivityTypeController extends Controller
|
||||
return $this->render('ChillActivityBundle:ActivityType:edit.html.twig', array(
|
||||
'entity' => $entity,
|
||||
'edit_form' => $editForm->createView(),
|
||||
'delete_form' => $deleteForm->createView(),
|
||||
));
|
||||
}
|
||||
/**
|
||||
* Deletes a ActivityType entity.
|
||||
*
|
||||
*/
|
||||
public function deleteAction(Request $request, $id)
|
||||
{
|
||||
$form = $this->createDeleteForm($id);
|
||||
$form->handleRequest($request);
|
||||
|
||||
if ($form->isValid()) {
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
$entity = $em->getRepository('ChillActivityBundle:ActivityType')->find($id);
|
||||
|
||||
if (!$entity) {
|
||||
throw $this->createNotFoundException('Unable to find ActivityType entity.');
|
||||
}
|
||||
|
||||
$em->remove($entity);
|
||||
$em->flush();
|
||||
}
|
||||
|
||||
return $this->redirect($this->generateUrl('chill_activity_activitytype'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a form to delete a ActivityType entity by id.
|
||||
*
|
||||
* @param mixed $id The entity id
|
||||
*
|
||||
* @return \Symfony\Component\Form\Form The form
|
||||
*/
|
||||
private function createDeleteForm($id)
|
||||
{
|
||||
return $this->createFormBuilder()
|
||||
->setAction($this->generateUrl('chill_activity_activitytype_delete', array('id' => $id)))
|
||||
->setMethod('DELETE')
|
||||
->add('submit', 'submit', array('label' => 'Delete'))
|
||||
->getForm()
|
||||
;
|
||||
}
|
||||
}
|
||||
|
@ -63,3 +63,10 @@ ActivityReasonCategory edit: Modification d'une catégorie de sujet
|
||||
ActivityReasonCategory: Catégorie de sujet d'activité
|
||||
ActivityReasonCategory is active and will be proposed: La catégorie est active et sera proposée
|
||||
ActivityReasonCategory is inactive and won't be proposed: La catégorie est inactive et ne sera pas proposée
|
||||
|
||||
# activity type admin
|
||||
ActivityType list: Types d'activités
|
||||
Create a new activity type: Créer un nouveau type d'activité
|
||||
ActivityType creation: Nouveau type d'activité
|
||||
ActivityType: Type d'activité
|
||||
ActivityType edit: Modifier une activité
|
@ -17,16 +17,18 @@
|
||||
{% extends "ChillActivityBundle::Admin/layout_activity.html.twig" %}
|
||||
|
||||
{% block admin_content %}
|
||||
<h1>ActivityType edit</h1>
|
||||
<h1>{{ 'ActivityType edit'|trans }}</h1>
|
||||
|
||||
{{ form(edit_form) }}
|
||||
{{ form_start(edit_form) }}
|
||||
{{ form_row(edit_form.name) }}
|
||||
{{ form_row(edit_form.submit, { 'attr' : { 'class' : 'sc-button orange' } } ) }}
|
||||
{{ form_end(edit_form) }}
|
||||
|
||||
<ul class="record_actions">
|
||||
<li>
|
||||
<a href="{{ path('chill_activity_activitytype') }}">
|
||||
Back to the list
|
||||
{{ 'Back to the list'|trans }}
|
||||
</a>
|
||||
</li>
|
||||
<li>{{ form(delete_form) }}</li>
|
||||
</ul>
|
||||
{% endblock %}
|
||||
|
@ -17,28 +17,26 @@
|
||||
{% extends "ChillActivityBundle::Admin/layout_activity.html.twig" %}
|
||||
|
||||
{% block admin_content %}
|
||||
<h1>ActivityType list</h1>
|
||||
<h1>{{ 'ActivityType list'|trans }}</h1>
|
||||
|
||||
<table class="records_list">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Id</th>
|
||||
<th>Name</th>
|
||||
<th>Actions</th>
|
||||
<th>{{ 'Name'|trans }}</th>
|
||||
<th>{{ 'Actions'|trans }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for entity in entities %}
|
||||
<tr>
|
||||
<td><a href="{{ path('chill_activity_activitytype_show', { 'id': entity.id }) }}">{{ entity.id }}</a></td>
|
||||
<td>{{ entity.name|localize_translatable_string }}</td>
|
||||
<td><a href="{{ path('chill_activity_activitytype_show', { 'id': entity.id }) }}">{{ entity.name|localize_translatable_string }}</a></td>
|
||||
<td>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="{{ path('chill_activity_activitytype_show', { 'id': entity.id }) }}">show</a>
|
||||
<a href="{{ path('chill_activity_activitytype_show', { 'id': entity.id }) }}">{{ 'show'|trans }}</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{{ path('chill_activity_activitytype_edit', { 'id': entity.id }) }}">edit</a>
|
||||
<a href="{{ path('chill_activity_activitytype_edit', { 'id': entity.id }) }}">{{ 'edit'|trans }}</a>
|
||||
</li>
|
||||
</ul>
|
||||
</td>
|
||||
@ -50,7 +48,7 @@
|
||||
<ul>
|
||||
<li>
|
||||
<a href="{{ path('chill_activity_activitytype_new') }}">
|
||||
Create a new entry
|
||||
{{ 'Create a new activity type'|trans }}
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
@ -17,14 +17,17 @@
|
||||
{% extends "ChillActivityBundle::Admin/layout_activity.html.twig" %}
|
||||
|
||||
{% block admin_content %}
|
||||
<h1>ActivityType creation</h1>
|
||||
<h1>{{ 'ActivityType creation'|trans }}</h1>
|
||||
|
||||
{{ form(form) }}
|
||||
{{ form_start(form) }}
|
||||
{{ form_row(form.name) }}
|
||||
{{ form_row(form.submit, { 'attr' : { 'class' : 'sc-button blue' } } ) }}
|
||||
{{ form_end(form) }}
|
||||
|
||||
<ul class="record_actions">
|
||||
<li>
|
||||
<a href="{{ path('chill_activity_activitytype') }}">
|
||||
Back to the list
|
||||
{{ 'Back to the list'|trans }}
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
@ -17,16 +17,12 @@
|
||||
{% extends "ChillActivityBundle::Admin/layout_activity.html.twig" %}
|
||||
|
||||
{% block admin_content %}
|
||||
<h1>ActivityType</h1>
|
||||
<h1>{{ 'ActivityType'|trans }}</h1>
|
||||
|
||||
<table class="record_properties">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>Id</th>
|
||||
<td>{{ entity.id }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>{{ 'Name'|trans }}</th>
|
||||
<td>{{ entity.name|localize_translatable_string }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
@ -35,14 +31,13 @@
|
||||
<ul class="record_actions">
|
||||
<li>
|
||||
<a href="{{ path('chill_activity_activitytype') }}">
|
||||
Back to the list
|
||||
{{ 'Back to the list'|trans }}
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{{ path('chill_activity_activitytype_edit', { 'id': entity.id }) }}">
|
||||
Edit
|
||||
{{ 'Edit'|trans }}
|
||||
</a>
|
||||
</li>
|
||||
<li>{{ form(delete_form) }}</li>
|
||||
</ul>
|
||||
{% endblock %}
|
||||
|
Loading…
x
Reference in New Issue
Block a user