From f59447a78b02873a31517109c2a4ce1f806e2424 Mon Sep 17 00:00:00 2001 From: Yarik Date: Fri, 12 Feb 2016 11:58:19 +0200 Subject: [PATCH] test --- composer.lock | 2 +- frontend/controllers/AccountsController.php | 8 ++++++++ frontend/views/accounts/gallery.php | 18 ++++++++++++++++++ frontend/views/accounts/setting.php | 3 +-- 4 files changed, 28 insertions(+), 3 deletions(-) diff --git a/composer.lock b/composer.lock index b0efae9..b736686 100755 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "ccb155d1fc69bc6d276c50f0990fa1d7", + "hash": "dfde859453134d35dc61fc6825917302", "content-hash": "ec129e7be083837c52b871f4c8ec7f56", "packages": [ { diff --git a/frontend/controllers/AccountsController.php b/frontend/controllers/AccountsController.php index 72e6e0a..7e5e288 100755 --- a/frontend/controllers/AccountsController.php +++ b/frontend/controllers/AccountsController.php @@ -63,6 +63,7 @@ 'portfolio-delete' => [ 'POST' ], 'projects-delete' => [ 'POST' ], 'blog-delete' => [ 'POST' ], + 'gallery' => [ 'POST' ], ], ], ]; @@ -276,6 +277,13 @@ } } + public function actionGalleryDelete($id) + { + Gallery::findOne($id) + ->delete(); + $this->redirect('gallery'); + } + public function actionGeneral() { $user_info = UserInfo::find() diff --git a/frontend/views/accounts/gallery.php b/frontend/views/accounts/gallery.php index ed2c270..76b8d9b 100755 --- a/frontend/views/accounts/gallery.php +++ b/frontend/views/accounts/gallery.php @@ -43,5 +43,23 @@ 2 => 'Видео', ] ], + [ + 'class' => 'yii\grid\ActionColumn', + 'buttons' => [ + 'update' => function($url, $model, $key) { + return Html::a('Update', ['gallery-update', 'id' => $model->gallery_id]); + }, + 'delete' => function($url, $model, $key) { + return Html::a('Delete', ['gallery-delete', 'id' => $model->gallery_id], [ + 'title' => 'Удалить', + 'aria-label' => 'Удалить', + 'data-confirm' => 'Вы уверены, что хотите удалить этот элемент?', + 'data-method' => 'post', + 'data-pjax' => '0', + ]); + }, + ], + 'template' => '{update} {delete}' + ], ], ]) ?> diff --git a/frontend/views/accounts/setting.php b/frontend/views/accounts/setting.php index 36abccd..39f113c 100755 --- a/frontend/views/accounts/setting.php +++ b/frontend/views/accounts/setting.php @@ -2,11 +2,10 @@ /** * @var User $user */ - use common\models\Option; + use common\models\User; use yii\helpers\Html; use yii\widgets\ActiveForm; - use \common\widgets\MultiLangForm; $this->title = 'Настройки профиля'; $this->params['breadcrumbs'][] = $this->title; -- libgit2 0.21.4