add basic crud for admin

This commit is contained in:
Julien Fastré 2016-03-18 11:34:25 +01:00
parent cd7e9a9e2b
commit 9512528018
27 changed files with 1413 additions and 4 deletions

21
.gitignore vendored Normal file
View File

@ -0,0 +1,21 @@
*~
# MacOS
.DS_Store
# Bootstrap
app/bootstrap*
# Symfony directories
vendor/*
*/logs/*
*/cache/*
web/uploads/*
web/bundles/*
# Configuration files
app/config/parameters.ini
app/config/parameters.yml
Tests/Fixtures/App/config/parameters.yml
#composer
composer.lock

View File

@ -0,0 +1,224 @@
<?php
namespace Chill\EventBundle\Controller;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Chill\EventBundle\Entity\EventType;
use Chill\EventBundle\Form\EventTypeType;
/**
* EventType controller.
*
*/
class EventTypeController extends Controller
{
/**
* Lists all EventType entities.
*
*/
public function indexAction()
{
$em = $this->getDoctrine()->getManager();
$entities = $em->getRepository('ChillEventBundle:EventType')->findAll();
return $this->render('ChillEventBundle:EventType:index.html.twig', array(
'entities' => $entities,
));
}
/**
* Creates a new EventType entity.
*
*/
public function createAction(Request $request)
{
$entity = new EventType();
$form = $this->createCreateForm($entity);
$form->handleRequest($request);
if ($form->isValid()) {
$em = $this->getDoctrine()->getManager();
$em->persist($entity);
$em->flush();
return $this->redirect($this->generateUrl('{_locale}_admin_show', array('id' => $entity->getId())));
}
return $this->render('ChillEventBundle:EventType:new.html.twig', array(
'entity' => $entity,
'form' => $form->createView(),
));
}
/**
* Creates a form to create a EventType entity.
*
* @param EventType $entity The entity
*
* @return \Symfony\Component\Form\Form The form
*/
private function createCreateForm(EventType $entity)
{
$form = $this->createForm(new EventTypeType(), $entity, array(
'action' => $this->generateUrl('{_locale}_admin_create'),
'method' => 'POST',
));
$form->add('submit', 'submit', array('label' => 'Create'));
return $form;
}
/**
* Displays a form to create a new EventType entity.
*
*/
public function newAction()
{
$entity = new EventType();
$form = $this->createCreateForm($entity);
return $this->render('ChillEventBundle:EventType:new.html.twig', array(
'entity' => $entity,
'form' => $form->createView(),
));
}
/**
* Finds and displays a EventType entity.
*
*/
public function showAction($id)
{
$em = $this->getDoctrine()->getManager();
$entity = $em->getRepository('ChillEventBundle:EventType')->find($id);
if (!$entity) {
throw $this->createNotFoundException('Unable to find EventType entity.');
}
$deleteForm = $this->createDeleteForm($id);
return $this->render('ChillEventBundle:EventType:show.html.twig', array(
'entity' => $entity,
'delete_form' => $deleteForm->createView(),
));
}
/**
* Displays a form to edit an existing EventType entity.
*
*/
public function editAction($id)
{
$em = $this->getDoctrine()->getManager();
$entity = $em->getRepository('ChillEventBundle:EventType')->find($id);
if (!$entity) {
throw $this->createNotFoundException('Unable to find EventType entity.');
}
$editForm = $this->createEditForm($entity);
$deleteForm = $this->createDeleteForm($id);
return $this->render('ChillEventBundle:EventType:edit.html.twig', array(
'entity' => $entity,
'edit_form' => $editForm->createView(),
'delete_form' => $deleteForm->createView(),
));
}
/**
* Creates a form to edit a EventType entity.
*
* @param EventType $entity The entity
*
* @return \Symfony\Component\Form\Form The form
*/
private function createEditForm(EventType $entity)
{
$form = $this->createForm(new EventTypeType(), $entity, array(
'action' => $this->generateUrl('{_locale}_admin_update', array('id' => $entity->getId())),
'method' => 'PUT',
));
$form->add('submit', 'submit', array('label' => 'Update'));
return $form;
}
/**
* Edits an existing EventType entity.
*
*/
public function updateAction(Request $request, $id)
{
$em = $this->getDoctrine()->getManager();
$entity = $em->getRepository('ChillEventBundle:EventType')->find($id);
if (!$entity) {
throw $this->createNotFoundException('Unable to find EventType entity.');
}
$deleteForm = $this->createDeleteForm($id);
$editForm = $this->createEditForm($entity);
$editForm->handleRequest($request);
if ($editForm->isValid()) {
$em->flush();
return $this->redirect($this->generateUrl('{_locale}_admin_edit', array('id' => $id)));
}
return $this->render('ChillEventBundle:EventType:edit.html.twig', array(
'entity' => $entity,
'edit_form' => $editForm->createView(),
'delete_form' => $deleteForm->createView(),
));
}
/**
* Deletes a EventType entity.
*
*/
public function deleteAction(Request $request, $id)
{
$form = $this->createDeleteForm($id);
$form->handleRequest($request);
if ($form->isValid()) {
$em = $this->getDoctrine()->getManager();
$entity = $em->getRepository('ChillEventBundle:EventType')->find($id);
if (!$entity) {
throw $this->createNotFoundException('Unable to find EventType entity.');
}
$em->remove($entity);
$em->flush();
}
return $this->redirect($this->generateUrl('{_locale}_admin'));
}
/**
* Creates a form to delete a EventType 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('{_locale}_admin_delete', array('id' => $id)))
->setMethod('DELETE')
->add('submit', 'submit', array('label' => 'Delete'))
->getForm()
;
}
}

View File

@ -0,0 +1,224 @@
<?php
namespace Chill\EventBundle\Controller;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Chill\EventBundle\Entity\Role;
use Chill\EventBundle\Form\RoleType;
/**
* Role controller.
*
*/
class RoleController extends Controller
{
/**
* Lists all Role entities.
*
*/
public function indexAction()
{
$em = $this->getDoctrine()->getManager();
$entities = $em->getRepository('ChillEventBundle:Role')->findAll();
return $this->render('ChillEventBundle:Role:index.html.twig', array(
'entities' => $entities,
));
}
/**
* Creates a new Role entity.
*
*/
public function createAction(Request $request)
{
$entity = new Role();
$form = $this->createCreateForm($entity);
$form->handleRequest($request);
if ($form->isValid()) {
$em = $this->getDoctrine()->getManager();
$em->persist($entity);
$em->flush();
return $this->redirect($this->generateUrl('{_locale}_admin_role_show', array('id' => $entity->getId())));
}
return $this->render('ChillEventBundle:Role:new.html.twig', array(
'entity' => $entity,
'form' => $form->createView(),
));
}
/**
* Creates a form to create a Role entity.
*
* @param Role $entity The entity
*
* @return \Symfony\Component\Form\Form The form
*/
private function createCreateForm(Role $entity)
{
$form = $this->createForm(new RoleType(), $entity, array(
'action' => $this->generateUrl('{_locale}_admin_role_create'),
'method' => 'POST',
));
$form->add('submit', 'submit', array('label' => 'Create'));
return $form;
}
/**
* Displays a form to create a new Role entity.
*
*/
public function newAction()
{
$entity = new Role();
$form = $this->createCreateForm($entity);
return $this->render('ChillEventBundle:Role:new.html.twig', array(
'entity' => $entity,
'form' => $form->createView(),
));
}
/**
* Finds and displays a Role entity.
*
*/
public function showAction($id)
{
$em = $this->getDoctrine()->getManager();
$entity = $em->getRepository('ChillEventBundle:Role')->find($id);
if (!$entity) {
throw $this->createNotFoundException('Unable to find Role entity.');
}
$deleteForm = $this->createDeleteForm($id);
return $this->render('ChillEventBundle:Role:show.html.twig', array(
'entity' => $entity,
'delete_form' => $deleteForm->createView(),
));
}
/**
* Displays a form to edit an existing Role entity.
*
*/
public function editAction($id)
{
$em = $this->getDoctrine()->getManager();
$entity = $em->getRepository('ChillEventBundle:Role')->find($id);
if (!$entity) {
throw $this->createNotFoundException('Unable to find Role entity.');
}
$editForm = $this->createEditForm($entity);
$deleteForm = $this->createDeleteForm($id);
return $this->render('ChillEventBundle:Role:edit.html.twig', array(
'entity' => $entity,
'edit_form' => $editForm->createView(),
'delete_form' => $deleteForm->createView(),
));
}
/**
* Creates a form to edit a Role entity.
*
* @param Role $entity The entity
*
* @return \Symfony\Component\Form\Form The form
*/
private function createEditForm(Role $entity)
{
$form = $this->createForm(new RoleType(), $entity, array(
'action' => $this->generateUrl('{_locale}_admin_role_update', array('id' => $entity->getId())),
'method' => 'PUT',
));
$form->add('submit', 'submit', array('label' => 'Update'));
return $form;
}
/**
* Edits an existing Role entity.
*
*/
public function updateAction(Request $request, $id)
{
$em = $this->getDoctrine()->getManager();
$entity = $em->getRepository('ChillEventBundle:Role')->find($id);
if (!$entity) {
throw $this->createNotFoundException('Unable to find Role entity.');
}
$deleteForm = $this->createDeleteForm($id);
$editForm = $this->createEditForm($entity);
$editForm->handleRequest($request);
if ($editForm->isValid()) {
$em->flush();
return $this->redirect($this->generateUrl('{_locale}_admin_role_edit', array('id' => $id)));
}
return $this->render('ChillEventBundle:Role:edit.html.twig', array(
'entity' => $entity,
'edit_form' => $editForm->createView(),
'delete_form' => $deleteForm->createView(),
));
}
/**
* Deletes a Role entity.
*
*/
public function deleteAction(Request $request, $id)
{
$form = $this->createDeleteForm($id);
$form->handleRequest($request);
if ($form->isValid()) {
$em = $this->getDoctrine()->getManager();
$entity = $em->getRepository('ChillEventBundle:Role')->find($id);
if (!$entity) {
throw $this->createNotFoundException('Unable to find Role entity.');
}
$em->remove($entity);
$em->flush();
}
return $this->redirect($this->generateUrl('{_locale}_admin_role'));
}
/**
* Creates a form to delete a Role 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('{_locale}_admin_role_delete', array('id' => $id)))
->setMethod('DELETE')
->add('submit', 'submit', array('label' => 'Delete'))
->getForm()
;
}
}

View File

@ -0,0 +1,224 @@
<?php
namespace Chill\EventBundle\Controller;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Chill\EventBundle\Entity\Status;
use Chill\EventBundle\Form\StatusType;
/**
* Status controller.
*
*/
class StatusController extends Controller
{
/**
* Lists all Status entities.
*
*/
public function indexAction()
{
$em = $this->getDoctrine()->getManager();
$entities = $em->getRepository('ChillEventBundle:Status')->findAll();
return $this->render('ChillEventBundle:Status:index.html.twig', array(
'entities' => $entities,
));
}
/**
* Creates a new Status entity.
*
*/
public function createAction(Request $request)
{
$entity = new Status();
$form = $this->createCreateForm($entity);
$form->handleRequest($request);
if ($form->isValid()) {
$em = $this->getDoctrine()->getManager();
$em->persist($entity);
$em->flush();
return $this->redirect($this->generateUrl('fr_admin_event_status_show', array('id' => $entity->getId())));
}
return $this->render('ChillEventBundle:Status:new.html.twig', array(
'entity' => $entity,
'form' => $form->createView(),
));
}
/**
* Creates a form to create a Status entity.
*
* @param Status $entity The entity
*
* @return \Symfony\Component\Form\Form The form
*/
private function createCreateForm(Status $entity)
{
$form = $this->createForm(new StatusType(), $entity, array(
'action' => $this->generateUrl('fr_admin_event_status_create'),
'method' => 'POST',
));
$form->add('submit', 'submit', array('label' => 'Create'));
return $form;
}
/**
* Displays a form to create a new Status entity.
*
*/
public function newAction()
{
$entity = new Status();
$form = $this->createCreateForm($entity);
return $this->render('ChillEventBundle:Status:new.html.twig', array(
'entity' => $entity,
'form' => $form->createView(),
));
}
/**
* Finds and displays a Status entity.
*
*/
public function showAction($id)
{
$em = $this->getDoctrine()->getManager();
$entity = $em->getRepository('ChillEventBundle:Status')->find($id);
if (!$entity) {
throw $this->createNotFoundException('Unable to find Status entity.');
}
$deleteForm = $this->createDeleteForm($id);
return $this->render('ChillEventBundle:Status:show.html.twig', array(
'entity' => $entity,
'delete_form' => $deleteForm->createView(),
));
}
/**
* Displays a form to edit an existing Status entity.
*
*/
public function editAction($id)
{
$em = $this->getDoctrine()->getManager();
$entity = $em->getRepository('ChillEventBundle:Status')->find($id);
if (!$entity) {
throw $this->createNotFoundException('Unable to find Status entity.');
}
$editForm = $this->createEditForm($entity);
$deleteForm = $this->createDeleteForm($id);
return $this->render('ChillEventBundle:Status:edit.html.twig', array(
'entity' => $entity,
'edit_form' => $editForm->createView(),
'delete_form' => $deleteForm->createView(),
));
}
/**
* Creates a form to edit a Status entity.
*
* @param Status $entity The entity
*
* @return \Symfony\Component\Form\Form The form
*/
private function createEditForm(Status $entity)
{
$form = $this->createForm(new StatusType(), $entity, array(
'action' => $this->generateUrl('fr_admin_event_status_update', array('id' => $entity->getId())),
'method' => 'PUT',
));
$form->add('submit', 'submit', array('label' => 'Update'));
return $form;
}
/**
* Edits an existing Status entity.
*
*/
public function updateAction(Request $request, $id)
{
$em = $this->getDoctrine()->getManager();
$entity = $em->getRepository('ChillEventBundle:Status')->find($id);
if (!$entity) {
throw $this->createNotFoundException('Unable to find Status entity.');
}
$deleteForm = $this->createDeleteForm($id);
$editForm = $this->createEditForm($entity);
$editForm->handleRequest($request);
if ($editForm->isValid()) {
$em->flush();
return $this->redirect($this->generateUrl('fr_admin_event_status_edit', array('id' => $id)));
}
return $this->render('ChillEventBundle:Status:edit.html.twig', array(
'entity' => $entity,
'edit_form' => $editForm->createView(),
'delete_form' => $deleteForm->createView(),
));
}
/**
* Deletes a Status entity.
*
*/
public function deleteAction(Request $request, $id)
{
$form = $this->createDeleteForm($id);
$form->handleRequest($request);
if ($form->isValid()) {
$em = $this->getDoctrine()->getManager();
$entity = $em->getRepository('ChillEventBundle:Status')->find($id);
if (!$entity) {
throw $this->createNotFoundException('Unable to find Status entity.');
}
$em->remove($entity);
$em->flush();
}
return $this->redirect($this->generateUrl('fr_admin_event_status'));
}
/**
* Creates a form to delete a Status 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('fr_admin_event_status_delete', array('id' => $id)))
->setMethod('DELETE')
->add('submit', 'submit', array('label' => 'Delete'))
->getForm()
;
}
}

View File

@ -13,7 +13,7 @@ use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface;
*
* To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html}
*/
class ChillEventExtension extends Extension
class ChillEventExtension extends Extension implements PrependExtensionInterface
{
/**
* {@inheritdoc}

40
Form/EventTypeType.php Normal file
View File

@ -0,0 +1,40 @@
<?php
namespace Chill\EventBundle\Form;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
class EventTypeType extends AbstractType
{
/**
* @param FormBuilderInterface $builder
* @param array $options
*/
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('label')
->add('active')
;
}
/**
* @param OptionsResolverInterface $resolver
*/
public function setDefaultOptions(OptionsResolverInterface $resolver)
{
$resolver->setDefaults(array(
'data_class' => 'Chill\EventBundle\Entity\EventType'
));
}
/**
* @return string
*/
public function getName()
{
return 'chill_eventbundle_eventtype';
}
}

41
Form/RoleType.php Normal file
View File

@ -0,0 +1,41 @@
<?php
namespace Chill\EventBundle\Form;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
class RoleType extends AbstractType
{
/**
* @param FormBuilderInterface $builder
* @param array $options
*/
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('label')
->add('active')
->add('type')
;
}
/**
* @param OptionsResolverInterface $resolver
*/
public function setDefaultOptions(OptionsResolverInterface $resolver)
{
$resolver->setDefaults(array(
'data_class' => 'Chill\EventBundle\Entity\Role'
));
}
/**
* @return string
*/
public function getName()
{
return 'chill_eventbundle_role';
}
}

41
Form/StatusType.php Normal file
View File

@ -0,0 +1,41 @@
<?php
namespace Chill\EventBundle\Form;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
class StatusType extends AbstractType
{
/**
* @param FormBuilderInterface $builder
* @param array $options
*/
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('label')
->add('active')
->add('type')
;
}
/**
* @param OptionsResolverInterface $resolver
*/
public function setDefaultOptions(OptionsResolverInterface $resolver)
{
$resolver->setDefaults(array(
'data_class' => 'Chill\EventBundle\Entity\Status'
));
}
/**
* @return string
*/
public function getName()
{
return 'chill_eventbundle_status';
}
}

