mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-12 13:24:25 +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.');
|
throw $this->createNotFoundException('Unable to find ActivityType entity.');
|
||||||
}
|
}
|
||||||
|
|
||||||
$deleteForm = $this->createDeleteForm($id);
|
|
||||||
|
|
||||||
return $this->render('ChillActivityBundle:ActivityType:show.html.twig', array(
|
return $this->render('ChillActivityBundle:ActivityType:show.html.twig', array(
|
||||||
'entity' => $entity,
|
'entity' => $entity,
|
||||||
'delete_form' => $deleteForm->createView(),
|
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -124,12 +121,10 @@ class ActivityTypeController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
$editForm = $this->createEditForm($entity);
|
$editForm = $this->createEditForm($entity);
|
||||||
$deleteForm = $this->createDeleteForm($id);
|
|
||||||
|
|
||||||
return $this->render('ChillActivityBundle:ActivityType:edit.html.twig', array(
|
return $this->render('ChillActivityBundle:ActivityType:edit.html.twig', array(
|
||||||
'entity' => $entity,
|
'entity' => $entity,
|
||||||
'edit_form' => $editForm->createView(),
|
'edit_form' => $editForm->createView()
|
||||||
'delete_form' => $deleteForm->createView(),
|
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -164,8 +159,7 @@ class ActivityTypeController extends Controller
|
|||||||
if (!$entity) {
|
if (!$entity) {
|
||||||
throw $this->createNotFoundException('Unable to find ActivityType entity.');
|
throw $this->createNotFoundException('Unable to find ActivityType entity.');
|
||||||
}
|
}
|
||||||
|
|
||||||
$deleteForm = $this->createDeleteForm($id);
|
|
||||||
$editForm = $this->createEditForm($entity);
|
$editForm = $this->createEditForm($entity);
|
||||||
$editForm->handleRequest($request);
|
$editForm->handleRequest($request);
|
||||||
|
|
||||||
@ -178,47 +172,6 @@ class ActivityTypeController extends Controller
|
|||||||
return $this->render('ChillActivityBundle:ActivityType:edit.html.twig', array(
|
return $this->render('ChillActivityBundle:ActivityType:edit.html.twig', array(
|
||||||
'entity' => $entity,
|
'entity' => $entity,
|
||||||
'edit_form' => $editForm->createView(),
|
'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: Catégorie de sujet d'activité
|
||||||
ActivityReasonCategory is active and will be proposed: La catégorie est active et sera proposée
|
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
|
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" %}
|
{% extends "ChillActivityBundle::Admin/layout_activity.html.twig" %}
|
||||||
|
|
||||||
{% block admin_content %}
|
{% 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">
|
<ul class="record_actions">
|
||||||
<li>
|
<li>
|
||||||
<a href="{{ path('chill_activity_activitytype') }}">
|
<a href="{{ path('chill_activity_activitytype') }}">
|
||||||
Back to the list
|
{{ 'Back to the list'|trans }}
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li>{{ form(delete_form) }}</li>
|
|
||||||
</ul>
|
</ul>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@ -17,28 +17,26 @@
|
|||||||
{% extends "ChillActivityBundle::Admin/layout_activity.html.twig" %}
|
{% extends "ChillActivityBundle::Admin/layout_activity.html.twig" %}
|
||||||
|
|
||||||
{% block admin_content %}
|
{% block admin_content %}
|
||||||
<h1>ActivityType list</h1>
|
<h1>{{ 'ActivityType list'|trans }}</h1>
|
||||||
|
|
||||||
<table class="records_list">
|
<table class="records_list">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Id</th>
|
<th>{{ 'Name'|trans }}</th>
|
||||||
<th>Name</th>
|
<th>{{ 'Actions'|trans }}</th>
|
||||||
<th>Actions</th>
|
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{% for entity in entities %}
|
{% for entity in entities %}
|
||||||
<tr>
|
<tr>
|
||||||
<td><a href="{{ path('chill_activity_activitytype_show', { 'id': entity.id }) }}">{{ entity.id }}</a></td>
|
<td><a href="{{ path('chill_activity_activitytype_show', { 'id': entity.id }) }}">{{ entity.name|localize_translatable_string }}</a></td>
|
||||||
<td>{{ entity.name|localize_translatable_string }}</td>
|
|
||||||
<td>
|
<td>
|
||||||
<ul>
|
<ul>
|
||||||
<li>
|
<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>
|
||||||
<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>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</td>
|
</td>
|
||||||
@ -50,7 +48,7 @@
|
|||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
<a href="{{ path('chill_activity_activitytype_new') }}">
|
<a href="{{ path('chill_activity_activitytype_new') }}">
|
||||||
Create a new entry
|
{{ 'Create a new activity type'|trans }}
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
@ -17,14 +17,17 @@
|
|||||||
{% extends "ChillActivityBundle::Admin/layout_activity.html.twig" %}
|
{% extends "ChillActivityBundle::Admin/layout_activity.html.twig" %}
|
||||||
|
|
||||||
{% block admin_content %}
|
{% 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">
|
<ul class="record_actions">
|
||||||
<li>
|
<li>
|
||||||
<a href="{{ path('chill_activity_activitytype') }}">
|
<a href="{{ path('chill_activity_activitytype') }}">
|
||||||
Back to the list
|
{{ 'Back to the list'|trans }}
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
@ -17,16 +17,12 @@
|
|||||||
{% extends "ChillActivityBundle::Admin/layout_activity.html.twig" %}
|
{% extends "ChillActivityBundle::Admin/layout_activity.html.twig" %}
|
||||||
|
|
||||||
{% block admin_content %}
|
{% block admin_content %}
|
||||||
<h1>ActivityType</h1>
|
<h1>{{ 'ActivityType'|trans }}</h1>
|
||||||
|
|
||||||
<table class="record_properties">
|
<table class="record_properties">
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Id</th>
|
<th>{{ 'Name'|trans }}</th>
|
||||||
<td>{{ entity.id }}</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th>Name</th>
|
|
||||||
<td>{{ entity.name|localize_translatable_string }}</td>
|
<td>{{ entity.name|localize_translatable_string }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
@ -35,14 +31,13 @@
|
|||||||
<ul class="record_actions">
|
<ul class="record_actions">
|
||||||
<li>
|
<li>
|
||||||
<a href="{{ path('chill_activity_activitytype') }}">
|
<a href="{{ path('chill_activity_activitytype') }}">
|
||||||
Back to the list
|
{{ 'Back to the list'|trans }}
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="{{ path('chill_activity_activitytype_edit', { 'id': entity.id }) }}">
|
<a href="{{ path('chill_activity_activitytype_edit', { 'id': entity.id }) }}">
|
||||||
Edit
|
{{ 'Edit'|trans }}
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li>{{ form(delete_form) }}</li>
|
|
||||||
</ul>
|
</ul>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user