From f56d4fdc3c7bb04583d78cdd4475629595f92907 Mon Sep 17 00:00:00 2001 From: Berdia Muradashvili Date: Wed, 1 Feb 2017 16:38:43 +0400 Subject: [PATCH 1/2] Fix bug in ArticleAttachment getUrl method --- models/ArticleAttachment.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/models/ArticleAttachment.php b/models/ArticleAttachment.php index 50416c8..ab8f771 100644 --- a/models/ArticleAttachment.php +++ b/models/ArticleAttachment.php @@ -80,6 +80,6 @@ public function getArticle() public function getUrl() { - return $this->base_url .'/'. $this->path; + return Yii::getAlias('@storageUrl') . '/source/' . $this->path; } } From 5fc396233480990863ba06b144b97406a0ebb2a5 Mon Sep 17 00:00:00 2001 From: koco Date: Wed, 1 Feb 2017 17:18:33 +0400 Subject: [PATCH 2/2] Add checkboxes to tables, with button to allow to delete many rows Closes #23 --- assets/css/main.css | 183 +++++++++++++++++ assets/js/i18nContent.js | 28 ++- assets/less/checkbox.less | 187 ++++++++++++++++++ assets/less/main.less | 3 +- .../{_togglebutton.less => togglebutton.less} | 0 controllers/ArticleCategoryController.php | 33 +++- controllers/ArticleController.php | 7 +- controllers/PageController.php | 7 +- controllers/WidgetCarouselController.php | 7 +- controllers/WidgetCarouselItemController.php | 14 +- controllers/WidgetMenuController.php | 7 +- controllers/WidgetTextController.php | 8 +- views/article-category/_form.php | 4 +- views/article-category/index.php | 21 +- views/article/_form.php | 4 +- views/article/index.php | 20 ++ views/page/_form.php | 4 +- views/page/index.php | 20 ++ views/widget-carousel/_form.php | 4 +- views/widget-carousel/index.php | 21 +- views/widget-carousel/item/_form.php | 4 +- views/widget-carousel/update.php | 22 ++- views/widget-menu/_form.php | 4 +- views/widget-menu/index.php | 21 +- views/widget-text/_form.php | 4 +- views/widget-text/index.php | 21 +- 26 files changed, 615 insertions(+), 43 deletions(-) create mode 100644 assets/less/checkbox.less rename assets/less/{_togglebutton.less => togglebutton.less} (100%) diff --git a/assets/css/main.css b/assets/css/main.css index 75d163d..fc6a6ef 100644 --- a/assets/css/main.css +++ b/assets/css/main.css @@ -140,3 +140,186 @@ .togglebutton label input[type=checkbox]:checked + .toggle:active:after { box-shadow: 0 1px 3px 1px rgba(0, 0, 0, 0.4), 0 0 0 15px rgba(60, 141, 188, 0.1); } +.checkbox label, +.radio label, +label { + font-size: 16px; + line-height: 1.42857143; + font-weight: 400; +} +.checkbox input[type=checkbox] { + opacity: 0; + position: absolute; + margin: 0; + z-index: -1; + width: 0; + height: 0; + overflow: hidden; + left: 0; + pointer-events: none; +} +.checkbox .checkbox-material { + vertical-align: middle; + position: relative; + top: 3px; +} +.checkbox .checkbox-material .check { + position: relative; + display: inline-block; + width: 20px; + height: 20px; + border: 2px solid rgba(0, 0, 0, 0.54); + border-radius: 2px; + overflow: hidden; + z-index: 1; +} +.checkbox .checkbox-material .check:before { + position: absolute; + content: ""; + transform: rotate(45deg); + -webkit-transform: rotate(45deg); + display: block; + margin-top: -4px; + margin-left: 6px; + width: 0; + height: 0; + animation: checkbox-off; + -webkit-animation: checkbox-off; +} +.checkbox .checkbox-material:before { + display: block; + position: absolute; + left: 0; + content: ""; + background-color: rgba(0, 0, 0, 0.84); + height: 20px; + width: 20px; + border-radius: 100%; + z-index: 1; + opacity: 0; + margin: 0; + transform: scale3d(2.3, 2.3, 1); + -webkit-transform: scale3d(2.3, 2.3, 1); +} +.checkbox input[type=checkbox]:checked + .checkbox-material .check:before { + color: #009688; + box-shadow: 0 0 0 10px, 10px -10px 0 10px, 32px 0 0 20px, 0px 32px 0 20px, -5px 5px 0 10px, 20px -12px 0 11px; + animation: checkbox-on 0.3s forwards; + -webkit-animation: checkbox-on 0.3s forwards; +} +@keyframes checkbox-on { + 0% { + box-shadow: 0 0 0 10px, 10px -10px 0 10px, 32px 0 0 20px, 0px 32px 0 20px, -5px 5px 0 10px, 15px 2px 0 11px; + } + 50% { + box-shadow: 0 0 0 10px, 10px -10px 0 10px, 32px 0 0 20px, 0px 32px 0 20px, -5px 5px 0 10px, 20px 2px 0 11px; + } + 100% { + box-shadow: 0 0 0 10px, 10px -10px 0 10px, 32px 0 0 20px, 0px 32px 0 20px, -5px 5px 0 10px, 20px -12px 0 11px; + } +} +@-webkit-keyframes checkbox-on { + 0% { + box-shadow: 0 0 0 10px, 10px -10px 0 10px, 32px 0 0 20px, 0px 32px 0 20px, -5px 5px 0 10px, 15px 2px 0 11px; + } + 50% { + box-shadow: 0 0 0 10px, 10px -10px 0 10px, 32px 0 0 20px, 0px 32px 0 20px, -5px 5px 0 10px, 20px 2px 0 11px; + } + 100% { + box-shadow: 0 0 0 10px, 10px -10px 0 10px, 32px 0 0 20px, 0px 32px 0 20px, -5px 5px 0 10px, 20px -12px 0 11px; + } +} +@keyframes checkbox-off { + 0% { + box-shadow: 0 0 0 10px, 10px -10px 0 10px, 32px 0 0 20px, 0px 32px 0 20px, -5px 5px 0 10px, 20px -12px 0 11px, 0 0 0 0 inset; + } + 25% { + box-shadow: 0 0 0 10px, 10px -10px 0 10px, 32px 0 0 20px, 0px 32px 0 20px, -5px 5px 0 10px, 20px -12px 0 11px, 0 0 0 0 inset; + } + 50% { + transform: rotate(45deg); + -webkit-transform: rotate(45deg); + margin-top: -4px; + margin-left: 6px; + width: 0; + height: 0; + box-shadow: 0 0 0 10px, 10px -10px 0 10px, 32px 0 0 20px, 0px 32px 0 20px, -5px 5px 0 10px, 15px 2px 0 11px, 0 0 0 0 inset; + } + 51% { + transform: rotate(0deg); + -webkit-transform: rotate(0deg); + margin-top: -2px; + margin-left: -2px; + width: 20px; + height: 20px; + box-shadow: 0 0 0 0, + 0 0 0 0, + 0 0 0 0, + 0 0 0 0, + 0 0 0 0, + 0 0 0 0, + 0px 0 0 10px inset; + } + 100% { + transform: rotate(0deg); + -webkit-transform: rotate(0deg); + margin-top: -2px; + margin-left: -2px; + width: 20px; + height: 20px; + box-shadow: 0 0 0 0, + 0 0 0 0, + 0 0 0 0, + 0 0 0 0, + 0 0 0 0, + 0 0 0 0, + 0px 0 0 0 inset; + } +} +@-webkit-keyframes checkbox-off { + 0% { + box-shadow: 0 0 0 10px, 10px -10px 0 10px, 32px 0 0 20px, 0px 32px 0 20px, -5px 5px 0 10px, 20px -12px 0 11px, 0 0 0 0 inset; + } + 25% { + box-shadow: 0 0 0 10px, 10px -10px 0 10px, 32px 0 0 20px, 0px 32px 0 20px, -5px 5px 0 10px, 20px -12px 0 11px, 0 0 0 0 inset; + } + 50% { + transform: rotate(45deg); + -webkit-transform: rotate(45deg); + margin-top: -4px; + margin-left: 6px; + width: 0; + height: 0; + box-shadow: 0 0 0 10px, 10px -10px 0 10px, 32px 0 0 20px, 0px 32px 0 20px, -5px 5px 0 10px, 15px 2px 0 11px, 0 0 0 0 inset; + } + 51% { + transform: rotate(0deg); + -webkit-transform: rotate(0deg); + margin-top: -2px; + margin-left: -2px; + width: 20px; + height: 20px; + box-shadow: 0 0 0 0, + 0 0 0 0, + 0 0 0 0, + 0 0 0 0, + 0 0 0 0, + 0 0 0 0, + 0px 0 0 10px inset; + } + 100% { + transform: rotate(0deg); + -webkit-transform: rotate(0deg); + margin-top: -2px; + margin-left: -2px; + width: 20px; + height: 20px; + box-shadow: 0 0 0 0, + 0 0 0 0, + 0 0 0 0, + 0 0 0 0, + 0 0 0 0, + 0 0 0 0, + 0px 0 0 0 inset; + } +} diff --git a/assets/js/i18nContent.js b/assets/js/i18nContent.js index 85505ed..4b96b08 100644 --- a/assets/js/i18nContent.js +++ b/assets/js/i18nContent.js @@ -4,7 +4,8 @@ (function ($) { var I18nContent = function () { this.$toggleBtn = $('.togglebutton > label > input'); - + this.$greedView = $('.grid-view'); + this.$multipleDeleteButton = $('.delete-multiple'); this.init(); }; @@ -13,6 +14,7 @@ init: function () { this.toggleStatus(); + this.onDeleteCheckedItems(); }, @@ -33,6 +35,29 @@ }, + onDeleteCheckedItems: function () { + var me = this; + me.$multipleDeleteButton.on('click', function (e) { + e.preventDefault(); + var $itemIds, conf, deleteUrl; + $itemIds = me.$greedView.yiiGridView('getSelectedRows'); + if($itemIds.length < 1){ + return; + } + conf = confirm('Are you sure you want to delete this/these item(s)?'); + if(conf !== true) return; + + deleteUrl = $(this).data('url') || 'delete'; + me._post(deleteUrl, {id: $itemIds}).done(function (res) { + if(res.errorMsg){ + alert(res.errorMsg); + } + //console.log(res); + }); + }); + }, + + _get: function (url, data) { return $.ajax({ url: url, @@ -42,6 +67,7 @@ }); }, + _post: function (url, data) { return $.ajax({ url: url, diff --git a/assets/less/checkbox.less b/assets/less/checkbox.less new file mode 100644 index 0000000..b0300fc --- /dev/null +++ b/assets/less/checkbox.less @@ -0,0 +1,187 @@ +.checkbox label, .radio label, label { + font-size: 16px; + line-height: 1.42857143; + //color: #BDBDBD; + font-weight: 400; +} + +.checkbox { + input[type=checkbox] { + opacity: 0; + position: absolute; + margin: 0; + z-index: -1; + width: 0; + height: 0; + overflow: hidden; + left: 0; + pointer-events: none; + } + .checkbox-material { + vertical-align: middle; + position: relative; + top: 3px; + .check { + position: relative; + display: inline-block; + width: 20px; + height: 20px; + border: 2px solid rgba(0,0,0, .54); + border-radius: 2px; + overflow: hidden; + z-index: 1; + &:before{ + position: absolute; + content: ""; + transform: rotate(45deg); + -webkit-transform: rotate(45deg); + display: block; + margin-top: -4px; + margin-left: 6px; + width: 0; + height: 0; + animation: checkbox-off; + -webkit-animation: checkbox-off; + } + } + &:before{ + display: block; + position: absolute; + left: 0; + content: ""; + background-color: rgba(0, 0, 0, 0.84); + height: 20px; + width: 20px; + border-radius: 100%; + z-index: 1; + opacity: 0; + margin: 0; + transform: scale3d(2.3, 2.3, 1); + -webkit-transform: scale3d(2.3, 2.3, 1); + } + } +} +.checkbox input[type=checkbox]:checked + .checkbox-material .check:before { + color: #009688; + box-shadow: 0 0 0 10px, 10px -10px 0 10px, 32px 0 0 20px, 0px 32px 0 20px, -5px 5px 0 10px, 20px -12px 0 11px; + animation: checkbox-on 0.3s forwards; + -webkit-animation: checkbox-on 0.3s forwards; +} + +//animation +@keyframes checkbox-on { + 0% { + box-shadow: 0 0 0 10px, 10px -10px 0 10px, 32px 0 0 20px, 0px 32px 0 20px, -5px 5px 0 10px, 15px 2px 0 11px; + } + 50% { + box-shadow: 0 0 0 10px, 10px -10px 0 10px, 32px 0 0 20px, 0px 32px 0 20px, -5px 5px 0 10px, 20px 2px 0 11px; + } + 100% { + box-shadow: 0 0 0 10px, 10px -10px 0 10px, 32px 0 0 20px, 0px 32px 0 20px, -5px 5px 0 10px, 20px -12px 0 11px; + } +} +@-webkit-keyframes checkbox-on { + 0% { + box-shadow: 0 0 0 10px, 10px -10px 0 10px, 32px 0 0 20px, 0px 32px 0 20px, -5px 5px 0 10px, 15px 2px 0 11px; + } + 50% { + box-shadow: 0 0 0 10px, 10px -10px 0 10px, 32px 0 0 20px, 0px 32px 0 20px, -5px 5px 0 10px, 20px 2px 0 11px; + } + 100% { + box-shadow: 0 0 0 10px, 10px -10px 0 10px, 32px 0 0 20px, 0px 32px 0 20px, -5px 5px 0 10px, 20px -12px 0 11px; + } +} +@keyframes checkbox-off { + 0% { + box-shadow: 0 0 0 10px, 10px -10px 0 10px, 32px 0 0 20px, 0px 32px 0 20px, -5px 5px 0 10px, 20px -12px 0 11px, 0 0 0 0 inset; + } + 25% { + box-shadow: 0 0 0 10px, 10px -10px 0 10px, 32px 0 0 20px, 0px 32px 0 20px, -5px 5px 0 10px, 20px -12px 0 11px, 0 0 0 0 inset; + } + 50% { + transform: rotate(45deg); + -webkit-transform: rotate(45deg); + margin-top: -4px; + margin-left: 6px; + width: 0; + height: 0; + box-shadow: 0 0 0 10px, 10px -10px 0 10px, 32px 0 0 20px, 0px 32px 0 20px, -5px 5px 0 10px, 15px 2px 0 11px, 0 0 0 0 inset; + } + 51% { + transform: rotate(0deg); + -webkit-transform: rotate(0deg); + margin-top: -2px; + margin-left: -2px; + width: 20px; + height: 20px; + box-shadow: 0 0 0 0, + 0 0 0 0, + 0 0 0 0, + 0 0 0 0, + 0 0 0 0, + 0 0 0 0, + 0px 0 0 10px inset; + } + 100% { + transform: rotate(0deg); + -webkit-transform: rotate(0deg); + margin-top: -2px; + margin-left: -2px; + width: 20px; + height: 20px; + box-shadow: 0 0 0 0, + 0 0 0 0, + 0 0 0 0, + 0 0 0 0, + 0 0 0 0, + 0 0 0 0, + 0px 0 0 0 inset; + } +} +@-webkit-keyframes checkbox-off { + 0% { + box-shadow: 0 0 0 10px, 10px -10px 0 10px, 32px 0 0 20px, 0px 32px 0 20px, -5px 5px 0 10px, 20px -12px 0 11px, 0 0 0 0 inset; + } + 25% { + box-shadow: 0 0 0 10px, 10px -10px 0 10px, 32px 0 0 20px, 0px 32px 0 20px, -5px 5px 0 10px, 20px -12px 0 11px, 0 0 0 0 inset; + } + 50% { + transform: rotate(45deg); + -webkit-transform: rotate(45deg); + margin-top: -4px; + margin-left: 6px; + width: 0; + height: 0; + box-shadow: 0 0 0 10px, 10px -10px 0 10px, 32px 0 0 20px, 0px 32px 0 20px, -5px 5px 0 10px, 15px 2px 0 11px, 0 0 0 0 inset; + } + 51% { + transform: rotate(0deg); + -webkit-transform: rotate(0deg); + margin-top: -2px; + margin-left: -2px; + width: 20px; + height: 20px; + box-shadow: 0 0 0 0, + 0 0 0 0, + 0 0 0 0, + 0 0 0 0, + 0 0 0 0, + 0 0 0 0, + 0px 0 0 10px inset; + } + 100% { + transform: rotate(0deg); + -webkit-transform: rotate(0deg); + margin-top: -2px; + margin-left: -2px; + width: 20px; + height: 20px; + box-shadow: 0 0 0 0, + 0 0 0 0, + 0 0 0 0, + 0 0 0 0, + 0 0 0 0, + 0 0 0 0, + 0px 0 0 0 inset; + } +} \ No newline at end of file diff --git a/assets/less/main.less b/assets/less/main.less index 2d0041d..0cd30cd 100644 --- a/assets/less/main.less +++ b/assets/less/main.less @@ -2,4 +2,5 @@ @import "helpers"; @import "tabs"; @import "table"; -@import "_togglebutton"; +@import "togglebutton"; +@import "checkbox"; diff --git a/assets/less/_togglebutton.less b/assets/less/togglebutton.less similarity index 100% rename from assets/less/_togglebutton.less rename to assets/less/togglebutton.less diff --git a/controllers/ArticleCategoryController.php b/controllers/ArticleCategoryController.php index d1253dc..23aa500 100644 --- a/controllers/ArticleCategoryController.php +++ b/controllers/ArticleCategoryController.php @@ -7,6 +7,7 @@ use centigen\i18ncontent\models\search\ArticleCategorySearch; use centigen\i18ncontent\web\Controller; use Yii; +use yii\helpers\Json; use yii\helpers\Url; use yii\web\NotFoundHttpException; use yii\filters\VerbFilter; @@ -118,17 +119,35 @@ public function actionUpdate($id) /** * Deletes an existing ArticleCategory model. * If deletion is successful, the browser will be redirected to the 'index' page. - * @param integer $id + * @param integer|null $id * @return mixed */ - public function actionDelete($id) + public function actionDelete($id = null) { - $model = $this->findModel($id); - if(count($model->articleCategoryArticles) > 0){ - $msg = Yii::t('i18ncontent', 'This category has articles. In order to delete this category, first you must delete all articles in this category {link}', ['link' => ''.Yii::t('i18ncontent', 'View them').'']); - return $this->renderContent($msg); + $id = $id ?: Yii::$app->request->post('id'); + if (is_array($id)) { + $categoryWithChildren = []; + foreach ($id as $item) { + $model = $this->findModel($item); + if (count($model->articleCategoryArticles) > 0) { + $categoryWithChildren[] = $model->activeTranslation->title; + continue; + } + $model->delete(); + } + if(count($categoryWithChildren)){ + $msg = Yii::t('i18ncontent', 'This categories has articles. In order to delete this categories, first you must delete all articles in this categories').': '. join(', ', $categoryWithChildren); + return Json::encode(['errorMsg' => $msg, 'success' => false]); + } + return $this->redirect(['index']); + } else { + $model = $this->findModel($id); + if (count($model->articleCategoryArticles) > 0) { + $msg = Yii::t('i18ncontent', 'This category has articles. In order to delete this category, first you must delete all articles in this category {link}', ['link' => '' . Yii::t('i18ncontent', 'View them') . '']); + return $this->renderContent($msg); + } + $model->delete(); } - $model->delete(); return $this->redirect(['index']); } diff --git a/controllers/ArticleController.php b/controllers/ArticleController.php index 3bb401d..6bebbbe 100644 --- a/controllers/ArticleController.php +++ b/controllers/ArticleController.php @@ -121,12 +121,13 @@ public function actionUpdate($id) /** * Deletes an existing Article model. * If deletion is successful, the browser will be redirected to the 'index' page. - * @param integer $id + * @param integer|array $id * @return mixed */ - public function actionDelete($id) + public function actionDelete($id = null) { - $this->findModel($id)->delete(); + $id = $id ?: Yii::$app->request->post('id'); + Article::deleteAll(['id' => $id]); return $this->redirect(['index']); } diff --git a/controllers/PageController.php b/controllers/PageController.php index 1ab52a2..6dd5722 100644 --- a/controllers/PageController.php +++ b/controllers/PageController.php @@ -115,12 +115,13 @@ public function actionUpdate($id) /** * Deletes an existing Page model. * If deletion is successful, the browser will be redirected to the 'index' page. - * @param integer $id + * @param integer|null $id * @return mixed */ - public function actionDelete($id) + public function actionDelete($id = null) { - $this->findModel($id)->delete(); + $id = $id ?: Yii::$app->request->post('id'); + Page::deleteAll(['id' => $id]); return $this->redirect(['index']); } diff --git a/controllers/WidgetCarouselController.php b/controllers/WidgetCarouselController.php index 6a024f4..4312e88 100644 --- a/controllers/WidgetCarouselController.php +++ b/controllers/WidgetCarouselController.php @@ -104,12 +104,13 @@ public function actionUpdate($id) /** * Deletes an existing WidgetCarousel model. * If deletion is successful, the browser will be redirected to the 'index' page. - * @param integer $id + * @param integer|null $id * @return mixed */ - public function actionDelete($id) + public function actionDelete($id = null) { - $this->findModel($id)->delete(); + $id = $id ?: Yii::$app->request->post('id'); + WidgetCarousel::deleteAll(['id' => $id]); return $this->redirect(['index']); } diff --git a/controllers/WidgetCarouselItemController.php b/controllers/WidgetCarouselItemController.php index f8c2d17..8f27db9 100644 --- a/controllers/WidgetCarouselItemController.php +++ b/controllers/WidgetCarouselItemController.php @@ -117,16 +117,16 @@ public function actionUpdate($id) /** * Deletes an existing WidgetCarouselItem model. * If deletion is successful, the browser will be redirected to the 'index' page. - * @param integer $id + * @param integer|null $id * @return mixed */ - public function actionDelete($id) + public function actionDelete($id = null) { - $model = $this->findModel($id); - if ($model->delete()) { - return $this->redirect(['widget-carousel/update', 'id' => $model->carousel_id]); - }; - return ""; + $id = $id ?: Yii::$app->request->post('id'); + $model = is_array($id) ? $this->findModel($id[0]) : $this->findModel($id); + WidgetCarouselItem::deleteAll(['id' => $id]); + + return $this->redirect(['widget-carousel/update', 'id' => $model->carousel_id]); } /** diff --git a/controllers/WidgetMenuController.php b/controllers/WidgetMenuController.php index 61049d2..11e9569 100644 --- a/controllers/WidgetMenuController.php +++ b/controllers/WidgetMenuController.php @@ -102,12 +102,13 @@ public function actionUpdate($id) /** * Deletes an existing WidgetMenu model. * If deletion is successful, the browser will be redirected to the 'index' page. - * @param integer $id + * @param integer|null $id * @return mixed */ - public function actionDelete($id) + public function actionDelete($id = null) { - $this->findModel($id)->delete(); + $id = $id ?: Yii::$app->request->post('id'); + WidgetMenu::deleteAll(['id' => $id]); return $this->redirect(['index']); } diff --git a/controllers/WidgetTextController.php b/controllers/WidgetTextController.php index f2dd037..63c8c8f 100644 --- a/controllers/WidgetTextController.php +++ b/controllers/WidgetTextController.php @@ -111,12 +111,14 @@ public function actionUpdate($id) /** * Deletes an existing WidgetText model. * If deletion is successful, the browser will be redirected to the 'index' page. - * @param integer $id + * @param integer|null $id * @return mixed */ - public function actionDelete($id) + public function actionDelete($id = null) { - $this->findModel($id)->delete(); + $id = $id ?: Yii::$app->request->post('id'); + WidgetText::deleteAll(['id' => $id]); + return $this->redirect(['index']); } diff --git a/views/article-category/_form.php b/views/article-category/_form.php index 13b1c3c..26f1451 100644 --- a/views/article-category/_form.php +++ b/views/article-category/_form.php @@ -68,7 +68,9 @@ field($model, 'parent_id')->dropDownList($categories, ['prompt' => '']) ?> - field($model, 'status')->checkbox() ?> + field($model, 'status')->checkbox([ + 'template' => '
{hint}{error}' + ]) ?>
isNewRecord ? Yii::t('i18ncontent', 'Create') : Yii::t('i18ncontent', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> diff --git a/views/article-category/index.php b/views/article-category/index.php index 66365a7..585ce2a 100644 --- a/views/article-category/index.php +++ b/views/article-category/index.php @@ -18,13 +18,32 @@

'Article Category', - ]), ['create'], ['class' => 'btn btn-success']) ?> + ]), ['create'], ['class' => 'btn btn-success']); + echo ' '. Html::a( + Yii::t('i18ncontent', 'Delete checked {modelClass}s', ['modelClass' => 'Article Category']), + [null], + ['class' => 'btn btn-danger delete-multiple']) + ?>

