Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/voskobovich/yii2-tree-manager
https://github.com/voskobovich/yii2-tree-manager
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/voskobovich/yii2-tree-manager
- Owner: voskobovich
- License: mit
- Created: 2015-12-21T10:57:17.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2018-12-17T10:14:18.000Z (about 6 years ago)
- Last Synced: 2024-09-28T14:04:30.743Z (4 months ago)
- Language: PHP
- Size: 25.4 KB
- Stars: 25
- Watchers: 10
- Forks: 20
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Tree Manager for Yii2
Виджет для управления деревом.
Внимание!
-----
Виджет рассчитан на работу с поведениями Павла Зимакова:[Yii2 Adjacency List Behavior](https://github.com/paulzi/yii2-adjacency-list)
[Yii2 Nested Sets Behavior](https://github.com/paulzi/yii2-nested-sets)
[Yii2 Nested Intervals Behavior](https://github.com/paulzi/yii2-nested-intervals)
[Yii2 Materialized Path Behavior](https://github.com/paulzi/yii2-materialized-path)Отличная статья на [Хабре](http://habrahabr.ru/post/266155/).
Installation
-------------The preferred way to install this extension is through [composer](http://getcomposer.org/download/).
Either run
```
php composer.phar require --prefer-dist voskobovich/yii2-tree-manager "~1.0"
```or add
```
"voskobovich/yii2-tree-manager": "~1.0"
```to the require section of your `composer.json` file.
Usage
-----
1. Подключите к вашей модели любое из указанных выше поведений
2. Подключите в контроллер дополнительные actions```
public function actions()
{
$modelClass = 'namespace\ModelName';return [
'moveNode' => [
'class' => 'voskobovich\tree\manager\actions\MoveNodeAction',
'modelClass' => $modelClass,
],
'deleteNode' => [
'class' => 'voskobovich\tree\manager\actions\DeleteNodeAction',
'modelClass' => $modelClass,
],
'updateNode' => [
'class' => 'voskobovich\tree\manager\actions\UpdateNodeAction',
'modelClass' => $modelClass,
],
'createNode' => [
'class' => 'voskobovich\tree\manager\actions\CreateNodeAction',
'modelClass' => $modelClass,
],
];
}
```3. Выведите виджет в удобном месте
```
use \voskobovich\tree\manager\widgets\nestable\Nestable;= Nestable::widget([
'modelClass' => 'models\ModelName',
]) ?>
```Пример того, как выглядит виджет:
-------------![Screenshot](http://s019.radikal.ru/i644/1708/64/5f8e8e986d3c.png)