Przeglądaj źródła

Correctif backoffice

master
Fab 4 lat temu
rodzic
commit
9fc6c71f97
3 zmienionych plików z 7 dodań i 9 usunięć
  1. +1
    -1
      ShopBundle/Controller/Admin/AdminController.php
  2. +5
    -5
      ShopBundle/Model/SortableTrait.php
  3. +1
    -3
      ShopBundle/Resources/public/js/backend/script/default/init-sort.js

+ 1
- 1
ShopBundle/Controller/Admin/AdminController.php Wyświetl plik

@@ -186,7 +186,7 @@ class AdminController extends EasyAdminController

$fields = $this->entity['list']['fields'];
$paginator = $this->findAll($this->entity['class'], $this->request->query->get('page', 1), 500, $this->request->query->get('sortField'), $this->request->query->get('sortDirection'), $this->entity['list']['dql_filter']);
dump($paginator->getCurrentPageResults());
$this->dispatch(EasyAdminEvents::POST_LIST, ['paginator' => $paginator]);

$positionForm = $this->createFormBuilder(array('entities', $paginator->getCurrentPageResults()))

+ 5
- 5
ShopBundle/Model/SortableTrait.php Wyświetl plik

@@ -10,23 +10,23 @@ trait SortableTrait
{
/**
* @var string
* @ORM\Column(type="integer")
* @ORM\Column(type="float")
*/
protected $position = 0;

/**
* @return int
* @return float
*/
public function getPosition(): int
public function getPosition(): float
{
return $this->position;
}

/**
* @param int $position
* @param float $position
* @return $this
*/
public function setPosition(int $position): self
public function setPosition(float $position): self
{
$this->position = $position;
return $this;

+ 1
- 3
ShopBundle/Resources/public/js/backend/script/default/init-sort.js Wyświetl plik

@@ -22,11 +22,9 @@ 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
if ($('.lc-sortable').data('parent-position') !== '') val = $('.lc-sortable').data('parent-position') + '.' + index
else val = index;

log($(li).find('#form_entities_' + index + '_position'));

$(li).find('#form_entities_' + index + '_position').val(val);
});


Ładowanie…
Anuluj
Zapisz