The preferred way to install this extension is through composer.
Either run
$ php composer.phar require --prefer-dist simialbi/yii2-kanban
or add
"simialbi/yii2-kanban": "^2.0.0"
to the require
section of your composer.json
.
In order to use this module, you will need to:
Configure the module in the modules section of your Yii configuration file.
'modules' => [
'kanban' => [
'class' => 'simialbi\yii2\kanban\Module',
//'statuses' => [],
//'statusColors' => [],
//'on boardCreated' => function ($event) {},
//[...]
]
]
Parameter | Description |
---|---|
statuses |
Define your own task statuses. |
statusColors |
Add your own color for each status. Be sure to define a color for each status if you override colors or define your own statuses. |
Notice: The Statuses
Task::STATUS_NOT_BEGUN
,Task::STATUS_DONE
andTASK::STATUS_LATE
will automatically be defined if you do not define them.
Event | Description |
---|---|
EVENT_BOARD_CREATED |
Will be triggered after a new board was created. |
EVENT_BUCKET_CREATED |
Will be triggered after a new bucket was created in any board. |
EVENT_TASK_CREATED |
Will be triggered after a task was created in any bucket. |
EVENT_TASK_ASSIGNED |
Will be triggered after a task got assigned to a user. |
EVENT_TASK_UNASSIGNED |
Will be triggered after an assignment from a task to a user got revoked. |
EVENT_TASK_STATUS_CHANGED |
Will be triggered after a tasks status changed. |
EVENT_TASK_COMPLETED |
Will be triggered after a tasks status changed to Task::STATUS_DONE . |
EVENT_CHECKLIST_CREATED |
Will be triggered after a task got one or more new checklist elements. |
EVENT_COMMENT_CREATED |
Will be triggered after a task got a new comment. |
EVENT_ATTACHMENT_ADDED |
Will be triggered after a task got one or more new attachments. |
Apply the migrations either with the following command: yii migrate --migration-namespaces='simialbi\yii2\kanban\migrations'
or configure your console like this:
[
'controllerMap' => [
'migrate' => [
'class' => 'yii\console\controllers\MigrateController',
'migrationNamespaces' => [
'simialbi\yii2\kanban\migrations'
]
]
]
]
and apply the yii migrate
command.
Create an identity class which implements simialbi\yii2\models\UserInterface
e.g.:
<?php
use yii\db\ActiveRecord;
use simialbi\yii2\models\UserInterface;
class User extends ActiveRecord implements UserInterface
{
/**
* {@inheritDoc}
*/
public static function tableName()
{
return 'user';
}
/**
* {@inheritDoc}
*/
public static function findIdentity($id)
{
return static::findOne($id);
}
/**
* {@inheritDoc}
*/
public static function findIdentityByAccessToken($token, $type = null)
{
return static::findOne(['access_token' => $token]);
}
/**
* {@inheritDoc}
*/
public function getId()
{
return $this->id;
}
/**
* {@inheritDoc}
*/
public function getAuthKey()
{
return $this->auth_key;
}
/**
* {@inheritDoc}
*/
public function validateAuthKey($authKey)
{
return $this->getAuthKey() === $authKey;
}
/**
* {@inheritDoc}
*/
public function getImage() {
return $this->image;
}
/**
* {@inheritDoc}
*/
public function getName() {
return trim($this->first_name . ' ' . $this->last_name);
}
/**
* {@inheritDoc}
*/
public function getEmail() {
return $this->email;
}
/**
* {@inheritDoc}
*/
public function getMobile() {
return $this->mobile;
}
/**
* {@inheritDoc}
*/
public static function findIdentities() {
return static::find()->all();
}
}
After creating this class define it as identity class in your application configuration:
'components' => [
'user' => [
'identityClass' => 'app\models\User'
]
]
If you don't use jQuery UI somewhere else in your application, you can minify the load by just load the needed scripts:
'components' => [
'assetManager' => [
'bundles' => [
'yii\jui\JuiAsset' => [
'css' => [],
'js' => [
'ui/data.js',
'ui/scroll-parent.js',
'ui/widget.js',
'ui/widgets/mouse.js',
'ui/widgets/sortable.js',
],
'publishOptions' => [
'only' => [
'ui/*',
'ui/widgets/*'
]
]
]
]
]
]
Notice: If you use the full jquery ui package, the bootstrap tooltip used by this module gets overridden by jui tooltip
Now you can access the kanban module by navigating to /kanban
.
Notice: Some of the actions can only be done as authenticated (logged in) user like creating boards, buckets etc.
yii2-kanban is released under MIT license. See bundled LICENSE for details.