View File

@ -1,3 +1,12 @@
chill_event_homepage:
path: /hello/{name}
defaults: { _controller: ChillEventBundle:Default:index }
chill_event_fr_admin_event_status:
resource: "@ChillEventBundle/Resources/config/routing/status.yml"
prefix: /{_locale}/admin/event/status
chill_event_admin_role:
resource: "@ChillEventBundle/Resources/config/routing/role.yml"
prefix: /{_locale}/admin/event/role
chill_event_admin_event_type:
resource: "@ChillEventBundle/Resources/config/routing/eventtype.yml"
prefix: /{_locale}/admin/event/event_type

View File

@ -0,0 +1,30 @@
chill_event_admin:
path: /
defaults: { _controller: "ChillEventBundle:EventType:index" }
chill_event_admin_show:
path: /{id}/show
defaults: { _controller: "ChillEventBundle:EventType:show" }
chill_event_admin_new:
path: /new
defaults: { _controller: "ChillEventBundle:EventType:new" }
chill_event_admin_create:
path: /create
defaults: { _controller: "ChillEventBundle:EventType:create" }
methods: POST
chill_event_admin_edit:
path: /{id}/edit
defaults: { _controller: "ChillEventBundle:EventType:edit" }
chill_event_admin_update:
path: /{id}/update
defaults: { _controller: "ChillEventBundle:EventType:update" }
methods: [POST, PUT]
chill_event_admin_delete:
path: /{id}/delete
defaults: { _controller: "ChillEventBundle:EventType:delete" }
methods: [POST, DELETE]

