Commit b2dd199c authored by Mat's avatar Mat
Browse files

init Info et Lettre, mise en place des fichiers pour les 2 CRUD

parent f4eb738d
<?php
namespace APIBundle\Controller;
class InfoAPIController extends MasterAPIController
{
}
<?php
namespace APIBundle\Controller;
class LettreAPIController extends MasterAPIController
{
}
<?php
namespace APIBundle\Form;
use PotageBundle\Form\Info\InfoType;
use Symfony\Component\OptionsResolver\OptionsResolver;
class InfoAPIType extends InfoType
{
/**
* @param OptionsResolver $resolver
*/
public function configureOptions(OptionsResolver $resolver)
{
parent::configureOptions($resolver);
$resolver->setDefault('csrf_protection', false);
// TODO temporaire, le temps de régler les validations au niveau des Asserts et des FormType
$resolver->setDefault('attr', array('novalidate' => true));
}
}
<?php
namespace APIBundle\Form;
use PotageBundle\Form\Lettre\LettreType;
use Symfony\Component\OptionsResolver\OptionsResolver;
class LettreAPIType extends LettreType
{
/**
* @param OptionsResolver $resolver
*/
public function configureOptions(OptionsResolver $resolver)
{
parent::configureOptions($resolver);
$resolver->setDefault('csrf_protection', false);
// TODO temporaire, le temps de régler les validations au niveau des Asserts et des FormType
$resolver->setDefault('attr', array('novalidate' => true));
}
}
<?php
namespace PotageBundle\Controller;
use APIBundle\Form\InfoAPIType;
class InfoController extends MasterController
{
/**
* @return \Symfony\Component\HttpFoundation\Response
*/
public function ajaxDisplayAction()
{
$form = $this->createForm(InfoAPIType::class);
return $this->render('@Potage/Info/ajaxDisplay.html.twig', array(
'formInfo' => $form->createView()
));
}
}
<?php
namespace PotageBundle\Controller;
use APIBundle\Form\LettreAPIType;
class LettreController extends MasterController
{
/**
* @return \Symfony\Component\HttpFoundation\Response
*/
public function ajaxDisplayAction()
{
$form = $this->createForm(LettreAPIType::class);
return $this->render('@Potage/Lettre/ajaxDisplay.html.twig', array(
'formLettre' => $form->createView()
));
}
}
<?php
namespace PotageBundle\Form\Info;
use PotageBundle\Entity\Info;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
class InfoType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
}
public function configureOptions(OptionsResolver $resolver)
{
parent::configureOptions($resolver);
$resolver->setDefault('data_class', Info::class);
$resolver->setDefault('attr', array(
'class' => 'formulaire formulaire_info',
));
}
public function getBlockPrefix()
{
return 'info';
}
}
<?php
namespace PotageBundle\Form\Lettre;
use PotageBundle\Entity\Lettre;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
class LettreType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
}
public function configureOptions(OptionsResolver $resolver)
{
parent::configureOptions($resolver);
$resolver->setDefault('data_class', Lettre::class);
$resolver->setDefault('attr', array(
'class' => 'formulaire formulaire_lettre',
));
}
public function getBlockPrefix()
{
return 'lettre';
}
}
......@@ -25,3 +25,15 @@ potage_offre_legumes_ajax_display:
_controller: PotageBundle:OffreLegumes:ajaxDisplay
methods: [ GET ]
potage_lettre_ajax_display:
path: /admin/lettres
defaults:
_controller: PotageBundle:Lettre:ajaxDisplay
methods: [ GET ]
potage_info_ajax_display:
path: /admin/infos
defaults:
_controller: PotageBundle:Info:ajaxDisplay
methods: [ GET ]
{% extends '@Potage/layout.html.twig' %}
{% block title %}
Les infos
{% endblock %}
{% block searchbar %}
<nav class="navbar navbar-expand-lg navbar-light bg-light navbar-search"></nav>
{% endblock %}
{% block headerContent %}
{% endblock %}
{% block sidebarContent %}
<div class="row">
{% endblock %}
{% block sectionContent %}
</div>
{% endblock %}
{% block customJS %}
<script type="text/javascript" src="{{ asset('js/functions.js') }}"></script>
<script type="text/javascript" src="{{ asset('js/ajax_functions.js') }}"></script>
<script type="text/javascript">
</script>
{% endblock %}
{% extends '@Potage/layout.html.twig' %}
{% block title %}
Les infolettres
{% endblock %}
{% block searchbar %}
<nav class="navbar navbar-expand-lg navbar-light bg-light navbar-search"></nav>
{% endblock %}
{% block headerContent %}
{% endblock %}
{% block sidebarContent %}
<div class="row">
{% endblock %}
{% block sectionContent %}
</div>
{% endblock %}
{% block customJS %}
<script type="text/javascript" src="{{ asset('js/functions.js') }}"></script>
<script type="text/javascript" src="{{ asset('js/ajax_functions.js') }}"></script>
<script type="text/javascript">
</script>
{% endblock %}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment