2017 © Pedro Peláez
 

symfony-bundle admin-positionable-bundle

FSi admin positionable bundle.

image

fsi/admin-positionable-bundle

FSi admin positionable bundle.

  • Thursday, June 28, 2018
  • by chives
  • Repository
  • 5 Watchers
  • 1 Stars
  • 7,023 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 7 Forks
  • 1 Open issues
  • 9 Versions
  • 1 % Grown

The README.md

FSiAdminPositionableBundle

This bundle provides way to change position of item on the list gradually. This mean that position will be changed by 1., (*1)

FSiAdminPositionableBundle works with conjunction with Sortable behavior extension for Doctrine2, (*2)

Usage

Add to AppKernel.php:, (*3)

new FSi\Bundle\AdminPositionableBundle\FSiAdminPositionableBundle(),

Add routes to /app/config/routing.yml:, (*4)

_fsi_positionable:
    resource: "@FSiAdminPositionableBundle/Resources/config/routing/positionable.xml"
    prefix:   /admin

Sample entity:, (*5)

Note: @Gedmo\Mapping\Annotation\SortablePosition points column to store position index, (*6)

use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
use FSi\Bundle\AdminPositionableBundle\Model\PositionableInterface;

class Promotion implements PositionableInterface
{
    /**
     * @Gedmo\SortablePosition
     * @ORM\Column(type="integer")
     */
    protected $position;

    /**
     * {@inheritdoc}
     */
    public function increasePosition()
    {
        $this->position++;
    }

    /**
     * {@inheritdoc}
     */
    public function decreasePosition()
    {
        $this->position--;
    }
}

Note: that PositionableInterface implementation is required, (*7)

Sample datagrid definition:, (*8)

columns:
  title:
    type: text
    options:
      display_order: 1
      label: "backend.promotions.datagrid.title.label"
  actions:
    type: action
    options:
      display_order: 2
      label: "backend.promotions.datagrid.actions.label"
      field_mapping: [ id ]
      actions:
        move_up:
          route_name: "fsi_admin_positionable_decrease_position"
          additional_parameters: { element: "promotions" }
          parameters_field_mapping: { id: id }
          content: <span class="glyphicon glyphicon-arrow-up icon-white"></span>
          url_attr: { class: "btn btn-warning btn-sm" }
        move_down:
          route_name: "fsi_admin_positionable_increase_position"
          additional_parameters: { element: "promotions" }
          parameters_field_mapping: { id: id }
          content: <span class="glyphicon glyphicon-arrow-down icon-white"></span>
          url_attr: { class: "btn btn-warning btn-sm" }

The Versions

10/01 2018

1.1.x-dev

1.1.9999999.9999999-dev

FSi admin positionable bundle.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Artur Czocher
by Piotr Kapera

symfony2 bundle symfony3 symfony admin fsi position positionable

10/01 2018

v1.1.1

1.1.1.0

FSi admin positionable bundle.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Artur Czocher
by Piotr Kapera

symfony2 bundle symfony3 symfony admin fsi position positionable

10/01 2018

v1.1.0

1.1.0.0

FSi admin positionable bundle.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Artur Czocher
by Piotr Kapera

symfony2 bundle symfony3 symfony admin fsi position positionable

23/02 2015

1.0.0

1.0.0.0

FSi admin positionable bundle.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Artur Czocher
by Piotr Kapera

symfony2 bundle admin position positionable

23/02 2015

1.0.x-dev

1.0.9999999.9999999-dev

FSi admin positionable bundle.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Artur Czocher
by Piotr Kapera

symfony2 bundle admin position positionable

23/02 2015

v1.0.0

1.0.0.0

FSi admin positionable bundle.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Artur Czocher
by Piotr Kapera

symfony2 bundle admin position positionable