View File

@ -0,0 +1,30 @@
chill_event_admin_role:
path: /
defaults: { _controller: "ChillEventBundle:Role:index" }
chill_event_admin_role_show:
path: /{id}/show
defaults: { _controller: "ChillEventBundle:Role:show" }
chill_event_admin_role_new:
path: /new
defaults: { _controller: "ChillEventBundle:Role:new" }
chill_event_admin_role_create:
path: /create
defaults: { _controller: "ChillEventBundle:Role:create" }
methods: POST
chill_event_admin_role_edit:
path: /{id}/edit
defaults: { _controller: "ChillEventBundle:Role:edit" }
chill_event_admin_role_update:
path: /{id}/update
defaults: { _controller: "ChillEventBundle:Role:update" }
methods: [POST, PUT]
chill_event_admin_role_delete:
path: /{id}/delete
defaults: { _controller: "ChillEventBundle:Role:delete" }
methods: [POST, DELETE]

View File

@ -0,0 +1,30 @@
fr_admin_event_status:
path: /
defaults: { _controller: "ChillEventBundle:Status:index" }
fr_admin_event_status_show:
path: /{id}/show
defaults: { _controller: "ChillEventBundle:Status:show" }
fr_admin_event_status_new:
path: /new
defaults: { _controller: "ChillEventBundle:Status:new" }
fr_admin_event_status_create:
path: /create
defaults: { _controller: "ChillEventBundle:Status:create" }
methods: POST
fr_admin_event_status_edit:
path: /{id}/edit
defaults: { _controller: "ChillEventBundle:Status:edit" }
fr_admin_event_status_update:
path: /{id}/update
defaults: { _controller: "ChillEventBundle:Status:update" }
methods: [POST, PUT]
fr_admin_event_status_delete:
path: /{id}/delete
defaults: { _controller: "ChillEventBundle:Status:delete" }
methods: [POST, DELETE]

