Commit ad2187adbd296733bb42eda134248541eea868ad
1 parent
95f0b726
- book, author in admin
Showing
3 changed files
with
21 additions
and
5 deletions
Show diff stats
backend/views/book/_form.php
1 | <?php | 1 | <?php |
2 | 2 | ||
3 | use artbox\core\admin\assets\Switchery; | 3 | use artbox\core\admin\assets\Switchery; |
4 | + use artbox\core\helpers\ImageHelper; | ||
4 | use dosamigos\tinymce\TinyMce; | 5 | use dosamigos\tinymce\TinyMce; |
5 | use kartik\select2\Select2; | 6 | use kartik\select2\Select2; |
6 | use yii\helpers\Html; | 7 | use yii\helpers\Html; |
@@ -34,7 +35,10 @@ JS; | @@ -34,7 +35,10 @@ JS; | ||
34 | 35 | ||
35 | <?= $form->field($model, 'title') | 36 | <?= $form->field($model, 'title') |
36 | ->textInput([ 'maxlength' => true ]) ?> | 37 | ->textInput([ 'maxlength' => true ]) ?> |
37 | - <?=$model->author->name.' '.$model->author->secondname?> | 38 | + <div class="form-group"> |
39 | + <?=ImageHelper::set('@storage/books/'.$model->id.'/'.$model->image)->cropResize(262, 390)->renderImage()?> | ||
40 | + </div> | ||
41 | + <?=$model->author->name.' '.$model->author->secondname?> | ||
38 | 42 | ||
39 | <?= $form->field($model, 'description') | 43 | <?= $form->field($model, 'description') |
40 | ->widget( | 44 | ->widget( |
@@ -84,13 +88,15 @@ window.open('" . Url::to( | @@ -84,13 +88,15 @@ window.open('" . Url::to( | ||
84 | ] | 88 | ] |
85 | ); | 89 | ); |
86 | ?> | 90 | ?> |
87 | - | 91 | + <?= $form->field($model, 'price') |
92 | + ->textInput() ?> | ||
88 | <?= $form->field($model, 'on_main') | 93 | <?= $form->field($model, 'on_main') |
89 | ->checkbox( | 94 | ->checkbox( |
90 | [ | 95 | [ |
91 | 'class' => 'switchery', | 96 | 'class' => 'switchery', |
92 | ] | 97 | ] |
93 | ) ?> | 98 | ) ?> |
99 | + | ||
94 | <div class="form-group"> | 100 | <div class="form-group"> |
95 | <?= Html::submitButton( | 101 | <?= Html::submitButton( |
96 | $model->isNewRecord ? Yii::t('core', 'Create') : Yii::t('core', 'Update'), | 102 | $model->isNewRecord ? Yii::t('core', 'Create') : Yii::t('core', 'Update'), |
backend/views/book/update.php
@@ -3,7 +3,7 @@ | @@ -3,7 +3,7 @@ | ||
3 | use yiister\gentelella\widgets\Panel; | 3 | use yiister\gentelella\widgets\Panel; |
4 | 4 | ||
5 | /* @var $this yii\web\View */ | 5 | /* @var $this yii\web\View */ |
6 | - /* @var $model artbox\core\models\Feedback */ | 6 | + /* @var $model \common\models\Book */ |
7 | 7 | ||
8 | $this->title = Yii::t( | 8 | $this->title = Yii::t( |
9 | 'core', | 9 | 'core', |
@@ -11,13 +11,13 @@ | @@ -11,13 +11,13 @@ | ||
11 | [ | 11 | [ |
12 | 'modelClass' => 'Book', | 12 | 'modelClass' => 'Book', |
13 | ] | 13 | ] |
14 | - ) . $model->name; | 14 | + ) . $model->title; |
15 | $this->params[ 'breadcrumbs' ][] = [ | 15 | $this->params[ 'breadcrumbs' ][] = [ |
16 | 'label' => Yii::t('app', 'Books'), | 16 | 'label' => Yii::t('app', 'Books'), |
17 | 'url' => [ 'index' ], | 17 | 'url' => [ 'index' ], |
18 | ]; | 18 | ]; |
19 | $this->params[ 'breadcrumbs' ][] = [ | 19 | $this->params[ 'breadcrumbs' ][] = [ |
20 | - 'label' => $model->name, | 20 | + 'label' => $model->title, |
21 | 'url' => [ | 21 | 'url' => [ |
22 | 'view', | 22 | 'view', |
23 | 'id' => $model->id, | 23 | 'id' => $model->id, |
backend/views/layouts/menu_items.php
@@ -45,6 +45,16 @@ | @@ -45,6 +45,16 @@ | ||
45 | 'url' => [ '/page-category/index' ], | 45 | 'url' => [ '/page-category/index' ], |
46 | 46 | ||
47 | ], | 47 | ], |
48 | + [ | ||
49 | + 'label' => \Yii::t('app', 'Books'), | ||
50 | + 'url' => [ '/book/index' ], | ||
51 | + | ||
52 | + ], | ||
53 | + [ | ||
54 | + 'label' => \Yii::t('app', 'Author'), | ||
55 | + 'url' => [ '/author/index' ], | ||
56 | + | ||
57 | + ], | ||
48 | ], | 58 | ], |
49 | ], | 59 | ], |
50 | 60 |