Commit ba196ec2a73b4cb2d3c0e6755a8f6c57bb4fd8e2
1 parent
3b1725bf
-Blog in process
Showing
27 changed files
with
421 additions
and
422 deletions
Show diff stats
controllers/ArticleController.php
... | ... | @@ -87,22 +87,22 @@ |
87 | 87 | { |
88 | 88 | $model = new Article(); |
89 | 89 | $model->generateLangs(); |
90 | - | |
91 | - $categories = ArrayHelper::map( | |
92 | - BlogCategory::find() | |
93 | - ->joinWith('lang') | |
94 | - ->all(), | |
95 | - 'id', | |
96 | - 'lang.title' | |
97 | - ); | |
98 | - | |
99 | - $tags = ArrayHelper::map( | |
100 | - BlogTag::find() | |
101 | - ->joinWith('lang') | |
102 | - ->all(), | |
103 | - 'id', | |
104 | - 'lang.label' | |
105 | - ); | |
90 | + | |
91 | + // $categories = ArrayHelper::map( | |
92 | + // BlogCategory::find() | |
93 | + // ->joinWith('lang') | |
94 | + // ->all(), | |
95 | + // 'id', | |
96 | + // 'lang.title' | |
97 | + // ); | |
98 | + // | |
99 | + // $tags = ArrayHelper::map( | |
100 | + // BlogTag::find() | |
101 | + // ->joinWith('lang') | |
102 | + // ->all(), | |
103 | + // 'id', | |
104 | + // 'lang.label' | |
105 | + // ); | |
106 | 106 | |
107 | 107 | if ($model->load(Yii::$app->request->post())) { |
108 | 108 | $model->loadLangs(\Yii::$app->request); |
... | ... | @@ -153,8 +153,8 @@ |
153 | 153 | [ |
154 | 154 | 'model' => $model, |
155 | 155 | 'modelLangs' => $model->modelLangs, |
156 | - 'categories' => $categories, | |
157 | - 'tags' => $tags, | |
156 | + // 'categories' => $categories, | |
157 | + // 'tags' => $tags, | |
158 | 158 | 'products' => [], |
159 | 159 | 'articles' => [], |
160 | 160 | ] |
... | ... | @@ -287,75 +287,75 @@ |
287 | 287 | return $this->redirect([ 'index' ]); |
288 | 288 | } |
289 | 289 | |
290 | - public function actionDeleteImage($id) | |
291 | - { | |
292 | - $model = $this->findModel($id); | |
293 | - $model->image = null; | |
294 | - $model->updateAttributes(['image']); | |
295 | - return true; | |
296 | - } | |
297 | - | |
298 | 290 | /** |
299 | 291 | * Finds the BlogArticle model based on its primary key value. |
300 | 292 | * If the model is not found, a 404 HTTP exception will be thrown. |
293 | + | |
294 | +* | |
295 | +*@param integer $id | |
301 | 296 | * |
302 | - * @param integer $id | |
303 | - * | |
304 | - * @return BlogArticle the loaded model | |
297 | +*@return Article the loaded model | |
305 | 298 | * @throws NotFoundHttpException if the model cannot be found |
306 | 299 | */ |
307 | 300 | protected function findModel($id) |
308 | 301 | { |
309 | - if (( $model = BlogArticle::findOne($id) ) !== NULL) { | |
302 | + if (( $model = Article::findOne($id) ) !== null) { | |
310 | 303 | return $model; |
311 | 304 | } else { |
312 | 305 | throw new NotFoundHttpException('The requested page does not exist.'); |
313 | 306 | } |
314 | 307 | } |
315 | - | |
316 | - /** | |
317 | - * @param string $q | |
318 | - * @param null $id | |
319 | - * | |
320 | - * @return array | |
321 | - */ | |
322 | - public function actionProductList($q = NULL, $id = NULL) | |
308 | + | |
309 | + public function actionList($q = null, $id = null) | |
323 | 310 | { |
324 | 311 | \Yii::$app->response->format = Response::FORMAT_JSON; |
325 | 312 | $out = [ |
326 | 313 | 'results' => [ |
327 | - 'id' => '', | |
328 | - 'text' => '', | |
314 | + [ | |
315 | + 'id' => '', | |
316 | + 'text' => '', | |
317 | + ], | |
329 | 318 | ], |
330 | 319 | ]; |
331 | 320 | if (!is_null($q)) { |
332 | - $out[ 'results' ] = Product::find() | |
333 | - ->joinWith('lang') | |
334 | - ->select( | |
335 | - [ | |
336 | - 'id', | |
337 | - 'product_lang.title as text', | |
338 | - ] | |
339 | - ) | |
340 | - ->where( | |
341 | - [ | |
342 | - 'like', | |
343 | - 'product_lang.title', | |
344 | - $q, | |
345 | - ] | |
346 | - ) | |
347 | - ->limit(20) | |
348 | - ->asArray() | |
349 | - ->all(); | |
350 | - } elseif ($id > 0) { | |
351 | - $out[ 'results' ] = [ | |
352 | - 'id' => $id, | |
353 | - 'text' => Product::find() | |
321 | + $categories = Article::find() | |
354 | 322 | ->joinWith('lang') |
355 | - ->where([ 'id' => $id ]) | |
356 | - ->one()->title, | |
357 | - ]; | |
323 | + ->select( | |
324 | + [ | |
325 | + 'id', | |
326 | + 'text' => 'category_lang.title', | |
327 | + ] | |
328 | + ) | |
329 | + ->filterWhere( | |
330 | + [ | |
331 | + '!=', | |
332 | + 'id', | |
333 | + $id, | |
334 | + ] | |
335 | + ) | |
336 | + ->andFilterWhere( | |
337 | + [ | |
338 | + 'like', | |
339 | + 'category_lang.title', | |
340 | + $q, | |
341 | + ] | |
342 | + ) | |
343 | + ->andFilterWhere( | |
344 | + [ | |
345 | + '!=', | |
346 | + 'parent_id', | |
347 | + $id, | |
348 | + ] | |
349 | + ) | |
350 | + ->limit(20) | |
351 | + ->asArray() | |
352 | + ->all(); | |
353 | + | |
354 | + if (!empty($categories)) { | |
355 | + $out[ 'results' ] = $categories; | |
356 | + } | |
358 | 357 | } |
358 | + | |
359 | 359 | return $out; |
360 | 360 | } |
361 | 361 | ... | ... |
controllers/BlogCategoryController.php renamed to controllers/CategoryController.php
1 | 1 | <?php |
2 | 2 | |
3 | 3 | namespace artbox\weblog\controllers; |
4 | - | |
4 | + | |
5 | + use artbox\weblog\models\CategorySearch; | |
5 | 6 | use Yii; |
6 | - use artbox\weblog\models\BlogCategory; | |
7 | - use artbox\weblog\models\BlogCategorySearch; | |
8 | 7 | use yii\helpers\ArrayHelper; |
9 | 8 | use yii\web\Controller; |
10 | 9 | use yii\web\NotFoundHttpException; |
11 | 10 | use yii\filters\VerbFilter; |
12 | - | |
11 | + | |
13 | 12 | /** |
14 | 13 | * BlogCategoryController implements the CRUD actions for BlogCategory model. |
15 | 14 | */ |
16 | - class BlogCategoryController extends Controller | |
15 | + class CategoryController extends Controller | |
17 | 16 | { |
18 | 17 | /** |
19 | 18 | * @inheritdoc |
20 | 19 | */ |
20 | + public function getViewPath() | |
21 | + { | |
22 | + return '@artbox/weblog/views/blog-category'; | |
23 | + } | |
24 | + | |
25 | + /** | |
26 | + * @inheritdoc | |
27 | + */ | |
21 | 28 | public function behaviors() |
22 | 29 | { |
23 | 30 | return [ |
... | ... | @@ -29,7 +36,7 @@ |
29 | 36 | ], |
30 | 37 | ]; |
31 | 38 | } |
32 | - | |
39 | + | |
33 | 40 | /** |
34 | 41 | * Lists all BlogCategory models. |
35 | 42 | * |
... | ... | @@ -37,9 +44,9 @@ |
37 | 44 | */ |
38 | 45 | public function actionIndex() |
39 | 46 | { |
40 | - $searchModel = new BlogCategorySearch(); | |
47 | + $searchModel = new CategorySearch(); | |
41 | 48 | $dataProvider = $searchModel->search(Yii::$app->request->queryParams); |
42 | - | |
49 | + | |
43 | 50 | return $this->render( |
44 | 51 | 'index', |
45 | 52 | [ |
... | ... | @@ -48,7 +55,7 @@ |
48 | 55 | ] |
49 | 56 | ); |
50 | 57 | } |
51 | - | |
58 | + | |
52 | 59 | /** |
53 | 60 | * Displays a single BlogCategory model. |
54 | 61 | * |
... | ... | @@ -65,7 +72,7 @@ |
65 | 72 | ] |
66 | 73 | ); |
67 | 74 | } |
68 | - | |
75 | + | |
69 | 76 | /** |
70 | 77 | * Creates a new BlogCategory model. |
71 | 78 | * If creation is successful, the browser will be redirected to the 'view' page. |
... | ... | @@ -88,7 +95,7 @@ |
88 | 95 | 'id', |
89 | 96 | 'lang.title' |
90 | 97 | ); |
91 | - | |
98 | + | |
92 | 99 | if ($model->load(Yii::$app->request->post())) { |
93 | 100 | $model->loadLangs(\Yii::$app->request); |
94 | 101 | if ($model->save() && $model->transactionStatus) { |
... | ... | @@ -108,9 +115,9 @@ |
108 | 115 | 'parentCategories' => $parentCategories, |
109 | 116 | ] |
110 | 117 | ); |
111 | - | |
118 | + | |
112 | 119 | } |
113 | - | |
120 | + | |
114 | 121 | /** |
115 | 122 | * Updates an existing BlogCategory model. |
116 | 123 | * If update is successful, the browser will be redirected to the 'view' page. |
... | ... | @@ -142,7 +149,7 @@ |
142 | 149 | 'id', |
143 | 150 | 'lang.title' |
144 | 151 | ); |
145 | - | |
152 | + | |
146 | 153 | if ($model->load(Yii::$app->request->post())) { |
147 | 154 | $model->loadLangs(\Yii::$app->request); |
148 | 155 | if ($model->save() && $model->transactionStatus) { |
... | ... | @@ -162,9 +169,9 @@ |
162 | 169 | 'parentCategories' => $parentCategories, |
163 | 170 | ] |
164 | 171 | ); |
165 | - | |
172 | + | |
166 | 173 | } |
167 | - | |
174 | + | |
168 | 175 | /** |
169 | 176 | * Deletes an existing BlogCategory model. |
170 | 177 | * If deletion is successful, the browser will be redirected to the 'index' page. |
... | ... | @@ -177,7 +184,7 @@ |
177 | 184 | { |
178 | 185 | $this->findModel($id) |
179 | 186 | ->delete(); |
180 | - | |
187 | + | |
181 | 188 | return $this->redirect([ 'index' ]); |
182 | 189 | } |
183 | 190 | |
... | ... | @@ -188,7 +195,7 @@ |
188 | 195 | $model->updateAttributes(['image']); |
189 | 196 | return true; |
190 | 197 | } |
191 | - | |
198 | + | |
192 | 199 | /** |
193 | 200 | * Finds the BlogCategory model based on its primary key value. |
194 | 201 | * If the model is not found, a 404 HTTP exception will be thrown. | ... | ... |
controllers/BlogTagController.php renamed to controllers/TagController.php
1 | 1 | <?php |
2 | 2 | |
3 | - namespace artweb\artbox\blog\controllers; | |
3 | + namespace artbox\weblog\controllers; | |
4 | 4 | |
5 | + use artbox\weblog\models\TagSearch; | |
5 | 6 | use Yii; |
6 | - use artbox\weblog\models\BlogTag; | |
7 | - use artbox\weblog\models\BlogTagSearch; | |
8 | 7 | use yii\web\Controller; |
9 | 8 | use yii\web\NotFoundHttpException; |
10 | 9 | use yii\filters\VerbFilter; |
... | ... | @@ -12,8 +11,13 @@ |
12 | 11 | /** |
13 | 12 | * BlogTagController implements the CRUD actions for BlogTag model. |
14 | 13 | */ |
15 | - class BlogTagController extends Controller | |
14 | + class TagController extends Controller | |
16 | 15 | { |
16 | + public function getViewPath() | |
17 | + { | |
18 | + return '@artbox/weblog/views/blog-tag'; | |
19 | + } | |
20 | + | |
17 | 21 | /** |
18 | 22 | * @inheritdoc |
19 | 23 | */ |
... | ... | @@ -36,7 +40,7 @@ |
36 | 40 | */ |
37 | 41 | public function actionIndex() |
38 | 42 | { |
39 | - $searchModel = new BlogTagSearch(); | |
43 | + $searchModel = new TagSearch(); | |
40 | 44 | $dataProvider = $searchModel->search(Yii::$app->request->queryParams); |
41 | 45 | |
42 | 46 | return $this->render( | ... | ... |
migrations/m161101_142334_blog_article.php
migrations/m161101_142752_blog_article_lang.php
... | ... | @@ -12,19 +12,15 @@ |
12 | 12 | $this->createTable( |
13 | 13 | 'blog_article_lang', |
14 | 14 | [ |
15 | - 'id' => $this->primaryKey(), | |
16 | - 'blog_article_id' => $this->integer() | |
15 | + 'id' => $this->primaryKey(), | |
16 | + 'blog_article_id' => $this->integer() | |
17 | 17 | ->notNull(), |
18 | - 'language_id' => $this->integer() | |
19 | - ->notNull(), | |
20 | - 'title' => $this->string(255), | |
21 | - 'body' => $this->text(), | |
22 | - 'body_preview' => $this->text(), | |
23 | - 'alias' => $this->string(255), | |
24 | - 'meta_title' => $this->string(255), | |
25 | - 'meta_description' => $this->string(255), | |
26 | - 'h1' => $this->string(255), | |
27 | - 'seo_text' => $this->string(255), | |
18 | + 'language_id' => $this->integer() | |
19 | + ->notNull(), | |
20 | + 'title' => $this->string(255), | |
21 | + 'body' => $this->text(), | |
22 | + 'body_preview' => $this->text(), | |
23 | + 'alias_id' => $this->integer(), | |
28 | 24 | ] |
29 | 25 | ); |
30 | 26 | |
... | ... | @@ -44,7 +40,7 @@ |
44 | 40 | $this->createIndex( |
45 | 41 | 'blog_article_alias_uk', |
46 | 42 | 'blog_article_lang', |
47 | - 'alias', | |
43 | + 'alias_id', | |
48 | 44 | true |
49 | 45 | ); |
50 | 46 | ... | ... |
migrations/m161101_143033_blog_category.php
migrations/m161101_143259_blog_category_lang.php
... | ... | @@ -18,12 +18,8 @@ |
18 | 18 | 'language_id' => $this->integer() |
19 | 19 | ->notNull(), |
20 | 20 | 'title' => $this->string(255), |
21 | - 'alias' => $this->string(255), | |
21 | + 'alias_id' => $this->integer(), | |
22 | 22 | 'description' => $this->text(), |
23 | - 'meta_title' => $this->string(255), | |
24 | - 'meta_description' => $this->string(255), | |
25 | - 'h1' => $this->string(255), | |
26 | - 'seo_text' => $this->string(255), | |
27 | 23 | ] |
28 | 24 | ); |
29 | 25 | |
... | ... | @@ -43,7 +39,7 @@ |
43 | 39 | $this->createIndex( |
44 | 40 | 'blog_category_alias_uk', |
45 | 41 | 'blog_category_lang', |
46 | - 'alias', | |
42 | + 'alias_id', | |
47 | 43 | true |
48 | 44 | ); |
49 | 45 | ... | ... |
migrations/m161101_143541_blog_article_to_category.php
migrations/m161101_143939_blog_tag_lang.php
... | ... | @@ -17,6 +17,7 @@ |
17 | 17 | ->notNull(), |
18 | 18 | 'language_id' => $this->integer() |
19 | 19 | ->notNull(), |
20 | + 'alias_id' => $this->integer(), | |
20 | 21 | 'label' => $this->string(255), |
21 | 22 | ] |
22 | 23 | ); |
... | ... | @@ -33,6 +34,8 @@ |
33 | 34 | ], |
34 | 35 | true |
35 | 36 | ); |
37 | + | |
38 | + $this->createIndex('blog_tag_lang_auk', 'blog_tag_lang', 'alias_id', true); | |
36 | 39 | |
37 | 40 | $this->addForeignKey( |
38 | 41 | 'blog_tag_lang_fk', | ... | ... |
migrations/m161101_144140_blog_article_to_tag.php
migrations/m161101_144312_blog_article_to_article.php
migrations/m161101_144434_blog_article_to_product.php
models/Article.php
... | ... | @@ -90,6 +90,7 @@ |
90 | 90 | 'deleted_at', |
91 | 91 | 'sort', |
92 | 92 | 'author_id', |
93 | + 'image_id', | |
93 | 94 | ], |
94 | 95 | 'integer', |
95 | 96 | ], |
... | ... | @@ -97,11 +98,6 @@ |
97 | 98 | [ 'status' ], |
98 | 99 | 'boolean', |
99 | 100 | ], |
100 | - [ | |
101 | - [ 'image' ], | |
102 | - 'string', | |
103 | - 'max' => 255, | |
104 | - ], | |
105 | 101 | ]; |
106 | 102 | } |
107 | 103 | ... | ... |
models/ArticleLang.php
1 | 1 | <?php |
2 | 2 | |
3 | 3 | namespace artbox\weblog\models; |
4 | - | |
4 | + | |
5 | + use artbox\core\behaviors\SlugBehavior; | |
5 | 6 | use artbox\core\models\Language; |
6 | 7 | use yii\db\ActiveRecord; |
7 | - | |
8 | + | |
8 | 9 | /** |
9 | 10 | * This is the model class for table "blog_article_lang". |
10 | 11 | * |
... | ... | @@ -31,12 +32,23 @@ |
31 | 32 | { |
32 | 33 | return 'blog_article_lang'; |
33 | 34 | } |
34 | - | |
35 | + | |
35 | 36 | public function behaviors() |
36 | 37 | { |
37 | - return []; | |
38 | + return [ | |
39 | + 'slug' => [ | |
40 | + 'class' => SlugBehavior::className(), | |
41 | + 'action' => 'article/view', | |
42 | + 'params' => [ | |
43 | + 'id' => 'blog_article_id', | |
44 | + ], | |
45 | + 'fields' => [ | |
46 | + 'title' => 'Article title', | |
47 | + ], | |
48 | + ], | |
49 | + ]; | |
38 | 50 | } |
39 | - | |
51 | + | |
40 | 52 | /** |
41 | 53 | * @inheritdoc |
42 | 54 | */ |
... | ... | @@ -68,19 +80,11 @@ |
68 | 80 | [ |
69 | 81 | [ |
70 | 82 | 'title', |
71 | - 'alias', | |
72 | - 'meta_title', | |
73 | - 'meta_description', | |
74 | - 'h1', | |
75 | - 'seo_text', | |
76 | 83 | ], |
77 | 84 | 'string', |
78 | 85 | 'max' => 255, |
79 | 86 | ], |
80 | - [ | |
81 | - [ 'alias' ], | |
82 | - 'unique', | |
83 | - ], | |
87 | + | |
84 | 88 | [ |
85 | 89 | [ |
86 | 90 | 'blog_article_id', |
... | ... | @@ -109,7 +113,7 @@ |
109 | 113 | ], |
110 | 114 | ]; |
111 | 115 | } |
112 | - | |
116 | + | |
113 | 117 | /** |
114 | 118 | * @inheritdoc |
115 | 119 | */ |
... | ... | @@ -129,7 +133,7 @@ |
129 | 133 | 'seo_text' => 'Seo Text', |
130 | 134 | ]; |
131 | 135 | } |
132 | - | |
136 | + | |
133 | 137 | /** |
134 | 138 | * @return \yii\db\ActiveQuery |
135 | 139 | */ |
... | ... | @@ -137,7 +141,7 @@ |
137 | 141 | { |
138 | 142 | return $this->hasOne(Article::className(), [ 'id' => 'blog_article_id' ]); |
139 | 143 | } |
140 | - | |
144 | + | |
141 | 145 | /** |
142 | 146 | * @return \yii\db\ActiveQuery |
143 | 147 | */ | ... | ... |
models/ArticleSearch.php
... | ... | @@ -30,10 +30,6 @@ |
30 | 30 | 'integer', |
31 | 31 | ], |
32 | 32 | [ |
33 | - [ 'image' ], | |
34 | - 'safe', | |
35 | - ], | |
36 | - [ | |
37 | 33 | [ 'status' ], |
38 | 34 | 'boolean', |
39 | 35 | ], |
... | ... | @@ -112,14 +108,6 @@ |
112 | 108 | $query->andFilterWhere( |
113 | 109 | [ |
114 | 110 | 'like', |
115 | - 'image', | |
116 | - $this->image, | |
117 | - ] | |
118 | - ); | |
119 | - | |
120 | - $query->andFilterWhere( | |
121 | - [ | |
122 | - 'like', | |
123 | 111 | 'blog_article_lang.title', |
124 | 112 | $this->title, |
125 | 113 | ] | ... | ... |
models/BlogCategory.php renamed to models/Category.php
... | ... | @@ -10,13 +10,14 @@ |
10 | 10 | |
11 | 11 | /** |
12 | 12 | * This is the model class for table "blog_category". |
13 | - * | |
14 | - * @property integer $id | |
13 | + | |
14 | +* | |
15 | +*@property integer $id | |
15 | 16 | * @property integer $sort |
16 | 17 | * @property string $image |
17 | 18 | * @property integer $parent_id |
18 | 19 | * @property boolean $status |
19 | - * @property BlogArticle[] $blogArticles | |
20 | + * @property Article[] $blogArticles | |
20 | 21 | * @property BlogCategoryLang[] $blogCategoryLangs |
21 | 22 | * @property Language[] $languages |
22 | 23 | * @property BlogCategory $parent |
... | ... | @@ -47,7 +48,7 @@ |
47 | 48 | * @method string|null getImageUrl( int $field ) |
48 | 49 | * * End SaveImgBehavior |
49 | 50 | */ |
50 | - class BlogCategory extends ActiveRecord | |
51 | + class Category extends ActiveRecord | |
51 | 52 | { |
52 | 53 | /** |
53 | 54 | * @inheritdoc |
... | ... | @@ -63,21 +64,9 @@ |
63 | 64 | public function behaviors() |
64 | 65 | { |
65 | 66 | return [ |
66 | - [ | |
67 | - 'class' => SaveImgBehavior::className(), | |
68 | - 'fields' => [ | |
69 | - [ | |
70 | - 'name' => 'image', | |
71 | - 'directory' => 'blog/category', | |
72 | - ], | |
73 | - ], | |
74 | - ], | |
75 | 67 | 'language' => [ |
76 | 68 | 'class' => LanguageBehavior::className(), |
77 | 69 | ], |
78 | - 'Slug' => [ | |
79 | - 'class' => 'artweb\artbox\behaviors\Slug', | |
80 | - ], | |
81 | 70 | ]; |
82 | 71 | } |
83 | 72 | ... | ... |
models/BlogCategoryLang.php renamed to models/CategoryLang.php
1 | 1 | <?php |
2 | 2 | |
3 | 3 | namespace artbox\weblog\models; |
4 | - | |
4 | + | |
5 | + use artbox\core\behaviors\SlugBehavior; | |
5 | 6 | use yii\db\ActiveRecord; |
6 | 7 | use artbox\core\models\Language; |
7 | - | |
8 | + | |
8 | 9 | /** |
9 | 10 | * This is the model class for table "blog_category_lang". |
10 | - * | |
11 | - * @property integer $id | |
12 | - * @property integer $blog_category_id | |
13 | - * @property integer $language_id | |
14 | - * @property string $title | |
15 | - * @property string $alias | |
16 | - * @property string $description | |
17 | - * @property string $meta_title | |
18 | - * @property string $meta_description | |
19 | - * @property string $h1 | |
20 | - * @property string $seo_text | |
21 | - * @property BlogCategory $blogCategory | |
22 | - * @property Language $language | |
11 | + | |
12 | +* | |
13 | + * @property integer $id | |
14 | + * @property integer $blog_category_id | |
15 | + * @property integer $language_id | |
16 | + * @property string $title | |
17 | + * @property string $alias | |
18 | + * @property string $description | |
19 | + * @property string $meta_title | |
20 | + * @property string $meta_description | |
21 | + * @property string $h1 | |
22 | + * @property string $seo_text | |
23 | + * @property Category $blogCategory | |
24 | + * @property Language $language | |
23 | 25 | */ |
24 | - class BlogCategoryLang extends ActiveRecord | |
26 | + class CategoryLang extends ActiveRecord | |
25 | 27 | { |
26 | 28 | /** |
27 | 29 | * @inheritdoc |
... | ... | @@ -30,16 +32,23 @@ |
30 | 32 | { |
31 | 33 | return 'blog_category_lang'; |
32 | 34 | } |
33 | - | |
35 | + | |
34 | 36 | public function behaviors() |
35 | 37 | { |
36 | 38 | return [ |
37 | 39 | 'slug' => [ |
38 | - 'class' => 'artweb\artbox\behaviors\Slug', | |
40 | + 'class' => SlugBehavior::className(), | |
41 | + 'action' => 'blog-category/view', | |
42 | + 'params' => [ | |
43 | + 'id' => 'blog_category_id', | |
44 | + ], | |
45 | + 'fields' => [ | |
46 | + 'title' => 'Category title', | |
47 | + ], | |
39 | 48 | ], |
40 | 49 | ]; |
41 | 50 | } |
42 | - | |
51 | + | |
43 | 52 | /** |
44 | 53 | * @inheritdoc |
45 | 54 | */ |
... | ... | @@ -108,7 +117,7 @@ |
108 | 117 | ], |
109 | 118 | ]; |
110 | 119 | } |
111 | - | |
120 | + | |
112 | 121 | /** |
113 | 122 | * @inheritdoc |
114 | 123 | */ |
... | ... | @@ -127,7 +136,7 @@ |
127 | 136 | 'seo_text' => 'Seo Text', |
128 | 137 | ]; |
129 | 138 | } |
130 | - | |
139 | + | |
131 | 140 | /** |
132 | 141 | * @return \yii\db\ActiveQuery |
133 | 142 | */ |
... | ... | @@ -135,7 +144,7 @@ |
135 | 144 | { |
136 | 145 | return $this->hasOne(BlogCategory::className(), [ 'id' => 'blog_category_id' ]); |
137 | 146 | } |
138 | - | |
147 | + | |
139 | 148 | /** |
140 | 149 | * @return \yii\db\ActiveQuery |
141 | 150 | */ | ... | ... |
models/BlogCategorySearch.php renamed to models/CategorySearch.php
... | ... | @@ -8,7 +8,7 @@ |
8 | 8 | /** |
9 | 9 | * BlogCategorySearch represents the model behind the search form about `artweb\artbox\blog\models\BlogCategory`. |
10 | 10 | */ |
11 | - class BlogCategorySearch extends BlogCategory | |
11 | + class CategorySearch extends Category | |
12 | 12 | { |
13 | 13 | /** |
14 | 14 | * @var string |
... | ... | @@ -29,10 +29,6 @@ |
29 | 29 | 'integer', |
30 | 30 | ], |
31 | 31 | [ |
32 | - [ 'image' ], | |
33 | - 'safe', | |
34 | - ], | |
35 | - [ | |
36 | 32 | [ 'status' ], |
37 | 33 | 'boolean', |
38 | 34 | ], |
... | ... | @@ -69,8 +65,8 @@ |
69 | 65 | */ |
70 | 66 | public function search($params) |
71 | 67 | { |
72 | - $query = BlogCategory::find() | |
73 | - ->joinWith('lang', 'parent.lang'); | |
68 | + $query = Category::find() | |
69 | + ->joinWith('lang', 'parent.lang'); | |
74 | 70 | |
75 | 71 | // add conditions that should always apply here |
76 | 72 | |
... | ... | @@ -110,14 +106,6 @@ |
110 | 106 | $query->andFilterWhere( |
111 | 107 | [ |
112 | 108 | 'like', |
113 | - 'image', | |
114 | - $this->image, | |
115 | - ] | |
116 | - ); | |
117 | - | |
118 | - $query->andFilterWhere( | |
119 | - [ | |
120 | - 'like', | |
121 | 109 | 'blog_category_lang.title', |
122 | 110 | $this->title, |
123 | 111 | ] | ... | ... |
models/BlogTag.php renamed to models/Tag.php
... | ... | @@ -10,9 +10,10 @@ |
10 | 10 | |
11 | 11 | /** |
12 | 12 | * This is the model class for table "blog_tag". |
13 | - * | |
14 | - * @property integer $id | |
15 | - * @property BlogArticle[] $blogArticles | |
13 | + | |
14 | +* | |
15 | +*@property integer $id | |
16 | + * @property Article[] $blogArticles | |
16 | 17 | * @property BlogTagLang[] $blogTagLangs |
17 | 18 | * @property Language[] $languages |
18 | 19 | * * From language behavior * |
... | ... | @@ -36,7 +37,7 @@ |
36 | 37 | * @method bool getTransactionStatus() |
37 | 38 | * * End language behavior * |
38 | 39 | */ |
39 | - class BlogTag extends ActiveRecord | |
40 | + class Tag extends ActiveRecord | |
40 | 41 | { |
41 | 42 | /** |
42 | 43 | * @inheritdoc |
... | ... | @@ -86,7 +87,7 @@ |
86 | 87 | */ |
87 | 88 | public function getBlogArticles() |
88 | 89 | { |
89 | - return $this->hasMany(BlogArticle::className(), [ 'id' => 'blog_article_id' ]) | |
90 | + return $this->hasMany(Article::className(), [ 'id' => 'blog_article_id' ]) | |
90 | 91 | ->viaTable('blog_article_to_tag', [ 'blog_tag_id' => 'id' ]); |
91 | 92 | } |
92 | 93 | } | ... | ... |
models/BlogTagLang.php renamed to models/TagLang.php
... | ... | @@ -7,15 +7,16 @@ |
7 | 7 | |
8 | 8 | /** |
9 | 9 | * This is the model class for table "blog_tag_lang". |
10 | - * | |
11 | - * @property integer $id | |
10 | + | |
11 | +* | |
12 | +*@property integer $id | |
12 | 13 | * @property integer $blog_tag_id |
13 | 14 | * @property integer $language_id |
14 | 15 | * @property string $label |
15 | - * @property BlogTag $blogTag | |
16 | + * @property Tag $blogTag | |
16 | 17 | * @property Language $language |
17 | 18 | */ |
18 | - class BlogTagLang extends ActiveRecord | |
19 | + class TagLang extends ActiveRecord | |
19 | 20 | { |
20 | 21 | /** |
21 | 22 | * @inheritdoc |
... | ... | @@ -66,7 +67,7 @@ |
66 | 67 | [ 'blog_tag_id' ], |
67 | 68 | 'exist', |
68 | 69 | 'skipOnError' => true, |
69 | - 'targetClass' => BlogTag::className(), | |
70 | + 'targetClass' => Tag::className(), | |
70 | 71 | 'targetAttribute' => [ 'blog_tag_id' => 'id' ], |
71 | 72 | ], |
72 | 73 | [ |
... | ... | @@ -97,7 +98,7 @@ |
97 | 98 | */ |
98 | 99 | public function getBlogTag() |
99 | 100 | { |
100 | - return $this->hasOne(BlogTag::className(), [ 'id' => 'blog_tag_id' ]); | |
101 | + return $this->hasOne(Tag::className(), [ 'id' => 'blog_tag_id' ]); | |
101 | 102 | } |
102 | 103 | |
103 | 104 | /** | ... | ... |
models/BlogTagSearch.php renamed to models/TagSearch.php
... | ... | @@ -8,7 +8,7 @@ |
8 | 8 | /** |
9 | 9 | * BlogTagSearch represents the model behind the search form about `artweb\artbox\blog\models\BlogTag`. |
10 | 10 | */ |
11 | - class BlogTagSearch extends BlogTag | |
11 | + class TagSearch extends Tag | |
12 | 12 | { |
13 | 13 | /** |
14 | 14 | * @var string |
... | ... | @@ -58,8 +58,8 @@ |
58 | 58 | */ |
59 | 59 | public function search($params) |
60 | 60 | { |
61 | - $query = BlogTag::find() | |
62 | - ->joinWith('lang'); | |
61 | + $query = Tag::find() | |
62 | + ->joinWith('lang'); | |
63 | 63 | |
64 | 64 | // add conditions that should always apply here |
65 | 65 | ... | ... |
views/blog-article/_form.php
1 | 1 | <?php |
2 | 2 | |
3 | - use artweb\artbox\blog\models\BlogArticle; | |
4 | - use artweb\artbox\blog\models\BlogArticleLang; | |
5 | - use artweb\artbox\blog\models\BlogCategory; | |
6 | - use artweb\artbox\blog\models\BlogTag; | |
3 | + use artbox\weblog\models\Article; | |
4 | + use artbox\weblog\models\ArticleLang; | |
5 | + | |
6 | + // use artweb\artbox\blog\models\BlogCategory; | |
7 | + // use artweb\artbox\blog\models\BlogTag; | |
7 | 8 | use kartik\select2\Select2; |
9 | + use noam148\imagemanager\components\ImageManagerInputWidget; | |
8 | 10 | use yii\helpers\Html; |
9 | 11 | use yii\helpers\Url; |
10 | 12 | use yii\web\View; |
11 | 13 | use yii\widgets\ActiveForm; |
12 | - use artweb\artbox\language\widgets\LanguageForm; | |
14 | + use artbox\core\widgets\LanguageForm; | |
13 | 15 | use yii\web\JsExpression; |
14 | 16 | |
15 | 17 | /** |
16 | - * @var View $this | |
17 | - * @var BlogArticle $model | |
18 | - * @var ActiveForm $form | |
19 | - * @var BlogArticleLang[] $modelLangs | |
20 | - * @var BlogCategory[] $categories | |
21 | - * @var BlogTag[] $tags | |
22 | - * @var array $products | |
23 | - * @var array $articles | |
18 | + * @var View $this | |
19 | + * @var Article $model | |
20 | + * @var ActiveForm $form | |
21 | + * @var ArticleLang[] $modelLangs | |
22 | + * @var BlogCategory[] $categories | |
23 | + * @var BlogTag[] $tags | |
24 | + * @var array $products | |
25 | + * @var array $articles | |
24 | 26 | */ |
25 | 27 | ?> |
26 | 28 | |
... | ... | @@ -36,151 +38,137 @@ |
36 | 38 | echo LanguageForm::widget( |
37 | 39 | [ |
38 | 40 | 'modelLangs' => $modelLangs, |
39 | - 'formView' => '@artweb/artbox/blog/views/blog-article/_form_language', | |
41 | + 'formView' => '@artbox/weblog/views/blog-article/_form_language', | |
40 | 42 | 'form' => $form, |
41 | 43 | ] |
42 | 44 | ); |
43 | 45 | ?> |
44 | 46 | |
45 | 47 | <?php |
46 | - echo $form->field($model, 'blogCategories') | |
47 | - ->widget( | |
48 | - Select2::className(), | |
49 | - [ | |
50 | - 'data' => $categories, | |
51 | - 'theme' => Select2::THEME_BOOTSTRAP, | |
52 | - 'options' => [ | |
53 | - 'placeholder' => \Yii::t('blog', 'Select category'), | |
54 | - 'multiple' => true, | |
55 | - ], | |
56 | - 'pluginOptions' => [ | |
57 | - 'allowClear' => true, | |
58 | - ], | |
59 | - ] | |
60 | - ); | |
48 | + // echo $form->field($model, 'blogCategories') | |
49 | + // ->widget( | |
50 | + // Select2::className(), | |
51 | + // [ | |
52 | + // 'data' => $categories, | |
53 | + // 'theme' => Select2::THEME_BOOTSTRAP, | |
54 | + // 'options' => [ | |
55 | + // 'placeholder' => \Yii::t('blog', 'Select category'), | |
56 | + // 'multiple' => true, | |
57 | + // ], | |
58 | + // 'pluginOptions' => [ | |
59 | + // 'allowClear' => true, | |
60 | + // ], | |
61 | + // ] | |
62 | + // ); | |
61 | 63 | ?> |
62 | 64 | |
63 | 65 | <?php |
64 | - echo $form->field($model, 'blogTags') | |
65 | - ->widget( | |
66 | - Select2::className(), | |
67 | - [ | |
68 | - 'data' => $tags, | |
69 | - 'theme' => Select2::THEME_BOOTSTRAP, | |
70 | - 'options' => [ | |
71 | - 'placeholder' => \Yii::t('blog', 'Select tag'), | |
72 | - 'multiple' => true, | |
73 | - ], | |
74 | - 'pluginOptions' => [ | |
75 | - 'allowClear' => true, | |
76 | - ], | |
77 | - ] | |
78 | - ); | |
66 | + // echo $form->field($model, 'blogTags') | |
67 | + // ->widget( | |
68 | + // Select2::className(), | |
69 | + // [ | |
70 | + // 'data' => $tags, | |
71 | + // 'theme' => Select2::THEME_BOOTSTRAP, | |
72 | + // 'options' => [ | |
73 | + // 'placeholder' => \Yii::t('blog', 'Select tag'), | |
74 | + // 'multiple' => true, | |
75 | + // ], | |
76 | + // 'pluginOptions' => [ | |
77 | + // 'allowClear' => true, | |
78 | + // ], | |
79 | + // ] | |
80 | + // ); | |
79 | 81 | ?> |
80 | 82 | |
81 | - <?= $form->field($model, 'image') | |
83 | + <?= $form->field($model, 'image_id') | |
82 | 84 | ->widget( |
83 | - \kartik\file\FileInput::className(), | |
85 | + ImageManagerInputWidget::className(), | |
84 | 86 | [ |
85 | - 'language' => 'ru', | |
86 | - 'options' => [ | |
87 | - 'accept' => 'image/*', | |
88 | - 'multiple' => false, | |
89 | - 'deleteurl' => $model->isNewRecord?false:Url::to(['/blog/blog-article/delete-image', 'id' => $model->id]), | |
90 | - 'class' => $model->isNewRecord?'':'artbox-delete-file', | |
91 | - ], | |
92 | - 'pluginOptions' => [ | |
93 | - 'allowedFileExtensions' => [ | |
94 | - 'jpg', | |
95 | - 'gif', | |
96 | - 'png', | |
97 | - ], | |
98 | - 'initialPreview' => !empty( $model->getImageUrl(0, false) ) ? \artweb\artbox\components\artboximage\ArtboxImageHelper::getImage( | |
99 | - $model->imageUrl, | |
100 | - 'list' | |
101 | - ) : '', | |
102 | - 'initialPreviewShowDelete' => false, | |
103 | - 'overwriteInitial' => true, | |
104 | - 'showRemove' => true, | |
105 | - 'showUpload' => false, | |
106 | - 'showClose' => false, | |
107 | - 'previewFileType' => 'image', | |
108 | - ], | |
87 | + 'aspectRatio' => ( 16 / 9 ), | |
88 | + //set the aspect ratio | |
89 | + 'showPreview' => true, | |
90 | + //false to hide the preview | |
91 | + 'showDeletePickedImageConfirm' => false, | |
92 | + //on true show warning before detach image | |
109 | 93 | ] |
110 | 94 | ); ?> |
111 | 95 | |
112 | 96 | <?php |
113 | - echo $form->field($model, 'products') | |
114 | - ->widget( | |
115 | - Select2::className(), | |
116 | - [ | |
117 | - 'data' => $products, | |
118 | - 'options' => [ | |
119 | - 'placeholder' => \Yii::t('blog', 'Select related products'), | |
120 | - 'multiple' => true, | |
121 | - ], | |
122 | - 'pluginOptions' => [ | |
123 | - 'allowClear' => true, | |
124 | - 'minimumInputLength' => 3, | |
125 | - 'language' => [ | |
126 | - 'errorLoading' => new JsExpression( | |
127 | - "function () { return '" . \Yii::t('blog', 'Waiting for results') . "'; }" | |
128 | - ), | |
129 | - ], | |
130 | - 'ajax' => [ | |
131 | - 'url' => yii\helpers\Url::to([ '/blog/blog-article/product-list' ]), | |
132 | - 'dataType' => 'json', | |
133 | - 'data' => new JsExpression('function(params) { return {q:params.term}; }'), | |
134 | - ], | |
135 | - 'templateResult' => new JsExpression('function(product) { return product.text; }'), | |
136 | - 'templateSelection' => new JsExpression('function (product) { return product.text; }'), | |
137 | - ], | |
138 | - ] | |
139 | - ); | |
97 | + // echo $form->field($model, 'products') | |
98 | + // ->widget( | |
99 | + // Select2::className(), | |
100 | + // [ | |
101 | + // 'data' => $products, | |
102 | + // 'options' => [ | |
103 | + // 'placeholder' => \Yii::t('blog', 'Select related products'), | |
104 | + // 'multiple' => true, | |
105 | + // ], | |
106 | + // 'pluginOptions' => [ | |
107 | + // 'allowClear' => true, | |
108 | + // 'minimumInputLength' => 3, | |
109 | + // 'language' => [ | |
110 | + // 'errorLoading' => new JsExpression( | |
111 | + // "function () { return '" . \Yii::t('blog', 'Waiting for results') . "'; }" | |
112 | + // ), | |
113 | + // ], | |
114 | + // 'ajax' => [ | |
115 | + // 'url' => yii\helpers\Url::to([ '/blog/blog-article/product-list' ]), | |
116 | + // 'dataType' => 'json', | |
117 | + // 'data' => new JsExpression('function(params) { return {q:params.term}; }'), | |
118 | + // ], | |
119 | + // 'templateResult' => new JsExpression('function(product) { return product.text; }'), | |
120 | + // 'templateSelection' => new JsExpression('function (product) { return product.text; }'), | |
121 | + // ], | |
122 | + // ] | |
123 | + // ); | |
140 | 124 | ?> |
141 | 125 | |
142 | 126 | <?php |
143 | - if (empty( $model->id )) { | |
144 | - $data = 'function(params) { return {q:params.term}; }'; | |
145 | - } else { | |
146 | - $data = 'function(params) { return {q:params.term, id:' . $model->id . '}; }'; | |
147 | - } | |
148 | - echo $form->field($model, 'blogArticles') | |
149 | - ->widget( | |
150 | - Select2::className(), | |
151 | - [ | |
152 | - 'data' => $articles, | |
153 | - 'options' => [ | |
154 | - 'placeholder' => \Yii::t('blog', 'Select related articles'), | |
155 | - 'multiple' => true, | |
156 | - ], | |
157 | - 'pluginOptions' => [ | |
158 | - 'allowClear' => true, | |
159 | - 'minimumInputLength' => 3, | |
160 | - 'language' => [ | |
161 | - 'errorLoading' => new JsExpression( | |
162 | - "function () { return '" . \Yii::t('blog', 'Waiting for results') . "'; }" | |
163 | - ), | |
164 | - ], | |
165 | - 'ajax' => [ | |
166 | - 'url' => yii\helpers\Url::to([ '/blog/blog-article/article-list' ]), | |
167 | - 'dataType' => 'json', | |
168 | - 'data' => new JsExpression( | |
169 | - $data | |
170 | - ), | |
171 | - ], | |
172 | - 'templateResult' => new JsExpression('function(article) { return article.text; }'), | |
173 | - 'templateSelection' => new JsExpression('function (article) { return article.text; }'), | |
174 | - ], | |
175 | - ] | |
176 | - ); | |
127 | + // if (empty( $model->id )) { | |
128 | + // $data = 'function(params) { return {q:params.term}; }'; | |
129 | + // } else { | |
130 | + // $data = 'function(params) { return {q:params.term, id:' . $model->id . '}; }'; | |
131 | + // } | |
132 | + // echo $form->field($model, 'blogArticles') | |
133 | + // ->widget( | |
134 | + // Select2::className(), | |
135 | + // [ | |
136 | + // 'data' => $articles, | |
137 | + // 'options' => [ | |
138 | + // 'placeholder' => \Yii::t('blog', 'Select related articles'), | |
139 | + // 'multiple' => true, | |
140 | + // ], | |
141 | + // 'pluginOptions' => [ | |
142 | + // 'allowClear' => true, | |
143 | + // 'minimumInputLength' => 3, | |
144 | + // 'language' => [ | |
145 | + // 'errorLoading' => new JsExpression( | |
146 | + // "function () { return '" . \Yii::t('blog', 'Waiting for results') . "'; }" | |
147 | + // ), | |
148 | + // ], | |
149 | + // 'ajax' => [ | |
150 | + // 'url' => yii\helpers\Url::to([ '/blog/blog-article/article-list' ]), | |
151 | + // 'dataType' => 'json', | |
152 | + // 'data' => new JsExpression( | |
153 | + // $data | |
154 | + // ), | |
155 | + // ], | |
156 | + // 'templateResult' => new JsExpression('function(article) { return article.text; }'), | |
157 | + // 'templateSelection' => new JsExpression('function (article) { return article.text; }'), | |
158 | + // ], | |
159 | + // ] | |
160 | + // ); | |
177 | 161 | ?> |
178 | 162 | |
179 | 163 | <?= $form->field($model, 'sort') |
180 | 164 | ->textInput() ?> |
181 | 165 | |
182 | 166 | <?= $form->field($model, 'status') |
183 | - ->checkbox() ?> | |
167 | + ->checkbox( | |
168 | + [ | |
169 | + 'class' => 'flat', | |
170 | + ] | |
171 | + ) ?> | |
184 | 172 | |
185 | 173 | <?= $form->field($model, 'author_id') |
186 | 174 | ->textInput() ?> | ... | ... |
views/blog-article/_form_language.php
1 | 1 | <?php |
2 | - use artweb\artbox\blog\models\BlogArticleLang; | |
3 | - use artweb\artbox\language\models\Language; | |
4 | - use mihaildev\ckeditor\CKEditor; | |
5 | - use mihaildev\elfinder\ElFinder; | |
2 | + use artbox\core\helpers\SlugifyDecorator; | |
3 | + use artbox\weblog\models\ArticleLang; | |
4 | + use artbox\core\models\Language; | |
5 | + use dosamigos\tinymce\TinyMce; | |
6 | + use yii\helpers\Url; | |
7 | + use yii\web\JsExpression; | |
6 | 8 | use yii\web\View; |
7 | 9 | use yii\widgets\ActiveForm; |
8 | 10 | |
9 | 11 | /** |
10 | - * @var BlogArticleLang $model_lang | |
11 | - * @var Language $language | |
12 | - * @var ActiveForm $form | |
13 | - * @var View $this | |
12 | + * @var ArticleLang $model_lang | |
13 | + * @var Language $language | |
14 | + * @var ActiveForm $form | |
15 | + * @var View $this | |
14 | 16 | */ |
15 | 17 | ?> |
16 | -<?= $form->field($model_lang, '[' . $language->id . ']title') | |
17 | - ->textInput([ 'maxlength' => true ]); ?> | |
18 | +<?php | |
19 | + $attributeField = $form->field($model_lang, '[' . $language->id . ']title') | |
20 | + ->textInput([ 'maxlength' => true ]); | |
21 | + echo $attributeField; | |
22 | +?> | |
18 | 23 | |
19 | -<?= $form->field($model_lang, '[' . $language->id . ']alias') | |
20 | - ->textInput([ 'maxlength' => true ]); ?> | |
24 | +<?= SlugifyDecorator::decorate( | |
25 | + $form->field($model_lang, '[' . $language->id . ']aliasValue'), | |
26 | + [ '/alias/slugify' ], | |
27 | + $attributeField | |
28 | +) | |
29 | + ->textInput([ 'maxlength' => true ]); ?> | |
21 | 30 | |
22 | 31 | <?= $form->field($model_lang, '[' . $language->id . ']body') |
23 | 32 | ->widget( |
24 | - CKEditor::className(), | |
33 | + TinyMce::className(), | |
25 | 34 | [ |
26 | - 'editorOptions' => ElFinder::ckeditorOptions( | |
27 | - 'elfinder', | |
28 | - [ | |
29 | - 'preset' => 'full', | |
30 | - 'inline' => false, | |
31 | - 'filebrowserUploadUrl' => Yii::$app->getUrlManager() | |
32 | - ->createUrl('file/uploader/images-upload'), | |
33 | - ] | |
34 | - ), | |
35 | + 'options' => [ 'rows' => 6 ], | |
36 | + 'language' => 'ru', | |
37 | + 'clientOptions' => [ | |
38 | + 'file_browser_callback' => new JsExpression( | |
39 | + "function(field_name, url, type, win) { | |
40 | +window.open('" . Url::to( | |
41 | + [ | |
42 | + 'imagemanager/manager', | |
43 | + 'view-mode' => 'iframe', | |
44 | + 'select-type' => 'tinymce', | |
45 | + ] | |
46 | + ) . "&tag_name='+field_name,'','width=800,height=540 ,toolbar=no,status=no,menubar=no,scrollbars=no,resizable=no'); | |
47 | +}" | |
48 | + ), | |
49 | + 'plugins' => [ | |
50 | + "advlist autolink lists link charmap print preview anchor", | |
51 | + "searchreplace visualblocks code fullscreen", | |
52 | + "insertdatetime media table contextmenu paste image", | |
53 | + ], | |
54 | + 'toolbar' => "undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image | code", | |
55 | + ], | |
35 | 56 | ] |
36 | - ) ?> | |
57 | + ); ?> | |
37 | 58 | |
38 | 59 | <?= $form->field($model_lang, '[' . $language->id . ']body_preview') |
39 | 60 | ->textarea( |
... | ... | @@ -41,15 +62,3 @@ |
41 | 62 | 'rows' => '10', |
42 | 63 | ] |
43 | 64 | ) ?> |
44 | - | |
45 | -<?= $form->field($model_lang, '[' . $language->id . ']meta_title') | |
46 | - ->textInput([ 'maxlength' => true ]); ?> | |
47 | - | |
48 | -<?= $form->field($model_lang, '[' . $language->id . ']meta_description') | |
49 | - ->textInput([ 'maxlength' => true ]); ?> | |
50 | - | |
51 | -<?= $form->field($model_lang, '[' . $language->id . ']seo_text') | |
52 | - ->textInput([ 'maxlength' => true ]); ?> | |
53 | - | |
54 | -<?= $form->field($model_lang, '[' . $language->id . ']h1') | |
55 | - ->textInput([ 'maxlength' => true ]); ?> | ... | ... |
views/blog-article/create.php
1 | 1 | <?php |
2 | 2 | |
3 | - use artweb\artbox\blog\models\BlogArticle; | |
4 | - use artweb\artbox\blog\models\BlogArticleLang; | |
5 | - use artweb\artbox\blog\models\BlogCategory; | |
6 | - use artweb\artbox\blog\models\BlogTag; | |
7 | - use yii\helpers\Html; | |
3 | + use artbox\weblog\models\Article; | |
4 | + use artbox\weblog\models\ArticleLang; | |
8 | 5 | use yii\web\View; |
6 | + use yiister\gentelella\widgets\Panel; | |
9 | 7 | |
10 | 8 | /** |
11 | - * @var View $this | |
12 | - * @var BlogArticle $model | |
13 | - * @var BlogArticleLang[] $modelLangs | |
14 | - * @var BlogCategory[] $categories | |
15 | - * @var BlogTag[] $tags | |
16 | - * @var array $products | |
17 | - * @var array $articles | |
9 | + * @var View $this | |
10 | + * @var Article $model | |
11 | + * @var ArticleLang[] $modelLangs | |
12 | + * @var array $products | |
13 | + * @var array $articles | |
18 | 14 | */ |
19 | 15 | |
20 | 16 | $this->title = \Yii::t('blog', 'Create Blog Article'); |
... | ... | @@ -26,18 +22,24 @@ |
26 | 22 | ?> |
27 | 23 | <div class="blog-article-create"> |
28 | 24 | |
29 | - <h1><?= Html::encode($this->title) ?></h1> | |
25 | + <?php $panel = Panel::begin( | |
26 | + [ | |
27 | + 'header' => $this->title, | |
28 | + ] | |
29 | + ); ?> | |
30 | 30 | |
31 | 31 | <?= $this->render( |
32 | 32 | '_form', |
33 | 33 | [ |
34 | 34 | 'model' => $model, |
35 | 35 | 'modelLangs' => $modelLangs, |
36 | - 'categories' => $categories, | |
37 | - 'tags' => $tags, | |
36 | + // 'categories' => $categories, | |
37 | + // 'tags' => $tags, | |
38 | 38 | 'products' => $products, |
39 | 39 | 'articles' => $articles, |
40 | 40 | ] |
41 | 41 | ) ?> |
42 | + | |
43 | + <?php $panel::end(); ?> | |
42 | 44 | |
43 | 45 | </div> | ... | ... |
views/blog-article/index.php
... | ... | @@ -6,6 +6,7 @@ |
6 | 6 | use yii\helpers\Html; |
7 | 7 | use yii\grid\GridView; |
8 | 8 | use yii\web\View; |
9 | + use yiister\gentelella\widgets\Panel; | |
9 | 10 | |
10 | 11 | /** |
11 | 12 | * @var View $this |
... | ... | @@ -18,12 +19,18 @@ |
18 | 19 | ?> |
19 | 20 | <div class="blog-article-index"> |
20 | 21 | |
21 | - <h1><?= Html::encode($this->title) ?></h1> | |
22 | - <?php // echo $this->render('_search', ['model' => $searchModel]); ?> | |
23 | - | |
24 | - <p> | |
25 | - <?= Html::a(\Yii::t('app', 'create_item',['item'=>'Blog Article']), [ 'create' ], [ 'class' => 'btn btn-success' ]) ?> | |
26 | - </p> | |
22 | + <?php $panel = Panel::begin( | |
23 | + [ | |
24 | + 'header' => $this->title, | |
25 | + ] | |
26 | + ); ?> | |
27 | + <p> | |
28 | + <?= Html::a( | |
29 | + \Yii::t('app', 'create_item', [ 'item' => 'Blog Article' ]), | |
30 | + [ 'create' ], | |
31 | + [ 'class' => 'btn btn-success' ] | |
32 | + ) ?> | |
33 | + </p> | |
27 | 34 | <?= GridView::widget( |
28 | 35 | [ |
29 | 36 | 'dataProvider' => $dataProvider, |
... | ... | @@ -37,7 +44,7 @@ |
37 | 44 | 'imageUrl:image', |
38 | 45 | [ |
39 | 46 | 'attribute' => 'status', |
40 | - 'value' => function($model) { | |
47 | + 'value' => function ($model) { | |
41 | 48 | /** |
42 | 49 | * @var Article $model |
43 | 50 | */ |
... | ... | @@ -54,4 +61,7 @@ |
54 | 61 | ], |
55 | 62 | ] |
56 | 63 | ); ?> |
64 | + | |
65 | + <?php $panel::end(); ?> | |
66 | + | |
57 | 67 | </div> | ... | ... |
views/blog-category/index.php
1 | 1 | <?php |
2 | 2 | |
3 | - use artweb\artbox\blog\models\BlogCategory; | |
4 | - use artweb\artbox\blog\models\BlogCategorySearch; | |
5 | 3 | use yii\data\ActiveDataProvider; |
6 | 4 | use yii\helpers\Html; |
7 | 5 | use yii\grid\GridView; |
8 | 6 | use yii\web\View; |
7 | + use yiister\gentelella\widgets\Panel; | |
9 | 8 | |
10 | 9 | /** |
11 | 10 | * @var View $this |
... | ... | @@ -18,12 +17,15 @@ |
18 | 17 | ?> |
19 | 18 | <div class="blog-category-index"> |
20 | 19 | |
21 | - <h1><?= Html::encode($this->title) ?></h1> | |
22 | - <?php // echo $this->render('_search', ['model' => $searchModel]); ?> | |
23 | - | |
24 | - <p> | |
25 | - <?= Html::a(\Yii::t('blog', 'Create Blog Category'), [ 'create' ], [ 'class' => 'btn btn-success' ]) ?> | |
26 | - </p> | |
20 | + <?php $panel = Panel::begin( | |
21 | + [ | |
22 | + 'header' => $this->title, | |
23 | + ] | |
24 | + ); ?> | |
25 | + | |
26 | + <p> | |
27 | + <?= Html::a(\Yii::t('blog', 'Create Blog Category'), [ 'create' ], [ 'class' => 'btn btn-success' ]) ?> | |
28 | + </p> | |
27 | 29 | <?= GridView::widget( |
28 | 30 | [ |
29 | 31 | 'dataProvider' => $dataProvider, |
... | ... | @@ -37,11 +39,11 @@ |
37 | 39 | 'imageUrl:image', |
38 | 40 | [ |
39 | 41 | 'label' => \Yii::t('blog', 'Parent category'), |
40 | - 'value' => function($model) { | |
42 | + 'value' => function ($model) { | |
41 | 43 | /** |
42 | 44 | * @var BlogCategory $model |
43 | 45 | */ |
44 | - if (!empty( $model->parent )) { | |
46 | + if (!empty($model->parent)) { | |
45 | 47 | return $model->parent->lang->title; |
46 | 48 | } else { |
47 | 49 | return false; |
... | ... | @@ -50,7 +52,7 @@ |
50 | 52 | ], |
51 | 53 | [ |
52 | 54 | 'attribute' => 'status', |
53 | - 'value' => function($model) { | |
55 | + 'value' => function ($model) { | |
54 | 56 | /** |
55 | 57 | * @var BlogCategory $model |
56 | 58 | */ |
... | ... | @@ -65,4 +67,7 @@ |
65 | 67 | ], |
66 | 68 | ] |
67 | 69 | ); ?> |
70 | + | |
71 | + <?php $panel::end(); ?> | |
72 | + | |
68 | 73 | </div> | ... | ... |
views/blog-tag/index.php
1 | 1 | <?php |
2 | 2 | |
3 | - use artweb\artbox\blog\models\BlogTagSearch; | |
3 | + use artbox\weblog\models\TagSearch; | |
4 | 4 | use yii\data\ActiveDataProvider; |
5 | 5 | use yii\helpers\Html; |
6 | 6 | use yii\grid\GridView; |
7 | 7 | use yii\web\View; |
8 | + use yiister\gentelella\widgets\Panel; | |
8 | 9 | |
9 | 10 | /** |
10 | 11 | * @var View $this |
11 | - * @var BlogTagSearch $searchModel | |
12 | + * @var TagSearch $searchModel | |
12 | 13 | * @var ActiveDataProvider $dataProvider |
13 | 14 | */ |
14 | 15 | |
... | ... | @@ -17,12 +18,15 @@ |
17 | 18 | ?> |
18 | 19 | <div class="blog-tag-index"> |
19 | 20 | |
20 | - <h1><?= Html::encode($this->title) ?></h1> | |
21 | - <?php // echo $this->render('_search', ['model' => $searchModel]); ?> | |
22 | - | |
23 | - <p> | |
24 | - <?= Html::a(\Yii::t('blog', 'Create Blog Tag'), [ 'create' ], [ 'class' => 'btn btn-success' ]) ?> | |
25 | - </p> | |
21 | + <?php $panel = Panel::begin( | |
22 | + [ | |
23 | + 'header' => $this->title, | |
24 | + ] | |
25 | + ); ?> | |
26 | + | |
27 | + <p> | |
28 | + <?= Html::a(\Yii::t('blog', 'Create Blog Tag'), [ 'create' ], [ 'class' => 'btn btn-success' ]) ?> | |
29 | + </p> | |
26 | 30 | <?= GridView::widget( |
27 | 31 | [ |
28 | 32 | 'dataProvider' => $dataProvider, |
... | ... | @@ -39,4 +43,7 @@ |
39 | 43 | ], |
40 | 44 | ] |
41 | 45 | ); ?> |
46 | + | |
47 | + <?php $panel::end(); ?> | |
48 | + | |
42 | 49 | </div> | ... | ... |