dev-master
9999999-dev http://bros.landThe implementation of Bootstrap modals for Nette framework.
MIT
The Requires
- php >= 5.6
- nette/application ^2.4
- nette/di ^2.4
- nette/utils ^2.4
by Martin Bros
bootstrap nette brosland modals
The implementation of Bootstrap modals for Nette framework.
This package provides a simple management of modals for Nette framework (e.g. Bootstrap modals)., (*1)
List of components: - Modal - abstract class for a modal - ConfirmationModal - simple modal for a confirmation, (*2)
The best way to install is using Composer:, (*3)
$ composer require brosland/modals
1. (optional) Register DI extension ModalsExtension
in your neon config.
This step you can skip if you use Bootstrap 4., (*4)
brosland.modals: version: 'v5' extensions: brosland.modals: Brosland\Modals\DI\ModalsExtension
2. Setup ModalManager
: the best practice is to do it in your base presenter.
- add ModalManagerTrait
- implement interface ModalManager
- add update of modal into the method beforeRender
, (*5)
use Brosland\Modals\UI\ModalManager; use Brosland\Modals\UI\ModalManagerTrait; use Nette\Application\UI\Presenter; abstract class BasePresenter extends Presenter implements ModalManager { use ModalManagerTrait; protected function beforeRender(): void { parent::beforeRender(); $this->updateModal(); } // ...
3. Add placeholder for a modal to your base layout, (*6)
{snippet modal}{ifset $modal}{control $modal}{/ifset}{/snippet}
4. Install Webpack and Naja., (*7)
5. Copy src/Brosland/Modals/UI/Modal.js
to your directory with Javascript files and register it in Naja
., (*8)
6. Don't forget to rebuild Webpack bundles., (*9)
The implementation of Bootstrap modals for Nette framework.
MIT
bootstrap nette brosland modals