$dataProvider, 'filterModel' => $searchModel, 'columns' => [ + [ + 'class' => \centigen\base\grid\CheckboxColumn::className(), + 'prefix' => '
', + 'headerPrefix' => '
', + 'options' => [ + 'style' => 'width: 1px;', + 'class' => 'text-center', + ], + 'contentOptions' => [ + 'style' => 'vertical-align: middle;' + ] + ], 'slug', [ 'attribute' => 'title', diff --git a/views/article/_form.php b/views/article/_form.php index 6e80342..2ba3831 100644 --- a/views/article/_form.php +++ b/views/article/_form.php @@ -91,7 +91,9 @@ field($model, 'view')->textInput(['maxlength' => true]) ?> - field($model, 'status')->checkbox() ?> + field($model, 'status')->checkbox([ + 'template' => '
{hint}{error}' + ]) ?> field($model, 'published_at')->widget( 'trntv\yii\datetime\DateTimeWidget', diff --git a/views/article/index.php b/views/article/index.php index bf9ba57..f6089de 100644 --- a/views/article/index.php +++ b/views/article/index.php @@ -20,6 +20,12 @@ ['create'], ['class' => 'btn btn-success']) ?> + 'Article']), + [null], + ['class' => 'btn btn-danger delete-multiple']) + ?>

$dataProvider, 'filterModel' => $searchModel, 'columns' => [ + [ + 'class' => \centigen\base\grid\CheckboxColumn::className(), + 'prefix' => '
', + 'headerPrefix' => '
', + 'options' => [ + 'style' => 'width: 1px;', + 'class' => 'text-center', + ], + 'contentOptions' => [ + 'style' => 'vertical-align: middle;' + ] + ], [ 'attribute' => 'slug', 'contentOptions' => [ diff --git a/views/page/_form.php b/views/page/_form.php index c49b58f..002ae06 100644 --- a/views/page/_form.php +++ b/views/page/_form.php @@ -58,7 +58,9 @@ field($model, 'view')->textInput(['maxlength' => true]) ?> - field($model, 'status')->checkbox() ?> + field($model, 'status')->checkbox([ + 'template' => '
{hint}{error}' + ]) ?>
isNewRecord ? Yii::t('i18ncontent', 'Create') : Yii::t('i18ncontent', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> diff --git a/views/page/index.php b/views/page/index.php index 1e15ef3..7bb91f8 100644 --- a/views/page/index.php +++ b/views/page/index.php @@ -18,12 +18,32 @@ 'Page', ]), ['create'], ['class' => 'btn btn-success']) ?> + 'Pages']), + [null], + ['class' => 'btn btn-danger delete-multiple']) + ?>

$dataProvider, 'filterModel' => $searchModel, 'columns' => [ + [ + 'class' => \centigen\base\grid\CheckboxColumn::className(), + 'prefix' => '
', + 'headerPrefix' => '
', + 'options' => [ + 'style' => 'width: 1px;', + 'class' => 'text-center', + ], + 'contentOptions' => [ + 'style' => 'vertical-align: middle;' + ] + ], [ 'attribute' => 'title', 'value' => function ($model) { diff --git a/views/widget-carousel/_form.php b/views/widget-carousel/_form.php index 36e1643..50239e7 100644 --- a/views/widget-carousel/_form.php +++ b/views/widget-carousel/_form.php @@ -14,7 +14,9 @@ field($model, 'key')->textInput(['maxlength' => 1024]) ?> - field($model, 'status')->checkbox() ?> + field($model, 'status')->checkbox([ + 'template' => '
{hint}{error}' + ]) ?>
isNewRecord ? Yii::t('i18ncontent', 'Create') : Yii::t('i18ncontent', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> diff --git a/views/widget-carousel/index.php b/views/widget-carousel/index.php index 8febc38..0ddcd51 100644 --- a/views/widget-carousel/index.php +++ b/views/widget-carousel/index.php @@ -15,13 +15,32 @@

'Widget Carousel', - ]), ['create'], ['class' => 'btn btn-success']) ?> + ]), ['create'], ['class' => 'btn btn-success']); + echo ' '. Html::a( + Yii::t('i18ncontent', 'Delete checked {modelClass}s', ['modelClass' => 'Widget Carousel']), + [null], + ['class' => 'btn btn-danger delete-multiple']) + ?>

$dataProvider, 'filterModel' => $searchModel, 'columns' => [ + [ + 'class' => \centigen\base\grid\CheckboxColumn::className(), + 'prefix' => '
', + 'headerPrefix' => '
', + 'options' => [ + 'style' => 'width: 1px;', + 'class' => 'text-center', + ], + 'contentOptions' => [ + 'style' => 'vertical-align: middle;' + ] + ], 'key', [ 'label' => Yii::t('i18ncontent', 'Status'), diff --git a/views/widget-carousel/item/_form.php b/views/widget-carousel/item/_form.php index 2556a81..79afd38 100644 --- a/views/widget-carousel/item/_form.php +++ b/views/widget-carousel/item/_form.php @@ -74,7 +74,9 @@ ?> - field($model, 'status')->checkbox() ?> + field($model, 'status')->checkbox([ + 'template' => '
{hint}{error}' + ]) ?>
isNewRecord ? Yii::t('i18ncontent', 'Create') : Yii::t('i18ncontent', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> diff --git a/views/widget-carousel/update.php b/views/widget-carousel/update.php index 6892114..e7d172a 100644 --- a/views/widget-carousel/update.php +++ b/views/widget-carousel/update.php @@ -23,7 +23,13 @@

'Widget Carousel Item', - ]), ['widget-carousel-item/create', 'carousel_id' => $model->id], ['class' => 'btn btn-success']) ?> + ]), ['widget-carousel-item/create', 'carousel_id' => $model->id], ['class' => 'btn btn-success']); + + echo ' '. Html::a( + Yii::t('i18ncontent', 'Delete checked {modelClass}s', ['modelClass' => 'Widget Carousel Item']), + [null], + ['class' => 'btn btn-danger delete-multiple', 'data-url' => '/i18ncontent/widget-carousel-item/delete']); + ?>

