mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-20 14:43:49 +00:00
fix conflict in CHANGELOG
This commit is contained in:
@@ -107,6 +107,9 @@ class ChillMainExtension extends Extension implements PrependExtensionInterface,
|
||||
$container->setParameter('chill_main.available_languages',
|
||||
$config['available_languages']);
|
||||
|
||||
$container->setParameter('chill_main.available_countries',
|
||||
$config['available_countries']);
|
||||
|
||||
$container->setParameter('chill_main.routing.resources',
|
||||
$config['routing']['resources']);
|
||||
|
||||
|
@@ -51,6 +51,10 @@ class Configuration implements ConfigurationInterface
|
||||
->defaultValue(array('fr'))
|
||||
->prototype('scalar')->end()
|
||||
->end() // end of array 'available_languages'
|
||||
->arrayNode('available_countries')
|
||||
->defaultValue(array('FR'))
|
||||
->prototype('scalar')->end()
|
||||
->end() // end of array 'available_countries'
|
||||
->arrayNode('routing')
|
||||
->children()
|
||||
->arrayNode('resources')
|
||||
|
@@ -54,7 +54,7 @@ class CommentType extends AbstractType
|
||||
$data = $event->getForm()->getData();
|
||||
$comment = $event->getData() ?? ['comment' => ''];
|
||||
|
||||
if ($data->getComment() !== $comment['comment']) {
|
||||
if (null !== $data && $data->getComment() !== $comment['comment']) {
|
||||
$data->setDate(new \DateTime());
|
||||
$data->setUserId($this->user->getId());
|
||||
$event->getForm()->setData($data);
|
||||
|
@@ -28,6 +28,7 @@ use Chill\MainBundle\Form\Type\DataTransformer\ObjectToIdTransformer;
|
||||
use Doctrine\Persistence\ObjectManager;
|
||||
use Chill\MainBundle\Form\Type\Select2ChoiceType;
|
||||
use Chill\MainBundle\Templating\TranslatableStringHelper;
|
||||
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
|
||||
|
||||
/**
|
||||
* Extends choice to allow adding select2 library on widget
|
||||
@@ -37,31 +38,25 @@ use Chill\MainBundle\Templating\TranslatableStringHelper;
|
||||
*/
|
||||
class Select2CountryType extends AbstractType
|
||||
{
|
||||
/**
|
||||
* @var RequestStack
|
||||
*/
|
||||
private $requestStack;
|
||||
private RequestStack $requestStack;
|
||||
|
||||
/**
|
||||
*
|
||||
* @var TranslatableStringHelper
|
||||
*/
|
||||
protected $translatableStringHelper;
|
||||
private ObjectManager $em;
|
||||
|
||||
/**
|
||||
* @var ObjectManager
|
||||
*/
|
||||
private $em;
|
||||
protected TranslatableStringHelper $translatableStringHelper;
|
||||
|
||||
protected ParameterBagInterface $parameterBag;
|
||||
|
||||
public function __construct(
|
||||
RequestStack $requestStack,
|
||||
ObjectManager $em,
|
||||
TranslatableStringHelper $translatableStringHelper
|
||||
TranslatableStringHelper $translatableStringHelper,
|
||||
ParameterBagInterface $parameterBag
|
||||
)
|
||||
{
|
||||
$this->requestStack = $requestStack;
|
||||
$this->em = $em;
|
||||
$this->translatableStringHelper = $translatableStringHelper;
|
||||
$this->parameterBag = $parameterBag;
|
||||
}
|
||||
|
||||
public function getBlockPrefix()
|
||||
@@ -82,19 +77,29 @@ class Select2CountryType extends AbstractType
|
||||
|
||||
public function configureOptions(OptionsResolver $resolver)
|
||||
{
|
||||
$locale = $this->requestStack->getCurrentRequest()->getLocale();
|
||||
$countries = $this->em->getRepository('Chill\MainBundle\Entity\Country')->findAll();
|
||||
$choices = array();
|
||||
$choices = [];
|
||||
$preferredCountries = $this->parameterBag->get('chill_main.available_countries');
|
||||
$preferredChoices = [];
|
||||
|
||||
foreach ($countries as $c) {
|
||||
$choices[$c->getId()] = $this->translatableStringHelper->localize($c->getName());
|
||||
}
|
||||
|
||||
foreach ($preferredCountries as $pc) {
|
||||
foreach ($countries as $c) {
|
||||
if ($c->getCountryCode() == $pc) {
|
||||
$preferredChoices[$c->getId()] = $this->translatableStringHelper->localize($c->getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
asort($choices, SORT_STRING | SORT_FLAG_CASE);
|
||||
|
||||
$resolver->setDefaults(array(
|
||||
'class' => 'Chill\MainBundle\Entity\Country',
|
||||
'choices' => array_combine(array_values($choices),array_keys($choices))
|
||||
'choices' => array_combine(array_values($choices),array_keys($choices)),
|
||||
'preferred_choices' => array_combine(array_values($preferredChoices), array_keys($preferredChoices))
|
||||
));
|
||||
}
|
||||
}
|
||||
|
@@ -28,37 +28,32 @@ use Chill\MainBundle\Form\Type\DataTransformer\MultipleObjectsToIdTransformer;
|
||||
use Doctrine\Persistence\ObjectManager;
|
||||
use Chill\MainBundle\Form\Type\Select2ChoiceType;
|
||||
use Chill\MainBundle\Templating\TranslatableStringHelper;
|
||||
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
|
||||
|
||||
/**
|
||||
* Extends choice to allow adding select2 library on widget for languages (multiple)
|
||||
*/
|
||||
class Select2LanguageType extends AbstractType
|
||||
{
|
||||
/**
|
||||
* @var RequestStack
|
||||
*/
|
||||
private $requestStack;
|
||||
private RequestStack $requestStack;
|
||||
|
||||
/**
|
||||
* @var ObjectManager
|
||||
*/
|
||||
private $em;
|
||||
private ObjectManager $em;
|
||||
|
||||
/**
|
||||
*
|
||||
* @var TranslatableStringHelper
|
||||
*/
|
||||
protected $translatableStringHelper;
|
||||
protected TranslatableStringHelper $translatableStringHelper;
|
||||
|
||||
protected ParameterBagInterface $parameterBag;
|
||||
|
||||
public function __construct(
|
||||
RequestStack $requestStack,
|
||||
ObjectManager $em,
|
||||
TranslatableStringHelper $translatableStringHelper
|
||||
TranslatableStringHelper $translatableStringHelper,
|
||||
ParameterBagInterface $parameterBag
|
||||
)
|
||||
{
|
||||
$this->requestStack = $requestStack;
|
||||
$this->em = $em;
|
||||
$this->translatableStringHelper = $translatableStringHelper;
|
||||
$this->parameterBag = $parameterBag;
|
||||
}
|
||||
|
||||
public function getBlockPrefix()
|
||||
@@ -79,19 +74,24 @@ class Select2LanguageType extends AbstractType
|
||||
|
||||
public function configureOptions(OptionsResolver $resolver)
|
||||
{
|
||||
$locale = $this->requestStack->getCurrentRequest()->getLocale();
|
||||
$languages = $this->em->getRepository('Chill\MainBundle\Entity\Language')->findAll();
|
||||
$choices = array();
|
||||
$preferredLanguages = $this->parameterBag->get('chill_main.available_languages');
|
||||
$choices = [];
|
||||
$preferredChoices = [];
|
||||
|
||||
foreach ($languages as $l) {
|
||||
$choices[$l->getId()] = $this->translatableStringHelper->localize($l->getName());
|
||||
}
|
||||
foreach ($preferredLanguages as $l) {
|
||||
$preferredChoices[$l] = $choices[$l];
|
||||
}
|
||||
|
||||
asort($choices, SORT_STRING | SORT_FLAG_CASE);
|
||||
|
||||
$resolver->setDefaults(array(
|
||||
'class' => 'Chill\MainBundle\Entity\Language',
|
||||
'choices' => array_combine(array_values($choices),array_keys($choices))
|
||||
'choices' => array_combine(array_values($choices), array_keys($choices)),
|
||||
'preferred_choices' => array_combine(array_values($preferredChoices), array_keys($preferredChoices))
|
||||
));
|
||||
}
|
||||
}
|
||||
|
@@ -1 +1,5 @@
|
||||
require("./show_hide.js");
|
||||
//require("./show_hide.js");
|
||||
|
||||
import { ShowHide } from './show_hide.js'
|
||||
|
||||
export { ShowHide }
|
@@ -134,4 +134,4 @@ var ShowHide = function(options) {
|
||||
};
|
||||
};
|
||||
|
||||
export {ShowHide};
|
||||
export { ShowHide };
|
||||
|
@@ -5,82 +5,89 @@ import App from './App.vue';
|
||||
|
||||
const i18n = _createI18n(addressMessages);
|
||||
|
||||
let inputs = document.querySelectorAll('input[type="hidden"][data-input-address]');
|
||||
const addAddressInput = (inputs) => {
|
||||
|
||||
const isNumeric = function(v) { return !isNaN(v); };
|
||||
inputs.forEach(el => {
|
||||
let
|
||||
addressId = el.value,
|
||||
uniqid = el.dataset.inputAddress,
|
||||
container = document.querySelector('div[data-input-address-container="' + uniqid + '"]'),
|
||||
isEdit = addressId !== '',
|
||||
addressIdInt = addressId !== '' ? parseInt(addressId) : null
|
||||
;
|
||||
|
||||
inputs.forEach(el => {
|
||||
let
|
||||
addressId = el.value,
|
||||
uniqid = el.dataset.inputAddress,
|
||||
container = document.querySelector('div[data-input-address-container="' + uniqid + '"]'),
|
||||
isEdit = addressId !== '',
|
||||
addressIdInt = addressId !== '' ? parseInt(addressId) : null
|
||||
;
|
||||
if (container === null) {
|
||||
throw Error("no container");
|
||||
}
|
||||
console.log('useValidFrom', el.dataset.useValidFrom === '1');
|
||||
|
||||
if (container === null) {
|
||||
throw Error("no container");
|
||||
}
|
||||
console.log('useValidFrom', el.dataset.useValidFrom === '1');
|
||||
|
||||
const app = createApp({
|
||||
template: `<app v-bind:addAddress="this.addAddress" @address-created="associateToInput"></app>`,
|
||||
data() {
|
||||
return {
|
||||
addAddress: {
|
||||
context: {
|
||||
// for legacy ? can be remove ?
|
||||
target: {
|
||||
name: 'input-address',
|
||||
id: addressIdInt,
|
||||
},
|
||||
edit: isEdit,
|
||||
addressId: addressIdInt,
|
||||
},
|
||||
options: {
|
||||
/// Options override default.
|
||||
/// null value take default component value defined in AddAddress data()
|
||||
button: {
|
||||
text: {
|
||||
create: el.dataset.buttonTextCreate || null,
|
||||
edit: el.dataset.buttonTextUpdate || null,
|
||||
const app = createApp({
|
||||
template: `<app v-bind:addAddress="this.addAddress" @address-created="associateToInput"></app>`,
|
||||
data() {
|
||||
return {
|
||||
addAddress: {
|
||||
context: {
|
||||
// for legacy ? can be remove ?
|
||||
target: {
|
||||
name: 'input-address',
|
||||
id: addressIdInt,
|
||||
},
|
||||
size: null,
|
||||
displayText: true
|
||||
edit: isEdit,
|
||||
addressId: addressIdInt,
|
||||
},
|
||||
options: {
|
||||
/// Options override default.
|
||||
/// null value take default component value defined in AddAddress data()
|
||||
button: {
|
||||
text: {
|
||||
create: el.dataset.buttonTextCreate || null,
|
||||
edit: el.dataset.buttonTextUpdate || null,
|
||||
},
|
||||
size: null,
|
||||
displayText: true
|
||||
},
|
||||
|
||||
/// Modal title text if create or edit address (trans chain, see i18n)
|
||||
title: {
|
||||
create: null,
|
||||
edit: null,
|
||||
},
|
||||
/// Modal title text if create or edit address (trans chain, see i18n)
|
||||
title: {
|
||||
create: null,
|
||||
edit: null,
|
||||
},
|
||||
|
||||
/// Display panes in Modal for step123
|
||||
openPanesInModal: true,
|
||||
/// Display panes in Modal for step123
|
||||
openPanesInModal: true,
|
||||
|
||||
/// Display actions buttons of panes in a sticky-form-button navbar
|
||||
stickyActions: false,
|
||||
showMessageWhenNoAddress: true,
|
||||
/// Display actions buttons of panes in a sticky-form-button navbar
|
||||
stickyActions: false,
|
||||
showMessageWhenNoAddress: true,
|
||||
|
||||
/// Use Date fields
|
||||
useDate: {
|
||||
validFrom: el.dataset.useValidFrom === '1' || false, //boolean, default: false
|
||||
validTo: el.dataset.useValidTo === '1' || false, //boolean, default: false
|
||||
},
|
||||
/// Use Date fields
|
||||
useDate: {
|
||||
validFrom: el.dataset.useValidFrom === '1' || false, //boolean, default: false
|
||||
validTo: el.dataset.useValidTo === '1' || false, //boolean, default: false
|
||||
},
|
||||
|
||||
/// Don't display show renderbox Address: showPane display only a button
|
||||
onlyButton: false,
|
||||
/// Don't display show renderbox Address: showPane display only a button
|
||||
onlyButton: false,
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
associateToInput(payload) {
|
||||
el.value = payload.addressId;
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
associateToInput(payload) {
|
||||
el.value = payload.addressId;
|
||||
}
|
||||
}
|
||||
})
|
||||
.use(i18n)
|
||||
.component('app', App)
|
||||
.mount(container);
|
||||
});
|
||||
})
|
||||
.use(i18n)
|
||||
.component('app', App)
|
||||
.mount(container);
|
||||
});
|
||||
};
|
||||
|
||||
document.addEventListener('DOMContentLoaded', (_e) =>
|
||||
addAddressInput(document.querySelectorAll('input[type="hidden"][data-input-address]'))
|
||||
);
|
||||
|
||||
window.addEventListener('collection-add-entry', (e) =>
|
||||
addAddressInput(e.detail.entry.querySelectorAll('input[type="hidden"][data-input-address]'))
|
||||
);
|
@@ -39,3 +39,4 @@ assetic:
|
||||
|
||||
chill_main:
|
||||
available_languages: [fr, en]
|
||||
available_countries: [FR]
|
||||
|
@@ -25,6 +25,7 @@ services:
|
||||
- "@request_stack"
|
||||
- "@doctrine.orm.entity_manager"
|
||||
- "@chill.main.helper.translatable_string"
|
||||
- '@Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface'
|
||||
tags:
|
||||
- { name: form.type, alias: select2_chill_country }
|
||||
|
||||
@@ -34,6 +35,7 @@ services:
|
||||
- "@request_stack"
|
||||
- "@doctrine.orm.entity_manager"
|
||||
- "@chill.main.helper.translatable_string"
|
||||
- '@Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface'
|
||||
tags:
|
||||
- { name: form.type, alias: select2_chill_language }
|
||||
|
||||
|
Reference in New Issue
Block a user