Procházet zdrojové kódy

Tri catégories bug

master
Fab před 4 roky
rodič
revize
f4f380106e
2 změnil soubory, kde provedl 10 přidání a 4 odebrání
  1. +2
    -1
      ShopBundle/Controller/Backend/AdminController.php
  2. +8
    -3
      ShopBundle/Resources/public/js/backend/script/default/init-sort.js

+ 2
- 1
ShopBundle/Controller/Backend/AdminController.php Zobrazit soubor

@@ -344,13 +344,14 @@ class AdminController extends EasyAdminController
foreach ($positionForm->get('entities')->getData() as $elm) {
$this->dispatch(EasyAdminEvents::PRE_UPDATE, ['entity' => $entity]);
$entity = $repo->find($elm['id']);

$entity->setPosition($elm['position']);
$this->em->persist($entity);
$this->dispatch(EasyAdminEvents::POST_UPDATE, ['entity' => $entity]);
$latsPos = $elm['position'];

}

//die();
//die();
//to do récupérer les élements hors ligne et incrémenter position
/*foreach ($repo->findBy(array('status'=> false)) as $offlineEntity) {

+ 8
- 3
ShopBundle/Resources/public/js/backend/script/default/init-sort.js Zobrazit soubor

@@ -14,6 +14,7 @@ function initLcSortableList() {
prototype = $('#form_entities').data('prototype');

$('.lc-sortable tr.lc-draggable').each(function (index, li) {

// instead be a number based on how many items we have
var newForm = prototype.replace(/__name__/g, index);

@@ -22,9 +23,13 @@ function initLcSortableList() {

$(li).append(newForm);
$(li).find('#form_entities_' + index + '_id').val($(li).data('id'));
if ($('.lc-sortable').data('parent-position') !== '') val = $('.lc-sortable').data('parent-position') + '.' + index
else val = index;

if ($('.lc-sortable').data('parent-position') !== '') {
//Ajout d'un 0 initial pour les nuémros <10
indexAsString = index.toString().padStart(2, '0');
val = $('.lc-sortable').data('parent-position') + '.' + indexAsString
} else {
val = index;
}
$(li).find('#form_entities_' + index + '_position').val(val);
});


Načítá se…
Zrušit
Uložit