View File

@ -0,0 +1,16 @@
{% extends '::base.html.twig' %}
{% block body -%}
<h1>EventType edit</h1>
{{ form(edit_form) }}
<ul class="record_actions">
<li>
<a href="{{ path('{_locale}_admin') }}">
Back to the list
</a>
</li>
<li>{{ form(delete_form) }}</li>
</ul>
{% endblock %}

View File

@ -0,0 +1,43 @@
{% extends '::base.html.twig' %}
{% block body -%}
<h1>EventType list</h1>
<table class="records_list">
<thead>
<tr>
<th>Id</th>
<th>Label</th>
<th>Active</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
{% for entity in entities %}
<tr>
<td><a href="{{ path('{_locale}_admin_show', { 'id': entity.id }) }}">{{ entity.id }}</a></td>
<td>{{ entity.label }}</td>
<td>{{ entity.active }}</td>
<td>
<ul>
<li>
<a href="{{ path('{_locale}_admin_show', { 'id': entity.id }) }}">show</a>
</li>
<li>
<a href="{{ path('{_locale}_admin_edit', { 'id': entity.id }) }}">edit</a>
</li>
</ul>
</td>
</tr>
{% endfor %}
</tbody>
</table>
<ul>
<li>
<a href="{{ path('{_locale}_admin_new') }}">
Create a new entry
</a>
</li>
</ul>
{% endblock %}

