kollarovic/admin

Admin template for Nette

4.0.1 2023-11-22 10:32 UTC

This package is auto-updated.

Last update: 2024-11-22 13:33:45 UTC


README

Admin

Alt text

Login

Alt text

Live Demo

Live Demo

Github Demo

Installation

composer.json

{
    "require":{
        "kollarovic/admin": "dev-master"
    }
}

config.neon

extensions:
  navigation: Kollarovic\Navigation\DI\Extension
  admin: Kollarovic\Admin\DI\Extension
  

Admin

BasePresenter

namespace App\BackendModule\Presenters;

use Nette\Application\UI\Presenter;
use Kollarovic\Admin\IAdminControlFactory;


abstract class BasePresenter extends Presenter
{

    /** @var IAdminControlFactory @inject */
    public $adminControlFactory;

    protected function createComponentAdminControl()
    {
        $adminControl = $this->adminControlFactory->create();
        return $adminControl;
    }

}

@layout.latte

{capture $content}
  {include content}
{/capture}

{control adminControl content=>$content}

Login

SignPresenter

namespace App\BackendModule\Presenters;

use Kollarovic\Admin\ILoginControlFactory;
use Nette\Application\UI\Presenter;


class SignPresenter extends Presenter
{

    /** @var  ILoginControlFactory @inject */
    public $loginControlFactory;


    protected function createComponentLoginControl()
    {
        $loginControl = $this->loginControlFactory->create();
        $loginControl->onLoggedIn[] = function() {
            $this->redirect('Homepage:default');
        };
        return $loginControl;
    }

}

in.latte

{control loginControl}