layout and clean activity reason crud

This commit is contained in:
Julien Fastré 2015-10-02 13:57:23 +02:00
parent 0bee5e46db
commit bebee4fbeb
8 changed files with 46 additions and 89 deletions

View File

@ -101,11 +101,8 @@ class ActivityReasonCategoryController extends Controller
throw $this->createNotFoundException('Unable to find ActivityReasonCategory entity.');
}
$deleteForm = $this->createDeleteForm($id);
return $this->render('ChillActivityBundle:ActivityReasonCategory:show.html.twig', array(
'entity' => $entity,
'delete_form' => $deleteForm->createView(),
));
}
@ -124,12 +121,10 @@ class ActivityReasonCategoryController extends Controller
}
$editForm = $this->createEditForm($entity);
$deleteForm = $this->createDeleteForm($id);
return $this->render('ChillActivityBundle:ActivityReasonCategory:edit.html.twig', array(
'entity' => $entity,
'edit_form' => $editForm->createView(),
'delete_form' => $deleteForm->createView(),
));
}
@ -165,7 +160,6 @@ class ActivityReasonCategoryController extends Controller
throw $this->createNotFoundException('Unable to find ActivityReasonCategory entity.');
}
$deleteForm = $this->createDeleteForm($id);
$editForm = $this->createEditForm($entity);
$editForm->handleRequest($request);
@ -178,47 +172,6 @@ class ActivityReasonCategoryController extends Controller
return $this->render('ChillActivityBundle:ActivityReasonCategory:edit.html.twig', array(
'entity' => $entity,
'edit_form' => $editForm->createView(),
'delete_form' => $deleteForm->createView(),
));
}
/**
* Deletes a ActivityReasonCategory 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:ActivityReasonCategory')->find($id);
if (!$entity) {
throw $this->createNotFoundException('Unable to find ActivityReasonCategory entity.');
}
$em->remove($entity);
$em->flush();
}
return $this->redirect($this->generateUrl('chill_activity_activityreasoncategory'));
}
/**
* Creates a form to delete a ActivityReasonCategory 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_activityreasoncategory_delete', array('id' => $id)))
->setMethod('DELETE')
->add('submit', 'submit', array('label' => 'Delete'))
->getForm()
;
}
}

View File

@ -45,7 +45,7 @@ class ActivityReason
/**
* @var boolean
*/
private $active;
private $active = true;
/**

View File

@ -40,7 +40,7 @@ class ActivityReasonCategory
/**
* @var boolean
*/
private $active;
private $active = true;
/** @var ArrayCollection array of ActivityReason */
private $reasons;

View File

@ -41,7 +41,8 @@ CHILL_ACTIVITY_SEE: Voir une activité
Activity configuration menu: Configuration des activités
Activity Types: Types d'activité
Activity Reasons: Sujets d'une activité
Activity Reasons Category: Catégories d'activités
Activity Reasons Category: Catégories de sujet d'activités
Activity configuration: Configuration des activités
# activity reason admin
ActivityReason list: Liste des sujets
@ -53,3 +54,12 @@ ActivityReason edit: Modification d'un sujet
ActivityReason: Sujet d'activité
The entity is inactive and won't be proposed: Le sujet est inactif et ne sera pas proposé
The entity is active and will be proposed: Le sujet est actif et sera proposé
#activity reason category admin
ActivityReasonCategory list: Catégories de sujets
Create a new activity category reason: Créer une nouvelle catégorie
ActivityReasonCategory creation: Nouvelle catégorie de sujet
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

View File

@ -17,16 +17,19 @@
{% extends "ChillActivityBundle::Admin/layout_activity.html.twig" %}
{% block admin_content %}
<h1>ActivityReasonCategory edit</h1>
<h1>{{ 'ActivityReasonCategory edit'|trans }}</h1>
{{ form(edit_form) }}
{{ form_start(edit_form) }}
{{ form_row(edit_form.name) }}
{{ form_row(edit_form.active) }}
{{ form_row(edit_form.submit, { 'attr': { 'class': 'sc-button orange' } } ) }}
{{ form_end(edit_form) }}
<ul class="record_actions">
<li>
<a href="{{ path('chill_activity_activityreasoncategory') }}">
Back to the list
{{ 'Back to the list'|trans }}
</a>
</li>
<li>{{ form(delete_form) }}</li>
</ul>
{% endblock %}