View File

@ -0,0 +1,15 @@
{% extends '::base.html.twig' %}
{% block body -%}
<h1>EventType creation</h1>
{{ form(form) }}
<ul class="record_actions">
<li>
<a href="{{ path('{_locale}_admin') }}">
Back to the list
</a>
</li>
</ul>
{% endblock %}

View File

@ -0,0 +1,36 @@
{% extends '::base.html.twig' %}
{% block body -%}
<h1>EventType</h1>
<table class="record_properties">
<tbody>
<tr>
<th>Id</th>
<td>{{ entity.id }}</td>
</tr>
<tr>
<th>Label</th>
<td>{{ entity.label }}</td>
</tr>
<tr>
<th>Active</th>
<td>{{ entity.active }}</td>
</tr>
</tbody>
</table>
<ul class="record_actions">
<li>
<a href="{{ path('{_locale}_admin') }}">
Back to the list
</a>
</li>
<li>
<a href="{{ path('{_locale}_admin_edit', { 'id': entity.id }) }}">
Edit
</a>
</li>
<li>{{ form(delete_form) }}</li>
</ul>
{% endblock %}

View File

@ -0,0 +1,16 @@
{% extends '::base.html.twig' %}
{% block body -%}
<h1>Role edit</h1>
{{ form(edit_form) }}
<ul class="record_actions">
<li>
<a href="{{ path('{_locale}_admin_role') }}">
Back to the list
</a>
</li>
<li>{{ form(delete_form) }}</li>
</ul>
{% endblock %}

