Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Customizable items per page pagination in admin interface #104

Open
damarev opened this issue Mar 14, 2021 · 2 comments
Open

Customizable items per page pagination in admin interface #104

damarev opened this issue Mar 14, 2021 · 2 comments
Assignees

Comments

@damarev
Copy link
Contributor

damarev commented Mar 14, 2021

Currently items per page pagination in admin interface is harcoded in controllers to 100 items per page (ChannelController, OrderController, ProductController and PropertyController), which seems a little bit too much.

It would be nice to have this value configurable, I see two possible approches:

Option 1. Via a config setting in config/concord.php, like:

return [
    'modules' => [
        Vanilo\Framework\Providers\ModuleServiceProvider::class => [
            'pagination' => [
                'order' => 25,
            ],
        ],
    ]
];

and then in src/Http/Controllers/OrderController.php

return view('vanilo::order.index', [
    'orders' => $query->paginate(config('vanilo.framework.pagination.order',100)),
    'inactives' => $inactives,
]);

Option 2. Or maybe a simpler and global solution would be to just use the default eloquent pagination of 15 items:

return view('vanilo::order.index', [
    'orders' => $query->paginate(),
    'inactives' => $inactives,
]);

And override this seeting via custom model as described in documentation:

namespace App;

use Vanilo\Framework\Models\Order as BaseOrder;

class Order extends BaseOrder 
{
    protected $perPage = 25;
}

How does that sound?

@fulopattila122
Copy link
Member

Hey, sorry for the slow reaction. Yep, it completely makes sense.

The only reason why I'm reluctant to add it (to the framework) is that most people want to use the framework without the admin.
So it'll be decoupled soon, in a backward-compatible manner.

The effect of the decoupling to this particular initiative is solely naming, the config will be vanilo.admin instead of vanilo.framework.

@davidkvasnovsky
Copy link

Hey, sorry for the slow reaction. Yep, it completely makes sense.

The only reason why I'm reluctant to add it (to the framework) is that most people want to use the framework without the admin.
So it'll be decoupled soon, in a backward-compatible manner.

The effect of the decoupling to this particular initiative is solely naming, the config will be vanilo.admin instead of vanilo.framework.

Hey!

according to roadmap (https://vanilo.io/docs/2.x/roadmap), when do you plan to decouple framework and admin?

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants