Commit 7b765c308669d1b7837b316f73278a0e145872cc
Merge branch 'master' into similar
Showing
75 changed files
with
325 additions
and
173 deletions
Show diff stats
.gitignore
backend/controllers/BrandController.php
... | ... | @@ -102,7 +102,7 @@ class BrandController extends Controller |
102 | 102 | |
103 | 103 | if ($model->load(Yii::$app->request->post()) && $model->save()) { |
104 | 104 | |
105 | - return $this->redirect(['view', 'id' => $model->brand_id]); | |
105 | + return $this->redirect(['brand/view', 'id' => $model->brand_id]); | |
106 | 106 | } else { |
107 | 107 | return $this->render('update', [ |
108 | 108 | 'model' => $model, | ... | ... |
backend/views/brand/_form.php
1 | 1 | <?php |
2 | - | |
3 | -use yii\helpers\Html; | |
4 | -use yii\widgets\ActiveForm; | |
5 | - | |
6 | -/* @var $this yii\web\View */ | |
7 | -/* @var $model common\modules\product\models\Brand */ | |
8 | -/* @var $form yii\widgets\ActiveForm */ | |
2 | + | |
3 | + use mihaildev\ckeditor\CKEditor; | |
4 | + use mihaildev\elfinder\ElFinder; | |
5 | + use yii\helpers\Html; | |
6 | + use yii\widgets\ActiveForm; | |
7 | + | |
8 | + /* @var $this yii\web\View */ | |
9 | + /* @var $model common\modules\product\models\Brand */ | |
10 | + /* @var $form yii\widgets\ActiveForm */ | |
9 | 11 | ?> |
10 | 12 | |
11 | 13 | <div class="brand-form"> |
14 | + | |
15 | + <?php $form = ActiveForm::begin( | |
16 | + [ | |
17 | + 'enableClientValidation' => false, | |
18 | + 'options' => [ 'enctype' => 'multipart/form-data' ], | |
19 | + ] | |
20 | + ); ?> | |
21 | + | |
22 | + <?= $form->field($model, 'name') | |
23 | + ->textInput() ?> | |
24 | + | |
25 | + <?= $form->field($model, 'alias') | |
26 | + ->textInput([ 'maxlength' => true ]) ?> | |
27 | + | |
28 | + <?= $form->field($model, 'image') | |
29 | + ->widget( | |
30 | + \kartik\file\FileInput::classname(), | |
31 | + [ | |
32 | + 'language' => 'ru', | |
33 | + 'options' => [ | |
34 | + 'accept' => 'image/*', | |
35 | + 'multiple' => false, | |
36 | + ], | |
37 | + 'pluginOptions' => [ | |
38 | + 'allowedFileExtensions' => [ | |
39 | + 'jpg', | |
40 | + 'gif', | |
41 | + 'png', | |
42 | + ], | |
43 | + 'initialPreview' => !empty($model->imageUrl) ? \common\components\artboximage\ArtboxImageHelper::getImage( | |
44 | + $model->imageUrl, | |
45 | + 'list' | |
46 | + ) : '', | |
47 | + 'overwriteInitial' => true, | |
48 | + 'showRemove' => false, | |
49 | + 'showUpload' => false, | |
50 | + 'previewFileType' => 'image', | |
51 | + ], | |
52 | + ] | |
53 | + ); ?> | |
54 | + | |
55 | + <?= $form->field($model, 'description') | |
56 | + ->widget( | |
57 | + CKEditor::className(), | |
58 | + [ | |
59 | + 'editorOptions' => ElFinder::ckeditorOptions( | |
60 | + 'elfinder', | |
61 | + [ | |
62 | + 'preset' => 'full', | |
63 | + //разработанны стандартные настройки basic, standard, full данную возможность не обязательно использовать | |
64 | + 'inline' => false, | |
65 | + //по умолчанию false]), | |
66 | + 'filebrowserUploadUrl' => Yii::$app->getUrlManager() | |
67 | + ->createUrl('file/uploader/images-upload'), | |
68 | + ] | |
69 | + ), | |
70 | + ] | |
71 | + ) ?> | |
72 | + | |
73 | + <?= $form->field($model, 'meta_title') | |
74 | + ->textInput([ 'maxlength' => true ]) ?> | |
75 | + | |
76 | + <?= $form->field($model, 'meta_desc') | |
77 | + ->textarea([ 'rows' => 6 ]) ?> | |
78 | + | |
79 | + <?= $form->field($model, 'meta_robots') | |
80 | + ->textInput([ 'maxlength' => true ]) ?> | |
81 | + | |
82 | + <?= $form->field($model, 'seo_text') | |
83 | + ->textarea([ 'rows' => 6 ]) ?> | |
84 | + | |
85 | + <?= $form->field($model, 'in_menu') | |
86 | + ->checkbox() ?> | |
12 | 87 | |
13 | - <?php $form = ActiveForm::begin([ | |
14 | - 'enableClientValidation' => false, | |
15 | - 'options' => ['enctype' => 'multipart/form-data'] | |
16 | - ]); ?> | |
17 | - | |
18 | - <?= $form->field($model, 'name')->textInput() ?> | |
19 | - | |
20 | - <?= $form->field($model, 'alias')->textInput(['maxlength' => true]) ?> | |
21 | - | |
22 | - <?= $form->field($model, 'image')->widget(\kartik\file\FileInput::classname(), [ | |
23 | - 'language' => 'ru', | |
24 | - 'options' => [ | |
25 | - 'accept' => 'image/*', | |
26 | - 'multiple' => false, | |
27 | - ], | |
28 | - 'pluginOptions' => [ | |
29 | - 'allowedFileExtensions' => ['jpg', 'gif', 'png'], | |
30 | - 'initialPreview' => !empty($model->imageUrl) ? \common\components\artboximage\ArtboxImageHelper::getImage($model->imageUrl, 'list') : '', | |
31 | - 'overwriteInitial' => true, | |
32 | - 'showRemove' => false, | |
33 | - 'showUpload' => false, | |
34 | - 'previewFileType' => 'image', | |
35 | - ], | |
36 | - ]); ?> | |
37 | - | |
38 | - <?= $form->field($model, 'meta_title')->textInput(['maxlength' => true]) ?> | |
39 | - | |
40 | - <?= $form->field($model, 'meta_desc')->textarea(['rows' => 6]) ?> | |
41 | - | |
42 | - <?= $form->field($model, 'meta_robots')->textInput(['maxlength' => true]) ?> | |
43 | - | |
44 | - <?= $form->field($model, 'seo_text')->textarea(['rows' => 6]) ?> | |
45 | - | |
46 | - <?= $form->field($model, 'in_menu')->checkbox()?> | |
47 | - | |
48 | - <div class="form-group"> | |
49 | - <?= Html::submitButton($model->isNewRecord ? Yii::t('product', 'Create') : Yii::t('product', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> | |
50 | - <?php if ($model->isNewRecord) :?> | |
51 | - <?= Html::submitButton(Yii::t('product', 'Create and continue'), ['name' => 'create_and_new', 'class' => 'btn btn-primary']) ?> | |
52 | - <?php endif?> | |
53 | - </div> | |
54 | - | |
88 | + <div class="form-group"> | |
89 | + <?= Html::submitButton( | |
90 | + $model->isNewRecord ? Yii::t('product', 'Create') : Yii::t('product', 'Update'), | |
91 | + [ 'class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary' ] | |
92 | + ) ?> | |
93 | + <?php if ($model->isNewRecord) : ?> | |
94 | + <?= Html::submitButton( | |
95 | + Yii::t('product', 'Create and continue'), | |
96 | + [ | |
97 | + 'name' => 'create_and_new', | |
98 | + 'class' => 'btn btn-primary', | |
99 | + ] | |
100 | + ) ?> | |
101 | + <?php endif ?> | |
102 | + </div> | |
103 | + | |
55 | 104 | <?php ActiveForm::end(); ?> |
56 | 105 | |
57 | 106 | </div> | ... | ... |
common/modules/product/models/Brand.php
1 | 1 | <?php |
2 | - | |
3 | -namespace common\modules\product\models; | |
4 | - | |
5 | -use common\behaviors\SaveImgBehavior; | |
6 | -use common\behaviors\Slug; | |
7 | -use common\modules\rubrication\behaviors\ArtboxSynonymBehavior; | |
8 | -use yii\web\UploadedFile; | |
9 | -use Yii; | |
10 | - | |
11 | -/** | |
12 | - * This is the model class for table "brand". | |
13 | - * | |
14 | - * @property integer $brand_id | |
15 | - | |
16 | - * @property integer $brand_name_id | |
17 | - * @property string $alias | |
18 | - * @property string $image | |
19 | - * @property string $meta_title | |
20 | - * @property string $meta_desc | |
21 | - * @property string $meta_robots | |
22 | - * @property string $seo_text | |
23 | - * @property string $name | |
24 | - * | |
25 | - * @property BrandName $brandName | |
26 | - * @property BrandName[] $brandNames | |
27 | - * @property Product[] $products | |
28 | - */ | |
29 | -class Brand extends \yii\db\ActiveRecord | |
30 | -{ | |
31 | - public $imageUpload; | |
32 | - | |
33 | - public $_items_count = 0; | |
34 | - | |
2 | + | |
3 | + namespace common\modules\product\models; | |
4 | + | |
5 | + use common\behaviors\SaveImgBehavior; | |
6 | + use yii\db\ActiveRecord; | |
7 | + use Yii; | |
8 | + | |
35 | 9 | /** |
36 | - * @inheritdoc | |
10 | + * This is the model class for table "brand". | |
11 | + * | |
12 | + * @property integer $brand_id | |
13 | + * @property integer $brand_name_id | |
14 | + * @property string $alias | |
15 | + * @property string $image | |
16 | + * @property string $meta_title | |
17 | + * @property string $meta_desc | |
18 | + * @property string $meta_robots | |
19 | + * @property string $seo_text | |
20 | + * @property string $name | |
21 | + * @property string $description | |
22 | + * @property Product[] $products | |
37 | 23 | */ |
38 | - public static function tableName() | |
24 | + class Brand extends ActiveRecord | |
39 | 25 | { |
40 | - return 'brand'; | |
26 | + public $imageUpload; | |
27 | + | |
28 | + public $_items_count = 0; | |
29 | + | |
30 | + /** | |
31 | + * @inheritdoc | |
32 | + */ | |
33 | + public static function tableName() | |
34 | + { | |
35 | + return 'brand'; | |
36 | + } | |
37 | + | |
38 | + /** | |
39 | + * @inheritdoc | |
40 | + */ | |
41 | + | |
42 | + public function behaviors() | |
43 | + { | |
44 | + return [ | |
45 | + [ | |
46 | + 'class' => SaveImgBehavior::className(), | |
47 | + 'fields' => [ | |
48 | + [ | |
49 | + 'name' => 'image', | |
50 | + 'directory' => 'brands', | |
51 | + ], | |
52 | + ], | |
53 | + ], | |
54 | + 'slug' => [ | |
55 | + 'class' => 'common\behaviors\Slug', | |
56 | + 'in_attribute' => 'name', | |
57 | + 'out_attribute' => 'alias', | |
58 | + 'translit' => true, | |
59 | + ], | |
60 | + ]; | |
61 | + } | |
62 | + | |
63 | + /** | |
64 | + * @inheritdoc | |
65 | + */ | |
66 | + public function rules() | |
67 | + { | |
68 | + return [ | |
69 | + [ | |
70 | + [ | |
71 | + 'name', | |
72 | + 'description', | |
73 | + ], | |
74 | + 'string', | |
75 | + ], | |
76 | + [ | |
77 | + [ 'brand_name_id' ], | |
78 | + 'integer', | |
79 | + ], | |
80 | + [ | |
81 | + [ 'in_menu' ], | |
82 | + 'boolean', | |
83 | + ], | |
84 | + [ | |
85 | + [ | |
86 | + 'meta_desc', | |
87 | + 'seo_text', | |
88 | + ], | |
89 | + 'string', | |
90 | + ], | |
91 | + [ | |
92 | + [ | |
93 | + 'alias', | |
94 | + 'name', | |
95 | + ], | |
96 | + 'string', | |
97 | + 'max' => 250, | |
98 | + ], | |
99 | + [ | |
100 | + [ | |
101 | + 'meta_title', | |
102 | + 'image', | |
103 | + ], | |
104 | + 'string', | |
105 | + 'max' => 255, | |
106 | + ], | |
107 | + [ | |
108 | + [ 'meta_robots' ], | |
109 | + 'string', | |
110 | + 'max' => 50, | |
111 | + ], | |
112 | + [ | |
113 | + [ 'imageUpload' ], | |
114 | + 'safe', | |
115 | + ], | |
116 | + [ | |
117 | + [ 'imageUpload' ], | |
118 | + 'file', | |
119 | + 'extensions' => 'jpg, gif, png', | |
120 | + ], | |
121 | + ]; | |
122 | + } | |
123 | + | |
124 | + /** | |
125 | + * @inheritdoc | |
126 | + */ | |
127 | + public function attributeLabels() | |
128 | + { | |
129 | + return [ | |
130 | + 'name' => Yii::t('product', 'Name of the brand'), | |
131 | + 'brand_id' => Yii::t('product', 'Brand ID'), | |
132 | + 'brand_name_id' => Yii::t('product', 'Brand Name ID'), | |
133 | + 'alias' => Yii::t('product', 'Alias'), | |
134 | + 'image' => Yii::t('product', 'Image'), | |
135 | + 'imageUrl' => Yii::t('product', 'Image'), | |
136 | + 'meta_title' => Yii::t('product', 'Meta Title'), | |
137 | + 'meta_desc' => Yii::t('product', 'Meta Desc'), | |
138 | + 'meta_robots' => Yii::t('product', 'Meta Robots'), | |
139 | + 'seo_text' => Yii::t('product', 'Seo Text'), | |
140 | + 'in_menu' => Yii::t('product', 'Выводить в меню'), | |
141 | + 'description' => Yii::t('product', 'Описание'), | |
142 | + ]; | |
143 | + } | |
144 | + | |
145 | + /** | |
146 | + * @return \yii\db\ActiveQuery | |
147 | + */ | |
148 | + public function getProducts() | |
149 | + { | |
150 | + return $this->hasMany(Product::className(), [ 'brand_id' => 'brand_id' ]); | |
151 | + } | |
152 | + | |
153 | + public function getImageFile() | |
154 | + { | |
155 | + return empty($this->image) ? NULL : '/storage/brands/' . $this->image; | |
156 | + } | |
157 | + | |
158 | + public function getImageUrl() | |
159 | + { | |
160 | + return empty($this->image) ? NULL : '/storage/brands/' . $this->image; | |
161 | + } | |
162 | + | |
41 | 163 | } |
42 | - | |
43 | - | |
44 | - /** | |
45 | - * @inheritdoc | |
46 | - */ | |
47 | - | |
48 | - public function behaviors() | |
49 | - { | |
50 | - return [ | |
51 | - [ | |
52 | - 'class' => SaveImgBehavior::className(), | |
53 | - 'fields' => [ | |
54 | - ['name'=>'image','directory' => 'brands' ] | |
55 | - ] | |
56 | - ], | |
57 | - 'slug' => [ | |
58 | - 'class' => 'common\behaviors\Slug', | |
59 | - 'in_attribute' => 'name', | |
60 | - 'out_attribute' => 'alias', | |
61 | - 'translit' => true | |
62 | - ], | |
63 | - ]; | |
64 | - } | |
65 | - | |
66 | - /** | |
67 | - * @inheritdoc | |
68 | - */ | |
69 | - public function rules() | |
70 | - { | |
71 | - return [ | |
72 | - [['name'], 'string'], | |
73 | - [['brand_name_id'], 'integer'], | |
74 | - [['in_menu'], 'boolean'], | |
75 | - [['meta_desc', 'seo_text'], 'string'], | |
76 | - [['alias', 'name'], 'string', 'max' => 250], | |
77 | - [['meta_title', 'image'], 'string', 'max' => 255], | |
78 | - [['meta_robots'], 'string', 'max' => 50], | |
79 | - [['imageUpload'], 'safe'], | |
80 | - [['imageUpload'], 'file', 'extensions' => 'jpg, gif, png'], | |
81 | - ]; | |
82 | - } | |
83 | - | |
84 | - /** | |
85 | - * @inheritdoc | |
86 | - */ | |
87 | - public function attributeLabels() | |
88 | - { | |
89 | - return [ | |
90 | - 'name' => Yii::t('product', 'Name of the brand'), | |
91 | - 'brand_id' => Yii::t('product', 'Brand ID'), | |
92 | - 'brand_name_id' => Yii::t('product', 'Brand Name ID'), | |
93 | - 'alias' => Yii::t('product', 'Alias'), | |
94 | - 'image' => Yii::t('product', 'Image'), | |
95 | - 'imageUrl' => Yii::t('product', 'Image'), | |
96 | - 'meta_title' => Yii::t('product', 'Meta Title'), | |
97 | - 'meta_desc' => Yii::t('product', 'Meta Desc'), | |
98 | - 'meta_robots' => Yii::t('product', 'Meta Robots'), | |
99 | - 'seo_text' => Yii::t('product', 'Seo Text'), | |
100 | - 'in_menu' => Yii::t('product', 'Выводить в меню'), | |
101 | - ]; | |
102 | - } | |
103 | - | |
104 | - | |
105 | - | |
106 | - /** | |
107 | - * @return \yii\db\ActiveQuery | |
108 | - */ | |
109 | - public function getProducts() | |
110 | - { | |
111 | - return $this->hasMany(Product::className(), ['brand_id' => 'brand_id']); | |
112 | - } | |
113 | - | |
114 | - public function getImageFile() { | |
115 | - return empty($this->image) ? null : '/storage/brands/'. $this->image; | |
116 | - } | |
117 | - | |
118 | - public function getImageUrl() { | |
119 | - return empty($this->image) ? null : '/storage/brands/'. $this->image; | |
120 | - } | |
121 | - | |
122 | -} | ... | ... |
console/migrations/m170202_140836_add_description_column_to_brand_table.php
0 → 100644
1 | +<?php | |
2 | + | |
3 | +use yii\db\Migration; | |
4 | + | |
5 | +/** | |
6 | + * Handles adding description to table `brand`. | |
7 | + */ | |
8 | +class m170202_140836_add_description_column_to_brand_table extends Migration | |
9 | +{ | |
10 | + /** | |
11 | + * @inheritdoc | |
12 | + */ | |
13 | + public function up() | |
14 | + { | |
15 | + $this->addColumn('brand', 'description', $this->text()); | |
16 | + } | |
17 | + | |
18 | + /** | |
19 | + * @inheritdoc | |
20 | + */ | |
21 | + public function down() | |
22 | + { | |
23 | + $this->dropColumn('brand', 'description'); | |
24 | + } | |
25 | +} | ... | ... |
frontend/views/catalog/brand.php
... | ... | @@ -45,8 +45,15 @@ $this->params['breadcrumbs'][] = $brand->name; |
45 | 45 | |
46 | 46 | <h1 class="title"><?= Seo::widget(['row' => 'h1']) ?></h1> |
47 | 47 | |
48 | + <div class="brand-seo-text"> | |
49 | + <?php | |
50 | + if(!empty($brand->description)) echo $brand->description; | |
51 | + ?> | |
52 | + </div> | |
53 | + <div class="clearfix"></div> | |
48 | 54 | |
49 | - <div class="list_filters_links"> | |
55 | + | |
56 | + <div class="list_filters_links"> | |
50 | 57 | <div class="sort_block"> |
51 | 58 | <span>Сортировка:</span> |
52 | 59 | <?= \yii\widgets\LinkSorter::widget([ | ... | ... |
frontend/web/css/css_header.css
... | ... | @@ -20,6 +20,32 @@ |
20 | 20 | width: auto!important |
21 | 21 | } |
22 | 22 | |
23 | +/* Arrows in sorter styling */ | |
24 | +ul.sorter { | |
25 | + list-style-type: none; | |
26 | +} | |
27 | + | |
28 | +ul.sorter li a:after { | |
29 | + display: inline-block; | |
30 | + margin-left: 4px; | |
31 | + margin-bottom: 2px; | |
32 | + content: ''; | |
33 | + width: 0; | |
34 | + height: 0; | |
35 | +} | |
36 | + | |
37 | +ul.sorter li a.asc:after { | |
38 | + border-left: 5px solid transparent; | |
39 | + border-right: 5px solid transparent; | |
40 | + border-bottom: 5px solid black; | |
41 | +} | |
42 | + | |
43 | +ul.sorter li a.desc:after { | |
44 | + border-left: 5px solid transparent; | |
45 | + border-right: 5px solid transparent; | |
46 | + border-top: 5px solid black; | |
47 | +} | |
48 | + | |
23 | 49 | html { |
24 | 50 | font-family: sans-serif; |
25 | 51 | -ms-text-size-adjust: 100%; |
... | ... | @@ -6549,6 +6575,11 @@ header a#logo img { |
6549 | 6575 | width: 100% |
6550 | 6576 | } |
6551 | 6577 | |
6578 | +.brand-seo-text { | |
6579 | + margin-bottom: 20px; | |
6580 | + padding: 0px 5px; | |
6581 | +} | |
6582 | + | |
6552 | 6583 | #brand_bar { |
6553 | 6584 | float: left; |
6554 | 6585 | width: 100%; |
... | ... | @@ -10155,7 +10186,7 @@ footer .vacancies p { |
10155 | 10186 | border-right: none |
10156 | 10187 | } |
10157 | 10188 | |
10158 | -#myItemCarousel .product_item .info .title,,.prodview .product_item .title { | |
10189 | +#myItemCarousel .product_item .info .title,.prodview .product_item .title { | |
10159 | 10190 | font-size: 13px; |
10160 | 10191 | min-height: 45px; |
10161 | 10192 | padding: 5px 10px 0 0 |
... | ... | @@ -11479,7 +11510,7 @@ a.preview { |
11479 | 11510 | } |
11480 | 11511 | |
11481 | 11512 | .modal-body input:-webkit-autofill,.modal-body textarea:-webkit-autofill,.modal-body select:-webkit-autofill { |
11482 | - -webkit-text-fill-color: $ textColor; | |
11513 | + /*-webkit-text-fill-color: $ textColor;*/ | |
11483 | 11514 | -webkit-box-shadow: 0 0 0 1000px #eaeaea inset; |
11484 | 11515 | background-color: #eaeaea |
11485 | 11516 | } |
... | ... | @@ -23456,7 +23487,7 @@ border-right: none |
23456 | 23487 | border-right: none |
23457 | 23488 | } |
23458 | 23489 | |
23459 | -#myItemCarousel .product_item .info .title,,.prodview .product_item .title { | |
23490 | +#myItemCarousel .product_item .info .title,.prodview .product_item .title { | |
23460 | 23491 | font-size: 13px; |
23461 | 23492 | min-height: 45px; |
23462 | 23493 | padding: 5px 10px 0 0 |
... | ... | @@ -24780,7 +24811,7 @@ border-color: #dbdbdb |
24780 | 24811 | } |
24781 | 24812 | |
24782 | 24813 | .modal-body input:-webkit-autofill,.modal-body textarea:-webkit-autofill,.modal-body select:-webkit-autofill { |
24783 | --webkit-text-fill-color: $ textColor; | |
24814 | +/*-webkit-text-fill-color: $ textColor;*/ | |
24784 | 24815 | -webkit-box-shadow: 0 0 0 1000px #eaeaea inset; |
24785 | 24816 | background-color: #eaeaea |
24786 | 24817 | } | ... | ... |
6.18 KB
1.18 KB
7.18 KB
169 Bytes
4.05 KB
178 Bytes
1.39 KB
2.18 KB
1.73 KB
1.26 KB
1.78 KB
1.63 KB
1.73 KB
228 Bytes
7.8 KB
No preview for this file type
22.6 KB
177 Bytes
974 Bytes
17.2 KB
132 Bytes
132 Bytes
994 Bytes
837 Bytes
188 Bytes
165 Bytes
221 Bytes
1.83 KB
1.56 KB
202 Bytes
1.01 KB
213 Bytes
1 KB
1 KB
996 Bytes
323 Bytes
541 Bytes
254 Bytes
377 Bytes
942 Bytes
396 Bytes
6.9 KB
171 Bytes
1.83 KB
169 Bytes
1.04 KB
426 Bytes
11.4 KB
2.83 KB
1.65 KB
8 KB
137 KB
1.59 KB
18.5 KB
2.45 KB
6.75 KB
5.35 KB
1.36 KB
1.36 KB
6.81 KB
4.34 KB
268 Bytes
309 Bytes
10.3 KB
8.48 KB
12.1 KB
8.04 KB
178 Bytes