2017 © Pedro Peláez
 

symfony-bundle list-manager-bundle

Symfony Searchable Paginated Ordered List Twig Extension Bundle

image

tangoman/list-manager-bundle

Symfony Searchable Paginated Ordered List Twig Extension Bundle

  • Thursday, September 21, 2017
  • by Tangoman
  • Repository
  • 0 Watchers
  • 0 Stars
  • 33 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 7 Versions
  • 0 % Grown

The README.md

TangoMan List Manager

TangoMan List Manager provides an easy way to manage searchable, ordered, paginated lists in your app. TangoMan List Manager makes building back-office for your app a brease., (*1)

Installation

Step 1: Download the Bundle

Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:, (*2)

$ composer require tangoman/list-manager-bundle

This command requires you to have Composer installed globally, as explained in the installation chapter of the Composer documentation., (*3)

Step 2: Enable the Bundle

Then, enable the bundle by adding it to the list of registered bundles in the app/AppKernel.php file of your project:, (*4)

<?php
// app/AppKernel.php

// ...
class AppKernel extends Kernel
{
    // ...

    public function registerBundles()
    {
        $bundles = array(
            // ...
            new TangoMan\ListManagerBundle\TangoManListManagerBundle(),
        );

        // ...
    }
}

Step 3: Place use statement in the controller

use TangoMan\ListManagerBundle\Model\SearchForm;
use TangoMan\ListManagerBundle\Model\SearchInput;
use TangoMan\ListManagerBundle\Model\SearchOption;
use TangoMan\ListManagerBundle\Model\Thead;
use TangoMan\ListManagerBundle\Model\Item;

Step 4: Build object in the controller

<?php
// AppBundle/Controller/DefaultController.php
namespace AppBundle\Controller;

// ...

class DefaultController extends Controller
{
    /**
     * @Route("/user/index")
     */
    public function indexAction()
    {
        // ...

        $form = new SearchForm();

        // Number
        $input = new SearchInput();
        $input->setLabel('Id')
            ->setName('e-id')
            ->setType('number');
        $form->addInput($input);

        // Text
        $input = new SearchInput();
        $input->setLabel('User')
            ->setName('user-username');
        $form->addInput($input);

        // Text
        $input = new SearchInput();
        $input->setLabel('Email')
            ->setName('user-email');
        $form->addInput($input);

        // Select
        $input = new SearchInput();
        $input->setLabel('Role')
            ->setName('roles-type');
        $option = new SearchOption();
        $option->setName('All');
        $input->addOption($option);
        $option = new SearchOption();
        $option->setName('Super Admin')
            ->setValue('ROLE_SUPER_ADMIN');
        $input->addOption($option);
        $option = new SearchOption();
        $option->setName('Admin')
            ->setValue('ROLE_ADMIN');
        $input->addOption($option);
        $option = new SearchOption();
        $option->setName('Super Utilisateur')
            ->setValue('ROLE_SUPER_USER');
        $input->addOption($option);
        $option = new SearchOption();
        $option->setName('Utilisateur')
            ->setValue('ROLE_USER');
        $input->addOption($option);
        $form->addInput($input);

        // Submit
        $input = new SearchInput();
        $input->setLabel('Filtrer')
            ->setType('submit')
            ->setIcon('glyphicon glyphicon-search');
        $form->addInput($input);

        // Optionally use json format
        $thead = '{
            "tds": [
                {
                    "name": "username",
                    "label": "User",
                    "route": "app_user_index"
                },
                {
                    "name": "email",
                    "label": "Email",
                    "route": "app_user_index"
                },
                {
                    "label": "Actions",
                    "roles": ["ROLE_ADMIN","ROLE_MANAGER"],
                    "colspan": 2
                }
            ]
        }';

        return $this->render(
            'user/index.html.twig',
            [
                'form' => $form,
                'thead' => $thead,
                'users' => $users,
            ]
        );
    }
}

Step 5: Integrate in Twig

<div id="search-form" class="jumbotron">
    {{ searchForm(form) }}
</div>
<table class="table table-striped">
    {{ thead(thead) }}
    <tbody>
    {% for user in users %}
        <tr>
            <td>
            ...

Common errors

If you get to see this :
![twig error][twig-error] your json probably is invalid., (*5)

Note

If you find any bug please report here : Issues, (*6)

License

Copyrights (c) 2017 Matthias Morin, (*7)

License Distributed under the GPLv3.0 license., (*8)

If you like TangoMan List Manager please star! And follow me on GitHub: TangoMan75 ... And check my other cool projects., (*9)

tangoman.free.fr, (*10)

The Versions

21/09 2017

dev-master

9999999-dev

Symfony Searchable Paginated Ordered List Twig Extension Bundle

  Sources   Download

The Requires

 

by Matthias Morin

service twig extension bootstrap bundle symfony responsive list ordered searchable back office tangoman paginated

21/09 2017

2.1.5

2.1.5.0

Symfony Searchable Paginated Ordered List Twig Extension Bundle

  Sources   Download

The Requires

 

by Matthias Morin

service twig extension bootstrap bundle symfony responsive list ordered searchable back office tangoman paginated

19/09 2017

2.1.3

2.1.3.0

Symfony Searchable Paginated Ordered List Twig Extension Bundle

  Sources   Download

The Requires

 

by Matthias Morin

service twig extension bootstrap bundle symfony responsive list ordered searchable back office tangoman paginated

14/09 2017

2.1.2

2.1.2.0

Symfony Searchable Paginated Ordered List Twig Extension Bundle

  Sources   Download

The Requires

 

by Matthias Morin

service twig extension bootstrap bundle symfony responsive list ordered searchable back office tangoman paginated

14/09 2017

2.1.1

2.1.1.0

Symfony Searchable Paginated Ordered List Twig Extension Bundle

  Sources   Download

The Requires

 

by Matthias Morin

service twig extension bootstrap bundle symfony responsive list ordered searchable back office tangoman paginated

13/09 2017

2.1.0

2.1.0.0

Symfony Searchable Paginated Ordered List Twig Extension Bundle

  Sources   Download

The Requires

 

by Matthias Morin

service twig extension bootstrap bundle symfony responsive list ordered searchable back office tangoman paginated

08/09 2017

1.0.0

1.0.0.0

Symfony Searchable Paginated Ordered List Twig Extension Bundle

  Sources   Download

The Requires

 

by Matthias Morin

service twig extension bootstrap bundle symfony responsive list ordered searchable back office tangoman paginated