Commit 69077fa92afc9f43cc860376637e8a12cd210798
1 parent
e62495bf
- bug fix
Showing
4 changed files
with
17 additions
and
4 deletions
 
Show diff stats
backend/controllers/BookController.php
| @@ -70,6 +70,9 @@ | @@ -70,6 +70,9 @@ | ||
| 70 | 'hasLanguage' => false, | 70 | 'hasLanguage' => false, | 
| 71 | 'enableMassDelete' => true, | 71 | 'enableMassDelete' => true, | 
| 72 | 'modelPrimaryKey' => 'id', | 72 | 'modelPrimaryKey' => 'id', | 
| 73 | + 'defaultSort' => [ | ||
| 74 | + 'created_at' => 'DESC' | ||
| 75 | + ], | ||
| 73 | 'create' => true, | 76 | 'create' => true, | 
| 74 | ], | 77 | ], | 
| 75 | ]; | 78 | ]; | 
backend/views/layouts/menu_items.php
| @@ -2,6 +2,8 @@ | @@ -2,6 +2,8 @@ | ||
| 2 | use yii\web\UrlManager; | 2 | use yii\web\UrlManager; | 
| 3 | 3 | ||
| 4 | $homeLink = []; | 4 | $homeLink = []; | 
| 5 | + | ||
| 6 | + $new = \common\models\Book::find()->where(['status' => \common\models\Book::STATUS_MODERATION])->count(); | ||
| 5 | /** | 7 | /** | 
| 6 | * @var UrlManager $urlManagerFrontend | 8 | * @var UrlManager $urlManagerFrontend | 
| 7 | */ | 9 | */ | 
| @@ -33,7 +35,7 @@ | @@ -33,7 +35,7 @@ | ||
| 33 | [ | 35 | [ | 
| 34 | 'label' => \Yii::t('core', 'Pages'), | 36 | 'label' => \Yii::t('core', 'Pages'), | 
| 35 | 'url' => '#', | 37 | 'url' => '#', | 
| 36 | - 'template' => '<a href="#"><b class="static"></b><span>{label}</span>{badge}</a>', | 38 | + 'template' => '<a href="#"><b class="static"></b><span>{label}</span>'.(!empty($new) ? "<span class=\"badge bg-green\">". $new ."</span>" : "").'{badge}</a>', | 
| 37 | 'items' => [ | 39 | 'items' => [ | 
| 38 | [ | 40 | [ | 
| 39 | 'label' => \Yii::t('core', 'Pages'), | 41 | 'label' => \Yii::t('core', 'Pages'), | 
| @@ -48,7 +50,7 @@ | @@ -48,7 +50,7 @@ | ||
| 48 | [ | 50 | [ | 
| 49 | 'label' => \Yii::t('app', 'Books'), | 51 | 'label' => \Yii::t('app', 'Books'), | 
| 50 | 'url' => [ '/book/index' ], | 52 | 'url' => [ '/book/index' ], | 
| 51 | - | 53 | + 'template' => '<a href="{url}"><span>{label} </span>'.(!empty($new) ? "(". $new .")" : "")."</a>" | 
| 52 | ], | 54 | ], | 
| 53 | [ | 55 | [ | 
| 54 | 'label' => \Yii::t('app', 'Author'), | 56 | 'label' => \Yii::t('app', 'Author'), | 
frontend/controllers/SiteController.php
| @@ -207,5 +207,13 @@ | @@ -207,5 +207,13 @@ | ||
| 207 | public function actionView(){ | 207 | public function actionView(){ | 
| 208 | return $this->render('view'); | 208 | return $this->render('view'); | 
| 209 | } | 209 | } | 
| 210 | + | ||
| 211 | + public function actionLogout() | ||
| 212 | + { | ||
| 213 | + \Yii::$app->user->setReturnUrl('index'); | ||
| 214 | + \Yii::$app->user->logout(); | ||
| 215 | + | ||
| 216 | + return $this->redirect([ 'index' ]); | ||
| 217 | + } | ||
| 210 | 218 | ||
| 211 | } | 219 | } | 
frontend/widgets/MicroDataWidget.php
| @@ -49,11 +49,11 @@ | @@ -49,11 +49,11 @@ | ||
| 49 | 'dateModified' => date('c', $this->model->updated_at), | 49 | 'dateModified' => date('c', $this->model->updated_at), | 
| 50 | 'author' => [ | 50 | 'author' => [ | 
| 51 | '@type' => 'Person', | 51 | '@type' => 'Person', | 
| 52 | - 'name' => '', | 52 | + 'name' => 'admin', | 
| 53 | ], | 53 | ], | 
| 54 | 'publisher' => [ | 54 | 'publisher' => [ | 
| 55 | '@type' => 'Organization', | 55 | '@type' => 'Organization', | 
| 56 | - 'name' => '', | 56 | + 'name' => 'admin', | 
| 57 | 'logo' => [ | 57 | 'logo' => [ | 
| 58 | '@type' => "ImageObject", | 58 | '@type' => "ImageObject", | 
| 59 | 'url' => $this->logoUrl, | 59 | 'url' => $this->logoUrl, | 
 