[ + [ + 'class' => \centigen\base\grid\CheckboxColumn::className(), + 'prefix' => '
', + 'headerPrefix' => '
', + 'options' => [ + 'style' => 'width: 1px;', + 'class' => 'text-center', + ], + 'contentOptions' => [ + 'style' => 'vertical-align: middle;' + ] + ], [ 'attribute' => 'order', 'contentOptions' => [ diff --git a/views/widget-menu/_form.php b/views/widget-menu/_form.php index e5e24a4..1ce7a63 100644 --- a/views/widget-menu/_form.php +++ b/views/widget-menu/_form.php @@ -30,7 +30,9 @@ ] ) ?> - field($model, 'status')->checkbox() ?> + field($model, 'status')->checkbox([ + 'template' => '
{hint}{error}' + ]) ?>
isNewRecord ? Yii::t('i18ncontent', 'Create') : Yii::t('i18ncontent', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> diff --git a/views/widget-menu/index.php b/views/widget-menu/index.php index 89ab274..5a0f047 100644 --- a/views/widget-menu/index.php +++ b/views/widget-menu/index.php @@ -18,7 +18,12 @@

'Widget Menu', - ]), ['create'], ['class' => 'btn btn-success']) ?> + ]), ['create'], ['class' => 'btn btn-success']); + echo ' '. Html::a( + Yii::t('i18ncontent', 'Delete checked {modelClass}s', ['modelClass' => 'Widget Menu']), + [null], + ['class' => 'btn btn-danger delete-multiple']) + ?>

