Commit 69077fa92afc9f43cc860376637e8a12cd210798

Authored by Anastasia
1 parent e62495bf

- bug fix

backend/controllers/BookController.php
... ... @@ -70,6 +70,9 @@
70 70 'hasLanguage' => false,
71 71 'enableMassDelete' => true,
72 72 'modelPrimaryKey' => 'id',
  73 + 'defaultSort' => [
  74 + 'created_at' => 'DESC'
  75 + ],
73 76 'create' => true,
74 77 ],
75 78 ];
... ...
backend/views/layouts/menu_items.php
... ... @@ -2,6 +2,8 @@
2 2 use yii\web\UrlManager;
3 3  
4 4 $homeLink = [];
  5 +
  6 + $new = \common\models\Book::find()->where(['status' => \common\models\Book::STATUS_MODERATION])->count();
5 7 /**
6 8 * @var UrlManager $urlManagerFrontend
7 9 */
... ... @@ -33,7 +35,7 @@
33 35 [
34 36 'label' => \Yii::t('core', 'Pages'),
35 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 39 'items' => [
38 40 [
39 41 'label' => \Yii::t('core', 'Pages'),
... ... @@ -48,7 +50,7 @@
48 50 [
49 51 'label' => \Yii::t('app', 'Books'),
50 52 'url' => [ '/book/index' ],
51   -
  53 + 'template' => '<a href="{url}"><span>{label} </span>'.(!empty($new) ? "(". $new .")" : "")."</a>"
52 54 ],
53 55 [
54 56 'label' => \Yii::t('app', 'Author'),
... ...
frontend/controllers/SiteController.php
... ... @@ -207,5 +207,13 @@
207 207 public function actionView(){
208 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 49 'dateModified' => date('c', $this->model->updated_at),
50 50 'author' => [
51 51 '@type' => 'Person',
52   - 'name' => '',
  52 + 'name' => 'admin',
53 53 ],
54 54 'publisher' => [
55 55 '@type' => 'Organization',
56   - 'name' => '',
  56 + 'name' => 'admin',
57 57 'logo' => [
58 58 '@type' => "ImageObject",
59 59 'url' => $this->logoUrl,
... ...