View File

@ -17,40 +17,28 @@
{% extends "ChillActivityBundle::Admin/layout_activity.html.twig" %}
{% block admin_content %}
<h1>ActivityReasonCategory list</h1>
<h1>{{ 'ActivityReasonCategory list'|trans }}</h1>
<table class="records_list">
<thead>
<tr>
<th>{{ 'Name'|trans }}</th>
<th>{{ 'Active'|trans }}Active</th>
<th>{{ 'Actions'|trans }}</th>
</tr>
</thead>
<tbody>
{% for entity in entities %}
<tr>
<td><a href="{{ path('chill_activity_activityreasoncategory_show', { 'id': entity.id }) }}">{{ entity.name|localize_translatable_string }}</a></td>
<td>
<a href="{{ path('chill_activity_activityreasoncategory_show', { 'id': entity.id }) }}">
{{ entity.name|localize_translatable_string }}
</a>
</td>
<td>
{% if entity.active %}
<p>{{ 'Active'|trans }}</p>
{% else %}
<p>{{ "Inactive"|trans }}</p>
{% endif %}
</td>
<td>
<ul>
<li>
<a href="{{ path('chill_activity_activityreasoncategory_show', { 'id': entity.id }) }}">{{'show'|trans}}</a>
</li>
<li>
<a href="{{ path('chill_activity_activityreasoncategory_edit', { 'id': entity.id }) }}">{{'edit'|trans}}</a>
</li>
</ul>
<ul>
<li>
<a href="{{ path('chill_activity_activityreasoncategory_show', { 'id': entity.id }) }}">{{ 'show'|trans }}</a>
</li>
<li>
<a href="{{ path('chill_activity_activityreasoncategory_edit', { 'id': entity.id }) }}">{{ 'edit'|trans }}</a>
</li>
</ul>
</td>
</tr>
{% endfor %}
@ -60,7 +48,7 @@
<ul>
<li>
<a href="{{ path('chill_activity_activityreasoncategory_new') }}">
{{'Create a new entry'|trans}}
{{ 'Create a new activity category reason'|trans }}
</a>
</li>
</ul>

View File

@ -17,14 +17,18 @@
{% extends "ChillActivityBundle::Admin/layout_activity.html.twig" %}
{% block admin_content %}
<h1>ActivityReasonCategory creation</h1>
<h1>{{ 'ActivityReasonCategory creation'|trans }}</h1>
{{ form(form) }}
{{ form_start(form) }}
{{ form_row(form.name) }}
{{ form_row(form.active) }}
{{ form_widget(form.submit, { 'attr': { 'class' : 'sc-button blue' } } ) }}
<p>{{ form_end(form) }}</p>
<ul class="record_actions">
<li>
<a href="{{ path('chill_activity_activityreasoncategory') }}">
Back to the list
{{ 'Back to the list'|trans }}
</a>
</li>
</ul>

View File

@ -17,7 +17,7 @@
{% extends "ChillActivityBundle::Admin/layout_activity.html.twig" %}
{% block admin_content %}
<h1>ActivityReasonCategory</h1>
<h1>{{ 'ActivityReasonCategory'|trans }}</h1>
<table class="record_properties">
<tbody>
@ -28,11 +28,11 @@
<tr>
<th>{{ 'Active'|trans }}</th>
<td>
{% if entity.active %}
<p>{{ 'The entity is active and will be proposed'|trans }}</p>
{% else %}
<p>{{ "The entity is inactive and won't be proposed"|trans }}</p>
{% endif %}
{%- if entity.active -%}
{{ 'ActivityReasonCategory is active and will be proposed'|trans }}
{%- else -%}
{{ "ActivityReasonCategory is inactive and won't be proposed"|trans }}
{%- endif -%}
</td>
</tr>
</tbody>
@ -41,14 +41,13 @@
<ul class="record_actions">
<li>
<a href="{{ path('chill_activity_activityreasoncategory') }}">
Back to the list
{{ 'Back to the list'|trans }}
</a>
</li>
<li>
<a href="{{ path('chill_activity_activityreasoncategory_edit', { 'id': entity.id }) }}">
Edit
{{ 'Edit'|trans }}
</a>
</li>
<li>{{ form(delete_form) }}</li>
</ul>
{% endblock %}