View File

@ -0,0 +1,43 @@
{% extends '::base.html.twig' %}
{% block body -%}
<h1>Role list</h1>
<table class="records_list">
<thead>
<tr>
<th>Id</th>
<th>Label</th>
<th>Active</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
{% for entity in entities %}
<tr>
<td><a href="{{ path('{_locale}_admin_role_show', { 'id': entity.id }) }}">{{ entity.id }}</a></td>
<td>{{ entity.label }}</td>
<td>{{ entity.active }}</td>
<td>
<ul>
<li>
<a href="{{ path('{_locale}_admin_role_show', { 'id': entity.id }) }}">show</a>
</li>
<li>
<a href="{{ path('{_locale}_admin_role_edit', { 'id': entity.id }) }}">edit</a>
</li>
</ul>
</td>
</tr>
{% endfor %}
</tbody>
</table>
<ul>
<li>
<a href="{{ path('{_locale}_admin_role_new') }}">
Create a new entry
</a>
</li>
</ul>
{% endblock %}

View File

@ -0,0 +1,15 @@
{% extends '::base.html.twig' %}
{% block body -%}
<h1>Role creation</h1>
{{ form(form) }}
<ul class="record_actions">
<li>
<a href="{{ path('{_locale}_admin_role') }}">
Back to the list
</a>
</li>
</ul>
{% endblock %}

