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 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | use artbox\core\admin\assets\Switchery; |
| 4 | + use artbox\core\helpers\ImageHelper; | |
| 4 | 5 | use dosamigos\tinymce\TinyMce; |
| 5 | 6 | use kartik\select2\Select2; |
| 6 | 7 | use yii\helpers\Html; |
| ... | ... | @@ -34,7 +35,10 @@ JS; |
| 34 | 35 | |
| 35 | 36 | <?= $form->field($model, 'title') |
| 36 | 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 | 43 | <?= $form->field($model, 'description') |
| 40 | 44 | ->widget( |
| ... | ... | @@ -84,13 +88,15 @@ window.open('" . Url::to( |
| 84 | 88 | ] |
| 85 | 89 | ); |
| 86 | 90 | ?> |
| 87 | - | |
| 91 | + <?= $form->field($model, 'price') | |
| 92 | + ->textInput() ?> | |
| 88 | 93 | <?= $form->field($model, 'on_main') |
| 89 | 94 | ->checkbox( |
| 90 | 95 | [ |
| 91 | 96 | 'class' => 'switchery', |
| 92 | 97 | ] |
| 93 | 98 | ) ?> |
| 99 | + | |
| 94 | 100 | <div class="form-group"> |
| 95 | 101 | <?= Html::submitButton( |
| 96 | 102 | $model->isNewRecord ? Yii::t('core', 'Create') : Yii::t('core', 'Update'), | ... | ... |
backend/views/book/update.php
| ... | ... | @@ -3,7 +3,7 @@ |
| 3 | 3 | use yiister\gentelella\widgets\Panel; |
| 4 | 4 | |
| 5 | 5 | /* @var $this yii\web\View */ |
| 6 | - /* @var $model artbox\core\models\Feedback */ | |
| 6 | + /* @var $model \common\models\Book */ | |
| 7 | 7 | |
| 8 | 8 | $this->title = Yii::t( |
| 9 | 9 | 'core', |
| ... | ... | @@ -11,13 +11,13 @@ |
| 11 | 11 | [ |
| 12 | 12 | 'modelClass' => 'Book', |
| 13 | 13 | ] |
| 14 | - ) . $model->name; | |
| 14 | + ) . $model->title; | |
| 15 | 15 | $this->params[ 'breadcrumbs' ][] = [ |
| 16 | 16 | 'label' => Yii::t('app', 'Books'), |
| 17 | 17 | 'url' => [ 'index' ], |
| 18 | 18 | ]; |
| 19 | 19 | $this->params[ 'breadcrumbs' ][] = [ |
| 20 | - 'label' => $model->name, | |
| 20 | + 'label' => $model->title, | |
| 21 | 21 | 'url' => [ |
| 22 | 22 | 'view', |
| 23 | 23 | 'id' => $model->id, | ... | ... |
backend/views/layouts/menu_items.php
| ... | ... | @@ -45,6 +45,16 @@ |
| 45 | 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 | ... | ... |