@@ -25,11 +25,16 @@ const addFormToCollection = (e) => { | |||
collectionHolder.appendChild(item); | |||
collectionHolder.dataset.index++; | |||
if (collectionHolder.dataset.index >= 6) { | |||
e.currentTarget.style.visibility = 'hidden'; | |||
} | |||
// add a delete link to the new form | |||
addFormDeleteLink(item); | |||
addFormDeleteLink(item, e.currentTarget); | |||
}; | |||
const addFormDeleteLink = (formLi) => { | |||
const addFormDeleteLink = (formLi, currentTarget) => { | |||
const collectionHolder = document.querySelector('.' + currentTarget.dataset.collectionHolderClass); | |||
const removeFormButton = document.createElement('button') | |||
removeFormButton.classList.add('button-green', 'button-remove') | |||
removeFormButton.innerText = 'Supprimer' | |||
@@ -37,6 +42,10 @@ const addFormDeleteLink = (formLi) => { | |||
formLi.append(removeFormButton); | |||
removeFormButton.addEventListener('click', (e) => { | |||
collectionHolder.dataset.index--; | |||
if (collectionHolder.dataset.index <= 6) { | |||
currentTarget.style.visibility = 'visible'; | |||
} | |||
e.preventDefault() | |||
formLi.remove(); | |||
}); |
@@ -73,6 +73,15 @@ button:focus { | |||
font-family: dinbold; | |||
} | |||
.alert-success { | |||
position: absolute; | |||
top: $headerheight; | |||
width: 100%; | |||
text-align: center; | |||
color: $green; | |||
font-family: dinbold; | |||
} | |||
.link-slide { | |||
position: relative; | |||
overflow: hidden; |
@@ -137,12 +137,12 @@ | |||
border-color: $green; | |||
height: 40px; | |||
min-width: 300px; | |||
margin-top: 15px; | |||
margin-bottom: 15px; | |||
} | |||
label { | |||
display: none; | |||
margin-bottom: 0; | |||
color: #808080; | |||
} | |||
.button-remove { | |||
@@ -153,10 +153,8 @@ | |||
.save { | |||
margin-top: 100px; | |||
paddin-top: 20px; | |||
paddin-bottom: 20px; | |||
padding-left: 30px; | |||
padding-right: 30px; | |||
border-radius: 0; | |||
padding: 15px 40px; | |||
font-size: 27px; | |||
} | |||
} |
@@ -118,10 +118,10 @@ | |||
"/build/vendors-node_modules_core-js_internals_array-iteration_js-node_modules_jquery_src_jquery_js.a55f993d.js", | |||
"/build/vendors-node_modules_core-js_modules_es_string_split_js-node_modules_popper_js_dist_esm_popper_js.22d0763b.js", | |||
"/build/vendors-node_modules_bootstrap_dist_js_bootstrap_js-node_modules_core-js_modules_es_array_for-85fc9f.e742e2fb.js", | |||
"/build/app-frontend.3bcbfd58.js" | |||
"/build/app-frontend.9cc512c2.js" | |||
], | |||
"css": [ | |||
"/build/app-frontend.2a8eed13.css" | |||
"/build/app-frontend.2fba4f18.css" | |||
] | |||
} | |||
} |
@@ -17,8 +17,8 @@ | |||
"build/sov-ticket.js": "/build/sov-ticket.df76c7a0.js", | |||
"build/app-backend.css": "/build/app-backend.3d882954.css", | |||
"build/app-backend.js": "/build/app-backend.e87ef456.js", | |||
"build/app-frontend.css": "/build/app-frontend.2a8eed13.css", | |||
"build/app-frontend.js": "/build/app-frontend.3bcbfd58.js", | |||
"build/app-frontend.css": "/build/app-frontend.2fba4f18.css", | |||
"build/app-frontend.js": "/build/app-frontend.9cc512c2.js", | |||
"build/runtime.js": "/build/runtime.3095b250.js", | |||
"build/vendors-node_modules_core-js_internals_export_js.2e873f33.js": "/build/vendors-node_modules_core-js_internals_export_js.2e873f33.js", | |||
"build/vendors-node_modules_core-js_modules_es_string_replace_js.06749256.js": "/build/vendors-node_modules_core-js_modules_es_string_replace_js.06749256.js", |
@@ -19,13 +19,12 @@ class ContribuateController extends DefaultController | |||
$form->handleRequest($request); | |||
if ($form->isSubmitted() && $form->isValid()) { | |||
// dump($individualData); | |||
// dump($form); | |||
// die; | |||
$individualData->setStatus(0); | |||
$entityManager->create($individualData); | |||
$entityManager->flush(); | |||
$this->addFlash('success', 'Votre contribution a bien été prise en compte !'); | |||
} | |||
return $this->render( | |||
'frontend/contribuate.html.twig', | |||
[ |
@@ -21,51 +21,56 @@ class IndividualDataForm extends AbstractType | |||
{ | |||
$builder | |||
->add('territory', EntityType::class, [ | |||
'label' => 'Je suis un.e citoyen.ne du', | |||
'label' => 'form.field.territory.label', | |||
'translation_domain' => 'frontend', | |||
'class' => Territory::class, | |||
'expanded' => true, | |||
'multiple' => false, | |||
]) | |||
->add('revolt', CollectionType::class, [ | |||
'label' => 'form.field.revolt.label', | |||
'translation_domain' => 'frontend', | |||
'entry_type' => RevoltType::class, | |||
'entry_options' => [ | |||
'context' => $options['context'], | |||
'label' => false, | |||
], | |||
'label' => 'Qu’est ce qui vous révolte sur votre territoire ?', | |||
'allow_add' => true, | |||
'allow_delete' => true, | |||
'by_reference' => false, | |||
]) | |||
->add('dream', CollectionType::class, [ | |||
'label' => 'form.field.dream.label', | |||
'translation_domain' => 'frontend', | |||
'entry_type' => DreamType::class, | |||
'entry_options' => [ | |||
'context' => $options['context'], | |||
'label' => false, | |||
], | |||
'label' => 'Quel est votre ou vos rêves pour votre territoire ?', | |||
'allow_add' => true, | |||
'allow_delete' => true, | |||
'by_reference' => false, | |||
]) | |||
->add('projectBoost', CollectionType::class, [ | |||
'label' => 'form.field.projectBoost.label', | |||
'translation_domain' => 'frontend', | |||
'entry_type' => ProjectBoostType::class, | |||
'entry_options' => [ | |||
'context' => $options['context'], | |||
'label' => false, | |||
], | |||
'label' => 'Quelles initiatives locales meriteraient à votre avis d’être davantage soutenues ?', | |||
'allow_add' => true, | |||
'allow_delete' => true, | |||
'by_reference' => false, | |||
]) | |||
->add('projectInspiring', CollectionType::class, [ | |||
'label' => 'form.field.projectinspiring.label', | |||
'translation_domain' => 'frontend', | |||
'entry_type' => ProjectInspiringType::class, | |||
'entry_options' => [ | |||
'context' => $options['context'], | |||
'label' => false, | |||
], | |||
'label' => 'Quelles initiatives que vous avez pû découvrir ailleurs auraient à votre avis toute leur place sur votre territoire ?', | |||
'allow_add' => true, | |||
'allow_delete' => true, | |||
'by_reference' => false, |
@@ -13,6 +13,11 @@ | |||
</head> | |||
{% set current_path = app.request.get('_route') %} | |||
<body id="{{ current_path }}"> | |||
{% for message in app.flashes('success') %} | |||
<div class="alert alert-success"> | |||
{{ message }} | |||
</div> | |||
{% endfor %} | |||
{% block header %} | |||
{% include 'frontend/header.html.twig' %} | |||
{% endblock %} |
@@ -48,6 +48,7 @@ | |||
<div class="col-12"> | |||
<h1 class="title-form">Formulaire de contribution individuel</h1> | |||
{{ form_start(form) }} | |||
{% form_theme form '@LcSov/adminlte/crud/form_theme.html.twig' %} | |||
<div class="row"> | |||
<div class="col-12"> | |||
@@ -56,7 +57,6 @@ | |||
<div class="col-12"> | |||
<ul class="list-territory"> | |||
{% for field in form.territory.children %} | |||
{# {{ dump(form.territory) }} #} | |||
<li> | |||
{{ form_widget(field) }} | |||
{{ form_label(field) }} |
@@ -71,12 +71,16 @@ form: | |||
dream: | |||
description: Description | |||
thematic: Thématique | |||
subthematic: Sous-thème | |||
projectBoost: | |||
description: Description | |||
thematic: Thématique | |||
subthematic: Sous-thème | |||
projectinspiring: | |||
description: Description | |||
thematic: Thématique | |||
subthematic: Sous-thème | |||
revolt: | |||
description: Description | |||
thematic: Thématique | |||
thematic: Thématique | |||
subthematic: Sous-thème |
@@ -0,0 +1,20 @@ | |||
form: | |||
field: | |||
territory: | |||
label: Je suis un.e citoyen.ne du | |||
revolt: | |||
label: Qu’est ce qui vous révolte sur votre territoire ? | |||
description: Description | |||
thematic: Thématique | |||
dream: | |||
label: Quel est votre ou vos rêves pour votre territoire ? | |||
description: Description | |||
thematic: Thématique | |||
projectBoost: | |||
label: Quelles initiatives locales meriteraient à votre avis d’être davantage soutenues ? | |||
description: Description | |||
thematic: Thématique | |||
projectinspiring: | |||
label: Quelles initiatives que vous avez pû découvrir ailleurs auraient à votre avis toute leur place sur votre territoire ? | |||
description: Description | |||
thematic: Thématique |