View File

@ -0,0 +1,36 @@
{% extends '::base.html.twig' %}
{% block body -%}
<h1>Role</h1>
<table class="record_properties">
<tbody>
<tr>
<th>Id</th>
<td>{{ entity.id }}</td>
</tr>
<tr>
<th>Label</th>
<td>{{ entity.label }}</td>
</tr>
<tr>
<th>Active</th>
<td>{{ entity.active }}</td>
</tr>
</tbody>
</table>
<ul class="record_actions">
<li>
<a href="{{ path('{_locale}_admin_role') }}">
Back to the list
</a>
</li>
<li>
<a href="{{ path('{_locale}_admin_role_edit', { 'id': entity.id }) }}">
Edit
</a>
</li>
<li>{{ form(delete_form) }}</li>
</ul>
{% endblock %}

View File

@ -0,0 +1,16 @@
{% extends '::base.html.twig' %}
{% block body -%}
<h1>Status edit</h1>
{{ form(edit_form) }}
<ul class="record_actions">
<li>
<a href="{{ path('fr_admin_event_status') }}">
Back to the list
</a>
</li>
<li>{{ form(delete_form) }}</li>
</ul>
{% endblock %}

View File

@ -0,0 +1,43 @@
{% extends '::base.html.twig' %}
{% block body -%}
<h1>Status list</h1>
<table class="records_list">
<thead>
<tr>
<th>Id</th>
<th>Label</th>
<th>Active</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
{% for entity in entities %}
<tr>
<td><a href="{{ path('fr_admin_event_status_show', { 'id': entity.id }) }}">{{ entity.id }}</a></td>
<td>{{ entity.label }}</td>
<td>{{ entity.active }}</td>
<td>
<ul>
<li>
<a href="{{ path('fr_admin_event_status_show', { 'id': entity.id }) }}">show</a>
</li>
<li>
<a href="{{ path('fr_admin_event_status_edit', { 'id': entity.id }) }}">edit</a>
</li>
</ul>
</td>
</tr>
{% endfor %}
</tbody>
</table>
<ul>
<li>
<a href="{{ path('fr_admin_event_status_new') }}">
Create a new entry
</a>
</li>
</ul>
{% endblock %}

View File

@ -0,0 +1,15 @@
{% extends '::base.html.twig' %}
{% block body -%}
<h1>Status creation</h1>
{{ form(form) }}
<ul class="record_actions">
<li>
<a href="{{ path('fr_admin_event_status') }}">
Back to the list
</a>
</li>
</ul>
{% endblock %}

View File

@ -0,0 +1,36 @@
{% extends '::base.html.twig' %}
{% block body -%}
<h1>Status</h1>
<table class="record_properties">
<tbody>
<tr>
<th>Id</th>
<td>{{ entity.id }}</td>
</tr>
<tr>
<th>Label</th>
<td>{{ entity.label }}</td>
</tr>
<tr>
<th>Active</th>
<td>{{ entity.active }}</td>
</tr>
</tbody>
</table>
<ul class="record_actions">
<li>
<a href="{{ path('fr_admin_event_status') }}">
Back to the list
</a>
</li>
<li>
<a href="{{ path('fr_admin_event_status_edit', { 'id': entity.id }) }}">
Edit
</a>
</li>
<li>{{ form(delete_form) }}</li>
</ul>
{% endblock %}

View File

