From b565dcb998d74c5e4ff32d7a7f505b9a1e4a5623 Mon Sep 17 00:00:00 2001 From: cuileon Date: Sun, 13 Aug 2017 10:51:47 +0800 Subject: [PATCH] gridview --- backend/assets/AppAsset.php | 2 - backend/assets/CheckAsset.php | 19 -- backend/assets/SelectAsset.php | 19 -- backend/controllers/NodeController.php | 1 + backend/views/group/_form.php | 6 +- backend/views/group/index.php | 16 +- backend/views/layouts/main.php | 8 +- backend/views/node/_form.php | 7 +- backend/views/node/_search.php | 4 +- backend/views/node/index.php | 2 +- backend/views/post/_article.php | 2 +- backend/views/sensitive/_form.php | 8 +- backend/views/sensitive/index.php | 14 +- backend/views/site/login.php | 4 +- backend/views/user/index.php | 19 +- backend/web/css/site.css | 2 + backend/widgets/GridView.php | 13 ++ common/models/Sensitive.php | 17 ++ common/models/User.php | 26 ++- composer.json | 1 + composer.lock | 215 ++++++++++++++---- .../migrations/m170717_850926_app_init.php | 5 +- frontend/views/layouts/main.php | 7 +- 23 files changed, 289 insertions(+), 128 deletions(-) delete mode 100644 backend/assets/CheckAsset.php delete mode 100644 backend/assets/SelectAsset.php diff --git a/backend/assets/AppAsset.php b/backend/assets/AppAsset.php index 008382d..720ef01 100644 --- a/backend/assets/AppAsset.php +++ b/backend/assets/AppAsset.php @@ -21,8 +21,6 @@ class AppAsset extends AssetBundle 'yii\web\YiiAsset', 'yii\bootstrap\BootstrapAsset', 'yiichina\adminlte\AdminlteAsset', - //'yiichina\icheck\ICheckAsset', - //'yiichina\icheck\Select2Asset', 'yiichina\icons\IconAsset', ]; } diff --git a/backend/assets/CheckAsset.php b/backend/assets/CheckAsset.php deleted file mode 100644 index 408ed48..0000000 --- a/backend/assets/CheckAsset.php +++ /dev/null @@ -1,19 +0,0 @@ -findModel($id); if ($model->load(Yii::$app->request->post()) && $model->save()) { + Yii::$app->session->setFlash('success', Yii::t('app', 'Operation success.')); return $this->redirect(['index']); } else { return $this->render('update', [ diff --git a/backend/views/group/_form.php b/backend/views/group/_form.php index 8cd72ca..ac50029 100644 --- a/backend/views/group/_form.php +++ b/backend/views/group/_form.php @@ -12,13 +12,9 @@ - field($model, 'parent_id')->dropDownList($model->parentList) ?> - field($model, 'name')->textInput() ?> - field($model, 'description')->textInput() ?> - - field($model, 'status')->inline()->radioList($model->statusList) ?> + field($model, 'node_ids')->textInput() ?>
isNewRecord ? '新建' : '修改', ['class' => $model->isNewRecord ? 'btn btn-success btn-flat' : 'btn btn-primary btn-flat']) ?> diff --git a/backend/views/group/index.php b/backend/views/group/index.php index d47c78c..d83748d 100644 --- a/backend/views/group/index.php +++ b/backend/views/group/index.php @@ -9,8 +9,8 @@ /* @var $searchModel common\models\NodeSearch */ /* @var $dataProvider yii\data\ActiveDataProvider */ -$mainTitle = '栏目管理'; -$subTitle = '栏目列表'; +$mainTitle = '编辑组管理'; +$subTitle = '编辑组列表'; $this->title = $subTitle . ' - ' . $mainTitle . ' - ' . Yii::$app->name; $breadcrumbs[] = ['label' => $mainTitle, 'url' => ['index']]; $breadcrumbs[] = $subTitle; @@ -33,7 +33,7 @@ ['label' => '禁用', 'url' => ['disable']], ['label' => '启用', 'url' => ['enable']], ], - 'button' => Html::a(Icon::show('plus', 'fa') . '新建栏目', ['create'], ['class' => 'btn btn-sm btn-flat btn-success']), + 'button' => Html::a(Icon::show('plus', 'fa') . '新建编辑组', ['create'], ['class' => 'btn btn-sm btn-flat btn-success']), 'columns' => [ [ 'class' => 'yii\grid\CheckboxColumn', @@ -44,16 +44,16 @@ 'options' => ['width' => 60], ], [ - 'attribute' => 'parent_id', + 'attribute' => 'name', 'options' => ['width' => 60], ], - 'name', - 'description', - 'status', + [ + 'attribute' => 'nodes', + ], [ 'class' => 'yii\grid\ActionColumn', 'header' => '操作', - 'options' => ['width' => 65], + 'options' => ['width' => 70], ], ], ]); ?> diff --git a/backend/views/layouts/main.php b/backend/views/layouts/main.php index f6d7555..f27b49e 100644 --- a/backend/views/layouts/main.php +++ b/backend/views/layouts/main.php @@ -8,9 +8,11 @@ use yiichina\adminlte\Nav; use yiichina\adminlte\MainHeader; use yiichina\adminlte\SideBar; +use yiichina\adminlte\Alert; use yiichina\icons\Icon; use yii\widgets\Breadcrumbs; use yii\widgets\Menu; +use yii\widgets\Spaceless; use common\models\Node; AppAsset::register($this); @@ -28,7 +30,7 @@ beginBody() ?> - +
- + +
@@ -446,6 +449,7 @@
+ endBody() ?> diff --git a/backend/views/node/_form.php b/backend/views/node/_form.php index 1e5f3ec..5ae8bd3 100644 --- a/backend/views/node/_form.php +++ b/backend/views/node/_form.php @@ -2,6 +2,7 @@ use yii\helpers\Html; use yii\bootstrap\ActiveForm; +use yiichina\icheck\ICheck; /* @var $this yii\web\View */ /* @var $model common\models\Node */ @@ -18,12 +19,12 @@ field($model, 'description')->textInput() ?> - field($model, 'type')->inline()->radioList($model->typeList) ?> + field($model, 'type')->inline()->widget(ICheck::className(), ['type' => ICheck::TYPE_RADIO_LIST, 'items' => $model->typeList]) ?> - field($model, 'status')->inline()->radioList($model->statusList) ?> + field($model, 'status')->inline()->widget(ICheck::className(), ['type' => ICheck::TYPE_RADIO_LIST, 'items' => $model->statusList]) ?>
- isNewRecord ? '新建' : '修改', ['class' => $model->isNewRecord ? 'btn btn-success btn-flat' : 'btn btn-primary btn-flat']) ?> + isNewRecord ? Yii::t('app', 'Create') : Yii::t('app', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success btn-flat' : 'btn btn-primary btn-flat']) ?>
diff --git a/backend/views/node/_search.php b/backend/views/node/_search.php index 4f54e33..aa5d000 100644 --- a/backend/views/node/_search.php +++ b/backend/views/node/_search.php @@ -2,7 +2,7 @@ use yii\helpers\Html; use yii\bootstrap\ActiveForm; -use common\models\Node; +use yiichina\icheck\ICheck; /* @var $this yii\web\View */ /* @var $model common\models\NodeSearch */ @@ -15,7 +15,7 @@ 'action' => ['index'], 'method' => 'get', ]); ?> - + ICheck::TYPE_RADIO_LIST, 'color' => ICheck::COLOR_GREEN, 'model' => $model, 'attribute' => 'status', 'items' => ['a' => 'b']]) ?>
field($model, 'parent_id', ['template' => '{input}', 'inputOptions' => ['class' => 'form-control input-sm']])->dropDownList($model->parentList, ['prompt' => '请选择父栏目']) ?> diff --git a/backend/views/node/index.php b/backend/views/node/index.php index 397d679..d9224c5 100644 --- a/backend/views/node/index.php +++ b/backend/views/node/index.php @@ -59,7 +59,7 @@ [ 'class' => 'yii\grid\ActionColumn', 'header' => '操作', - 'options' => ['width' => 65], + 'options' => ['width' => 80], ], ], ]); ?> diff --git a/backend/views/post/_article.php b/backend/views/post/_article.php index 42c3380..dd6e97f 100644 --- a/backend/views/post/_article.php +++ b/backend/views/post/_article.php @@ -22,7 +22,7 @@ field($post, 'status')->textInput() ?>
- isNewRecord ? '新建' : '修改', ['class' => $model->isNewRecord ? 'btn btn-success btn-flat' : 'btn btn-primary btn-flat']) ?> + isNewRecord ? Yii::t('app', 'Create') : Yii::t('app', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success btn-flat' : 'btn btn-primary btn-flat']) ?>
diff --git a/backend/views/sensitive/_form.php b/backend/views/sensitive/_form.php index 8cd72ca..eb88707 100644 --- a/backend/views/sensitive/_form.php +++ b/backend/views/sensitive/_form.php @@ -12,16 +12,14 @@ - field($model, 'parent_id')->dropDownList($model->parentList) ?> + field($model, 'node_id')->dropDownList($model->nodeList) ?> - field($model, 'name')->textInput() ?> - - field($model, 'description')->textInput() ?> + field($model, 'words')->textInput() ?> field($model, 'status')->inline()->radioList($model->statusList) ?>
- isNewRecord ? '新建' : '修改', ['class' => $model->isNewRecord ? 'btn btn-success btn-flat' : 'btn btn-primary btn-flat']) ?> + isNewRecord ? Yii::t('app', 'Create') : Yii::t('app', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success btn-flat' : 'btn btn-primary btn-flat']) ?>
diff --git a/backend/views/sensitive/index.php b/backend/views/sensitive/index.php index a18e933..d8fa3fc 100644 --- a/backend/views/sensitive/index.php +++ b/backend/views/sensitive/index.php @@ -44,16 +44,18 @@ 'options' => ['width' => 60], ], [ - 'attribute' => 'parent_id', - 'options' => ['width' => 60], + 'attribute' => 'node_id', + 'options' => ['width' => 100], + ], + 'words', + [ + 'attribute' => 'status', + 'options' => ['width' => 100], ], - 'name', - 'description', - 'status', [ 'class' => 'yii\grid\ActionColumn', 'header' => '操作', - 'options' => ['width' => 65], + 'options' => ['width' => 70], ], ], ]); ?> diff --git a/backend/views/site/login.php b/backend/views/site/login.php index ffc7f3f..69ca8da 100644 --- a/backend/views/site/login.php +++ b/backend/views/site/login.php @@ -6,6 +6,7 @@ use yii\helpers\Html; use yii\bootstrap\ActiveForm; +use yii\widgets\Spaceless; use backend\assets\AppAsset; $this->title = 'Login'; @@ -26,7 +27,7 @@ beginBody() ?> - + + endBody() ?> diff --git a/backend/views/user/index.php b/backend/views/user/index.php index f54fea6..37b4d0c 100644 --- a/backend/views/user/index.php +++ b/backend/views/user/index.php @@ -55,11 +55,26 @@ 'options' => ['width' => 150], 'format' => ['date', 'php:Y-m-d H:i:s'], ], - 'status', + [ + 'attribute' => 'roles', + 'options' => ['width' => 100], + 'value' => function($data) { + return $data->rolesLabel; + }, + 'format' => 'raw', + ], + [ + 'attribute' => 'status', + 'options' => ['width' => 100], + 'value' => function($data) { + return $data->statusLabel; + }, + 'format' => 'raw', + ], [ 'class' => 'yii\grid\ActionColumn', 'header' => '操作', - 'options' => ['width' => 100], + 'options' => ['width' => 70], ], ], ]); ?> diff --git a/backend/web/css/site.css b/backend/web/css/site.css index 1454e5a..65a43fa 100644 --- a/backend/web/css/site.css +++ b/backend/web/css/site.css @@ -7,3 +7,5 @@ .btn-search.active .fa-search-plus:before { content: "\f010"; } .search { display: none; background: #f4f4f4; margin-bottom: 10px; padding: 10px 10px 0 10px; } .search .form-group { margin-bottom: 10px; } + +.grid-view tr td:last-child a { margin: 0 2px; } diff --git a/backend/widgets/GridView.php b/backend/widgets/GridView.php index 6743f05..deb7bce 100644 --- a/backend/widgets/GridView.php +++ b/backend/widgets/GridView.php @@ -5,6 +5,7 @@ use yii\bootstrap\ButtonDropdown; use yii\helpers\Html; use yiichina\icons\Icon; +use yiichina\icheck\ICheckAsset; use Yii; @@ -25,6 +26,18 @@ class GridView extends \yii\grid\GridView public function init() { parent::init(); + $view = $this->getView(); + $asset = ICheckAsset::register($view); + $view->registerCssFile($asset->baseUrl . '/skins/minimal/blue.css'); + $view->registerJs("$('input[type=\"checkbox\"]').iCheck({ + checkboxClass: 'icheckbox_minimal-blue', + radioClass: 'iradio_minimal-blue', + }); + $('input[name=\"selection_all\"]').on('ifToggled', function (event) { + var chkToggle; + $(this).is(':checked') ? chkToggle = \"check\" : chkToggle = \"uncheck\"; + $('input[name=\"selection[]\"]').iCheck(chkToggle); + });"); $this->pager['hideOnSinglePage'] = false; } diff --git a/common/models/Sensitive.php b/common/models/Sensitive.php index dcc9bf1..8f6d76d 100644 --- a/common/models/Sensitive.php +++ b/common/models/Sensitive.php @@ -3,6 +3,7 @@ namespace common\models; use Yii; +use yii\helpers\ArrayHelper; /** * This is the model class for table "sensitive". @@ -13,6 +14,9 @@ */ class Sensitive extends \yii\db\ActiveRecord { + const STATUS_INACTIVE = 0; + const STATUS_ACTIVE = 1; + /** * @inheritdoc */ @@ -43,4 +47,17 @@ public function attributeLabels() 'words' => Yii::t('app', 'Words'), ]; } + + public function getNodeList() + { + return ArrayHelper::map(Node::find()->all(), 'id', 'name'); + } + + public function getStatusList() + { + return [ + self::STATUS_ACTIVE => '正常', + self::STATUS_INACTIVE => '禁用', + ]; + } } diff --git a/common/models/User.php b/common/models/User.php index 651115f..2b0f14d 100644 --- a/common/models/User.php +++ b/common/models/User.php @@ -6,6 +6,8 @@ use yii\behaviors\TimestampBehavior; use yii\db\ActiveRecord; use yii\web\IdentityInterface; +use yii\bootstrap\Html; +use yiichina\icons\Icon; /** * User model @@ -26,7 +28,6 @@ class User extends ActiveRecord implements IdentityInterface const STATUS_DELETED = 0; const STATUS_ACTIVE = 10; - /** * @inheritdoc */ @@ -200,4 +201,27 @@ public function removePasswordResetToken() { $this->password_reset_token = null; } + + public function getStatusLabel() + { + return [ + self::STATUS_DELETED => Html::tag('small', Icon::show('delete') . Yii::t('app', 'Deleted'), ['class' => 'label label-danger']), + self::STATUS_ACTIVE => Html::tag('small', Icon::show('check') . Yii::t('app', 'Active'), ['class' => 'label label-success']), + ][$this->status]; + } + + public function getRoles() + { + return Yii::$app->authManager->getRolesByUser($this->id); + } + + public function getRolesLabel() + { + $roles = Yii::$app->authManager->getRolesByUser($this->id); + $labels = []; + foreach($roles as $key => $value) { + $labels[] = Html::tag('small', $key, ['class' => 'label label-info']); + } + return implode(' ', $labels); + } } diff --git a/composer.json b/composer.json index 5db4870..dec3885 100644 --- a/composer.json +++ b/composer.json @@ -24,6 +24,7 @@ "yiichina/yii2-select2": "*", "yiichina/yii2-icheck": "*", "yiichina/yii2-chart": "*", + "yiichina/yii2-switch": "*", "dektrium/yii2-rbac": "1.0.0-alpha@dev" }, "require-dev": { diff --git a/composer.lock b/composer.lock index 06c52cb..2d67123 100644 --- a/composer.lock +++ b/composer.lock @@ -4,53 +4,47 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "5d21abb64c33713a9586c72fdacecdb7", + "content-hash": "0d0d714492536188502bf85edef411a3", "packages": [ { - "name": "bower-asset/adminlte", - "version": "v2.3.11", + "name": "almasaeed2010/adminlte", + "version": "v2.4.0-rc", "source": { "type": "git", "url": "https://github.com/almasaeed2010/AdminLTE.git", - "reference": "2be703222af2edcb87e562d3da2299e4352bff8a" + "reference": "1ee1030db29f62756a773b868c29a56935607c00" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/almasaeed2010/AdminLTE/zipball/2be703222af2edcb87e562d3da2299e4352bff8a", - "reference": "2be703222af2edcb87e562d3da2299e4352bff8a", + "url": "https://files.phpcomposer.com/files/almasaeed2010/AdminLTE/1ee1030db29f62756a773b868c29a56935607c00.zip", + "reference": "1ee1030db29f62756a773b868c29a56935607c00", "shasum": "" }, - "type": "bower-asset-library", - "extra": { - "bower-asset-main": [ - "index2.html", - "dist/css/AdminLTE.css", - "dist/js/app.js", - "build/less/AdminLTE.less" - ], - "bower-asset-ignore": [ - "/.*", - "node_modules", - "bower_components", - "composer.json", - "documentation" - ] - }, + "type": "library", + "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], - "description": "Admin dashboard and control panel template", + "authors": [ + { + "name": "Abdullah Almsaeed", + "email": "abdullah@almsaeedstudio.com" + } + ], + "description": "AdminLTE - admin control panel and dashboard that's based on Bootstrap 3", + "homepage": "https://adminlte.io/", "keywords": [ + "JS", "admin", - "backend", - "bootstrap", + "back-end", "css", - "html", - "js", + "less", "responsive", "template", - "theme" - ] + "theme", + "web" + ], + "time": "2017-07-02T15:38:16+00:00" }, { "name": "bower-asset/bootstrap", @@ -101,6 +95,48 @@ "web" ] }, + { + "name": "bower-asset/bootstrap-switch", + "version": "v3.3.3", + "source": { + "type": "git", + "url": "https://github.com/nostalgiaz/bootstrap-switch.git", + "reference": "e1a9a9c135ed062ac362d2f8345a71417fb10758" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nostalgiaz/bootstrap-switch/zipball/e1a9a9c135ed062ac362d2f8345a71417fb10758", + "reference": "e1a9a9c135ed062ac362d2f8345a71417fb10758", + "shasum": "" + }, + "require": { + "bower-asset/bootstrap": ">=2.3.2", + "bower-asset/jquery": ">=1.9.0" + }, + "require-dev": { + "bower-asset/jquery": "~2.1" + }, + "type": "bower-asset-library", + "extra": { + "bower-asset-main": [ + "./dist/js/bootstrap-switch.js", + "./dist/css/bootstrap3/bootstrap-switch.css" + ], + "bower-asset-ignore": [ + "docs", + "test", + "CNAME", + "composer.json", + "CONTRIBUTING.md", + "index.html", + "package.json" + ] + }, + "license": [ + "Apache-2.0" + ], + "description": "Turn checkboxes and radio buttons into toggle switches." + }, { "name": "bower-asset/chart.js", "version": "v2.6.0", @@ -393,6 +429,48 @@ }, "description": "Select2 is a jQuery based replacement for select boxes. It supports searching, remote data sets, and infinite scrolling of results." }, + { + "name": "bower-asset/select2-bootstrap-theme", + "version": "0.1.0-beta.10", + "source": { + "type": "git", + "url": "https://github.com/fk/select2-bootstrap-theme.git", + "reference": "7ad6e79f01dbb67c5f77ef102f9570266eca1aea" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/fk/select2-bootstrap-theme/zipball/7ad6e79f01dbb67c5f77ef102f9570266eca1aea", + "reference": "7ad6e79f01dbb67c5f77ef102f9570266eca1aea", + "shasum": "" + }, + "require": { + "bower-asset/bootstrap": ">=3.3.4,<4.0.0", + "bower-asset/select2": ">=4.0.0,<5.0.0" + }, + "type": "bower-asset-library", + "extra": { + "bower-asset-main": [ + "src/build.scss", + "src/build.less" + ], + "bower-asset-ignore": [ + "**/.*", + "node_modules", + "components" + ] + }, + "license": [ + "MIT" + ], + "description": "A theme for Select2 v4 and Bootstrap 3.", + "keywords": [ + "bootstrap", + "css", + "less", + "sass", + "select2" + ] + }, { "name": "bower-asset/treegrid", "version": "v0.1.6", @@ -784,20 +862,20 @@ }, { "name": "yiichina/yii2-adminlte", - "version": "v1.11.0", + "version": "v1.15.0", "source": { "type": "git", "url": "https://github.com/yiichina/yii2-adminlte.git", - "reference": "e5dcc39984f9f42f21600b5d3c804eff01e6816f" + "reference": "9f5b4c705602c8ebf43c11bbe0f8032b01f91744" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/yiichina/yii2-adminlte/zipball/e5dcc39984f9f42f21600b5d3c804eff01e6816f", - "reference": "e5dcc39984f9f42f21600b5d3c804eff01e6816f", + "url": "https://files.phpcomposer.com/files/yiichina/yii2-adminlte/9f5b4c705602c8ebf43c11bbe0f8032b01f91744.zip", + "reference": "9f5b4c705602c8ebf43c11bbe0f8032b01f91744", "shasum": "" }, "require": { - "bower-asset/adminlte": ">=2.3.0", + "almasaeed2010/adminlte": "~2.4@RC", "yiisoft/yii2-bootstrap": "~2.0.0" }, "type": "yii2-extension", @@ -822,7 +900,7 @@ "extension", "yii2" ], - "time": "2017-08-02T06:33:59+00:00" + "time": "2017-08-08T23:11:27+00:00" }, { "name": "yiichina/yii2-auth", @@ -998,16 +1076,16 @@ }, { "name": "yiichina/yii2-icheck", - "version": "v0.2.0", + "version": "v0.3.0", "source": { "type": "git", "url": "https://github.com/yiichina/yii2-icheck.git", - "reference": "16ba8ff546aa65ad6949b80240840eab1065f452" + "reference": "b47b4c11c1dc03fb63851275047b69d18746d462" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/yiichina/yii2-icheck/zipball/16ba8ff546aa65ad6949b80240840eab1065f452", - "reference": "16ba8ff546aa65ad6949b80240840eab1065f452", + "url": "https://files.phpcomposer.com/files/yiichina/yii2-icheck/b47b4c11c1dc03fb63851275047b69d18746d462.zip", + "reference": "b47b4c11c1dc03fb63851275047b69d18746d462", "shasum": "" }, "require": { @@ -1036,7 +1114,7 @@ "iCheck", "yii2" ], - "time": "2017-08-05T09:37:32+00:00" + "time": "2017-08-12T12:20:46+00:00" }, { "name": "yiichina/yii2-icons", @@ -1084,20 +1162,21 @@ }, { "name": "yiichina/yii2-select2", - "version": "v0.10.0", + "version": "v0.11.0", "source": { "type": "git", "url": "https://github.com/yiichina/yii2-select2.git", - "reference": "08245e0897aab6cbaef1eaca2550e3c02dd9e9f3" + "reference": "23d12b89e58d58a6079d7217b12eb8cfeb6c3981" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/yiichina/yii2-select2/zipball/08245e0897aab6cbaef1eaca2550e3c02dd9e9f3", - "reference": "08245e0897aab6cbaef1eaca2550e3c02dd9e9f3", + "url": "https://files.phpcomposer.com/files/yiichina/yii2-select2/23d12b89e58d58a6079d7217b12eb8cfeb6c3981.zip", + "reference": "23d12b89e58d58a6079d7217b12eb8cfeb6c3981", "shasum": "" }, "require": { "bower-asset/select2": "~4.0.1", + "bower-asset/select2-bootstrap-theme": "*@beta", "yiisoft/yii2-bootstrap": "~2.0.0" }, "type": "yii2-extension", @@ -1122,7 +1201,49 @@ "select2", "yii2" ], - "time": "2017-08-05T09:37:02+00:00" + "time": "2017-08-07T09:35:56+00:00" + }, + { + "name": "yiichina/yii2-switch", + "version": "v0.1.0", + "source": { + "type": "git", + "url": "https://github.com/yiichina/yii2-switch.git", + "reference": "2b86c2f64bff5760c30daccf3807113d5634b22e" + }, + "dist": { + "type": "zip", + "url": "https://files.phpcomposer.com/files/yiichina/yii2-switch/2b86c2f64bff5760c30daccf3807113d5634b22e.zip", + "reference": "2b86c2f64bff5760c30daccf3807113d5634b22e", + "shasum": "" + }, + "require": { + "bower-asset/bootstrap-switch": "*", + "yiisoft/yii2-bootstrap": "~2.0.0" + }, + "type": "yii2-extension", + "autoload": { + "psr-4": { + "yiichina\\switch\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "cuileon", + "email": "admin@yiichina.com" + } + ], + "description": "Yii2 中使用 switch", + "keywords": [ + "extension", + "switch", + "yii2" + ], + "time": "2017-08-05T04:15:07+00:00" }, { "name": "yiichina/yii2-treegrid", @@ -4140,11 +4261,11 @@ } ], "aliases": [], - "minimum-stability": "stable", + "minimum-stability": "dev", "stability-flags": { "dektrium/yii2-rbac": 20 }, - "prefer-stable": false, + "prefer-stable": true, "prefer-lowest": false, "platform": { "php": ">=5.4.0" diff --git a/console/migrations/m170717_850926_app_init.php b/console/migrations/m170717_850926_app_init.php index cb58086..fe83c11 100644 --- a/console/migrations/m170717_850926_app_init.php +++ b/console/migrations/m170717_850926_app_init.php @@ -76,8 +76,9 @@ public function up() // Group $this->createTable('{{%group}}', [ 'id' => $this->primaryKey(), - 'user_id' => $this->integer()->notNull(), - 'node_id' => $this->integer()->notNull(), + 'name' => $this->string()->notNull(), + 'node_ids' => $this->string()->notNull(), + 'status' => $this->smallInteger()->notNull()->defaultValue(1), ], $tableOptions); // Sensitive diff --git a/frontend/views/layouts/main.php b/frontend/views/layouts/main.php index 8c2ec67..bb84758 100644 --- a/frontend/views/layouts/main.php +++ b/frontend/views/layouts/main.php @@ -7,6 +7,7 @@ use yii\bootstrap\Nav; use yii\bootstrap\NavBar; use yii\widgets\Breadcrumbs; +use yii\widgets\Spaceless; use frontend\assets\AppAsset; use common\models\Node; use yiichina\adminlte\Alert; @@ -28,7 +29,7 @@ beginBody() ?> - +
- + +
@@ -163,6 +165,7 @@
+ endBody() ?>