'grid-view table-responsive' ], 'columns' => [ + [ + 'class' => \centigen\base\grid\CheckboxColumn::className(), + 'prefix' => '
', + 'headerPrefix' => '
', + 'options' => [ + 'style' => 'width: 1px;', + 'class' => 'text-center', + ], + 'contentOptions' => [ + 'style' => 'vertical-align: middle;' + ] + ], 'title', 'key', [ diff --git a/views/widget-text/_form.php b/views/widget-text/_form.php index 7ffe2af..b17a4de 100644 --- a/views/widget-text/_form.php +++ b/views/widget-text/_form.php @@ -58,7 +58,9 @@ ?> - field($model, 'status')->checkbox() ?> + field($model, 'status')->checkbox([ + 'template' => '
{hint}{error}' + ]) ?>
'Text Block', - ]), ['create'], ['class' => 'btn btn-success']) ?> + ]), ['create'], ['class' => 'btn btn-success']); + echo ' '. Html::a( + Yii::t('i18ncontent', 'Delete checked {modelClass}s', ['modelClass' => 'Text Block']), + [null], + ['class' => 'btn btn-danger delete-multiple']) + ?>

$dataProvider, 'filterModel' => $searchModel, 'columns' => [ + [ + 'class' => \centigen\base\grid\CheckboxColumn::className(), + 'prefix' => '
', + 'headerPrefix' => '
', + 'options' => [ + 'style' => 'width: 1px;', + 'class' => 'text-center', + ], + 'contentOptions' => [ + 'style' => 'vertical-align: middle;' + ] + ], 'key', [ 'attribute' => 'title',