@ -0,0 +1,55 @@
<?php
namespace Chill\EventBundle\Tests\Controller;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
class EventTypeControllerTest extends WebTestCase
{
/*
public function testCompleteScenario()
{
// Create a new client to browse the application
$client = static::createClient();
// Create a new entry in the database
$crawler = $client->request('GET', '/{_locale}/admin/');
$this->assertEquals(200, $client->getResponse()->getStatusCode(), "Unexpected HTTP status code for GET /{_locale}/admin/");
$crawler = $client->click($crawler->selectLink('Create a new entry')->link());
// Fill in the form and submit it
$form = $crawler->selectButton('Create')->form(array(
'chill_eventbundle_eventtype[field_name]' => 'Test',
// ... other fields to fill
));
$client->submit($form);
$crawler = $client->followRedirect();
// Check data in the show view
$this->assertGreaterThan(0, $crawler->filter('td:contains("Test")')->count(), 'Missing element td:contains("Test")');
// Edit the entity
$crawler = $client->click($crawler->selectLink('Edit')->link());
$form = $crawler->selectButton('Update')->form(array(
'chill_eventbundle_eventtype[field_name]' => 'Foo',
// ... other fields to fill
));
$client->submit($form);
$crawler = $client->followRedirect();
// Check the element contains an attribute with value equals "Foo"
$this->assertGreaterThan(0, $crawler->filter('[value="Foo"]')->count(), 'Missing element [value="Foo"]');
// Delete the entity
$client->submit($crawler->selectButton('Delete')->form());
$crawler = $client->followRedirect();
// Check the entity has been delete on the list
$this->assertNotRegExp('/Foo/', $client->getResponse()->getContent());
}
*/
}

View File

@ -0,0 +1,55 @@
<?php
namespace Chill\EventBundle\Tests\Controller;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
class RoleControllerTest extends WebTestCase
{
/*
public function testCompleteScenario()
{
// Create a new client to browse the application
$client = static::createClient();
// Create a new entry in the database
$crawler = $client->request('GET', '/{_locale}/admin/role/');
$this->assertEquals(200, $client->getResponse()->getStatusCode(), "Unexpected HTTP status code for GET /{_locale}/admin/role/");
$crawler = $client->click($crawler->selectLink('Create a new entry')->link());
// Fill in the form and submit it
$form = $crawler->selectButton('Create')->form(array(
'chill_eventbundle_role[field_name]' => 'Test',
// ... other fields to fill
));
$client->submit($form);
$crawler = $client->followRedirect();
// Check data in the show view
$this->assertGreaterThan(0, $crawler->filter('td:contains("Test")')->count(), 'Missing element td:contains("Test")');
// Edit the entity
$crawler = $client->click($crawler->selectLink('Edit')->link());
$form = $crawler->selectButton('Update')->form(array(
'chill_eventbundle_role[field_name]' => 'Foo',
// ... other fields to fill
));
$client->submit($form);
$crawler = $client->followRedirect();
// Check the element contains an attribute with value equals "Foo"
$this->assertGreaterThan(0, $crawler->filter('[value="Foo"]')->count(), 'Missing element [value="Foo"]');
// Delete the entity
$client->submit($crawler->selectButton('Delete')->form());
$crawler = $client->followRedirect();
// Check the entity has been delete on the list
$this->assertNotRegExp('/Foo/', $client->getResponse()->getContent());
}
*/
}

View File

@ -0,0 +1,55 @@
<?php
namespace Chill\EventBundle\Tests\Controller;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
class StatusControllerTest extends WebTestCase
{
/*
public function testCompleteScenario()
{
// Create a new client to browse the application
$client = static::createClient();
// Create a new entry in the database
$crawler = $client->request('GET', '/fr/admin/event/status/');
$this->assertEquals(200, $client->getResponse()->getStatusCode(), "Unexpected HTTP status code for GET /fr/admin/event/status/");
$crawler = $client->click($crawler->selectLink('Create a new entry')->link());
// Fill in the form and submit it
$form = $crawler->selectButton('Create')->form(array(
'chill_eventbundle_status[field_name]' => 'Test',
// ... other fields to fill
));
$client->submit($form);
$crawler = $client->followRedirect();
// Check data in the show view
$this->assertGreaterThan(0, $crawler->filter('td:contains("Test")')->count(), 'Missing element td:contains("Test")');
// Edit the entity
$crawler = $client->click($crawler->selectLink('Edit')->link());
$form = $crawler->selectButton('Update')->form(array(
'chill_eventbundle_status[field_name]' => 'Foo',
// ... other fields to fill
));
$client->submit($form);
$crawler = $client->followRedirect();
// Check the element contains an attribute with value equals "Foo"
$this->assertGreaterThan(0, $crawler->filter('[value="Foo"]')->count(), 'Missing element [value="Foo"]');
// Delete the entity
$client->submit($crawler->selectButton('Delete')->form());
$crawler = $client->followRedirect();
// Check the entity has been delete on the list
$this->assertNotRegExp('/Foo/', $client->getResponse()->getContent());
}
*/
}