yii2tech / admin Goto Github PK
View Code? Open in Web Editor NEWAdmin pack (actions, widgets, etc) for Yii2
License: Other
Admin pack (actions, widgets, etc) for Yii2
License: Other
If model class uses several instances of VariationBehavior
attached VariationCreate
and VariationUpdate
handles only the first one.
There should be ability to handle them all and choose the actual list of variations, which should be handled.
It would be very useful for IDE users if generated views contained corresponding controller actions, like following
<?php
// Corresponding controller and action
/** @see \app\modules\admin\feedback\controllers\DefaultController corresponding controller*/
/** @see \yii2tech\admin\actions\Index corresponding action */
use yii\grid\GridView;
use yii2tech\admin\grid\ActionColumn;
/* @var $this yii\web\View */
/* @var $searchModel app\models\search\FeedbackSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = 'Feedbacks';
$this->params['breadcrumbs'][] = $this->title;
$this->params['contextMenuItems'] = [
['create']
];
?>
<?= GridView::widget([
'dataProvider' => $dataProvider,
'filterModel' => $searchModel,
'columns' => [
['class' => 'yii\grid\SerialColumn'],
'id',
'title',
'phone',
'email:email',
'body:ntext',
[
'class' => ActionColumn::className(),
],
],
]); ?>
It might be too much for some users so this feature could be configurable via checkbox or something like that.
VariationColumn
should provide ability to specify behavior name, which should be used.
This is necessary in case several variation behaviors are attached to the model.
Such actions like 'delete' often requires a flash message being set, indicating action result.
Add RoleCreate
and RoleUpdate
actions for support of https://github.com/yii2tech/ar-role
It is better to extract CrudController::accessRules()
method, which should return rules for AccessControl
filter.
In this way it will be much more easier to customize access rules for particualr admin section, instead of overriding entire behaviors()
methods.
There should be a support for yii2tech/ar-search inside IndexAction
, allowing to reduce amount of model classes.
There is no sense supporting PHP 5.4 or 5.5 anymore.
Requirements should be raised up to PHP 5.6 along with code adjustments.
This in particular allows removal of BaseObject::className()
method usage in favor to native ::class
construction.
I want to pass model as roleParams item by accessRules() method to check permission. Each CrudController has findModel method via ModelControlBehavior. But it exists after the behavior attached. But accessRules is invoking before.
let me show code to better understand:
namespace app\modules\dashboard\controllers;
use app\controllers\CrudTrait;
use app\models\Transport;
use Yii;
use yii2tech\admin\CrudController;
/**
* Class TransportController
* @package app\modules\dashboard\controllers
*/
class TransportController extends CrudController
{
use CrudTrait;
/**
* @var string
*/
public $modelClass = 'app\models\Transport';
/**
* @var string
*/
public $searchModelClass = 'app\modules\dashboard\models\TransportSearch';
/**
* {@inheritdoc}
*/
public function accessRules()
{
$id = Yii::$app->request->get('id');
$model = Transport::findOne($id); // i want $model = $this->findModel($id)
return [
[
'allow' => true,
'actions' => ['index'],
'roles' => ['transporter'],
],
[
'allow' => true,
'actions' => ['create'],
'roles' => ['transportCreate'],
],
[
'allow' => true,
'actions' => ['read'],
'roles' => ['transportRead'],
'roleParams' => ['model' => $model],
],
[
'allow' => true,
'actions' => ['update'],
'roles' => ['transportUpdate'],
'roleParams' => ['model' => $model],
],
[
'allow' => true,
'actions' => ['delete'],
'roles' => ['transportDelete'],
'roleParams' => ['model' => $model],
],
];
}
}
The question is to get your advice how to do it clear. I don't want to make double $model = Transport::findOne($id) (i have to find or throw 404 exception, so to copy-past ModelControlBehavior::findModel ) Ofcourse i can implement my own method findModel in the controller but it would duplicate the behavior's code. What do you advice?
ActionAlert
widget should provide the way to display some action proposition to the user based on session flag.
See https://github.com/yii2tech/model-change
Update and create actions often requires a flash message being set. For example as in the Delete
class. Can you add setup flash messages to this classes?
And it would be great to update the README as it is outdated. For example the
modelClass
property in actions does not exists.
Thanks for great extension.
At the present state Alert
widget determines alert type (CSS class) using direct match of flash name:
[
'error' => 'alert-danger',
'danger' => 'alert-danger',
'success' => 'alert-success',
'info' => 'alert-info',
'warning' => 'alert-warning'
]
Thus in case flash message named in non standard way, e.g. 'emailSendSuccess' or 'configUpdateError', they do not pickup any alert style.
Behavior should be changed allowing configuration via wildcards, e.g. 'Success', '*Error' and so on.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.