diff --git a/controllers/ArticleController.php b/controllers/ArticleController.php index 96c542f..f7e814e 100755 --- a/controllers/ArticleController.php +++ b/controllers/ArticleController.php @@ -87,22 +87,22 @@ { $model = new Article(); $model->generateLangs(); - - $categories = ArrayHelper::map( - BlogCategory::find() - ->joinWith('lang') - ->all(), - 'id', - 'lang.title' - ); - - $tags = ArrayHelper::map( - BlogTag::find() - ->joinWith('lang') - ->all(), - 'id', - 'lang.label' - ); + + // $categories = ArrayHelper::map( + // BlogCategory::find() + // ->joinWith('lang') + // ->all(), + // 'id', + // 'lang.title' + // ); + // + // $tags = ArrayHelper::map( + // BlogTag::find() + // ->joinWith('lang') + // ->all(), + // 'id', + // 'lang.label' + // ); if ($model->load(Yii::$app->request->post())) { $model->loadLangs(\Yii::$app->request); @@ -153,8 +153,8 @@ [ 'model' => $model, 'modelLangs' => $model->modelLangs, - 'categories' => $categories, - 'tags' => $tags, + // 'categories' => $categories, + // 'tags' => $tags, 'products' => [], 'articles' => [], ] @@ -287,75 +287,75 @@ return $this->redirect([ 'index' ]); } - public function actionDeleteImage($id) - { - $model = $this->findModel($id); - $model->image = null; - $model->updateAttributes(['image']); - return true; - } - /** * Finds the BlogArticle model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. + +* +*@param integer $id * - * @param integer $id - * - * @return BlogArticle the loaded model +*@return Article the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { - if (( $model = BlogArticle::findOne($id) ) !== NULL) { + if (( $model = Article::findOne($id) ) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } } - - /** - * @param string $q - * @param null $id - * - * @return array - */ - public function actionProductList($q = NULL, $id = NULL) + + public function actionList($q = null, $id = null) { \Yii::$app->response->format = Response::FORMAT_JSON; $out = [ 'results' => [ - 'id' => '', - 'text' => '', + [ + 'id' => '', + 'text' => '', + ], ], ]; if (!is_null($q)) { - $out[ 'results' ] = Product::find() - ->joinWith('lang') - ->select( - [ - 'id', - 'product_lang.title as text', - ] - ) - ->where( - [ - 'like', - 'product_lang.title', - $q, - ] - ) - ->limit(20) - ->asArray() - ->all(); - } elseif ($id > 0) { - $out[ 'results' ] = [ - 'id' => $id, - 'text' => Product::find() + $categories = Article::find() ->joinWith('lang') - ->where([ 'id' => $id ]) - ->one()->title, - ]; + ->select( + [ + 'id', + 'text' => 'category_lang.title', + ] + ) + ->filterWhere( + [ + '!=', + 'id', + $id, + ] + ) + ->andFilterWhere( + [ + 'like', + 'category_lang.title', + $q, + ] + ) + ->andFilterWhere( + [ + '!=', + 'parent_id', + $id, + ] + ) + ->limit(20) + ->asArray() + ->all(); + + if (!empty($categories)) { + $out[ 'results' ] = $categories; + } } + return $out; } diff --git a/controllers/BlogCategoryController.php b/controllers/BlogCategoryController.php deleted file mode 100755 index 01d1f76..0000000 --- a/controllers/BlogCategoryController.php +++ /dev/null @@ -1,209 +0,0 @@ - [ - 'class' => VerbFilter::className(), - 'actions' => [ - 'delete' => [ 'POST' ], - ], - ], - ]; - } - - /** - * Lists all BlogCategory models. - * - * @return mixed - */ - public function actionIndex() - { - $searchModel = new BlogCategorySearch(); - $dataProvider = $searchModel->search(Yii::$app->request->queryParams); - - return $this->render( - 'index', - [ - 'searchModel' => $searchModel, - 'dataProvider' => $dataProvider, - ] - ); - } - - /** - * Displays a single BlogCategory model. - * - * @param integer $id - * - * @return mixed - */ - public function actionView($id) - { - return $this->render( - 'view', - [ - 'model' => $this->findModel($id), - ] - ); - } - - /** - * Creates a new BlogCategory model. - * If creation is successful, the browser will be redirected to the 'view' page. - * - * @return mixed - */ - public function actionCreate() - { - $model = new BlogCategory(); - $model->generateLangs(); - $parentCategories = ArrayHelper::map( - BlogCategory::find() - ->joinWith('lang') - ->where( - [ - 'parent_id' => 0, - ] - ) - ->all(), - 'id', - 'lang.title' - ); - - if ($model->load(Yii::$app->request->post())) { - $model->loadLangs(\Yii::$app->request); - if ($model->save() && $model->transactionStatus) { - return $this->redirect( - [ - 'view', - 'id' => $model->id, - ] - ); - } - } - return $this->render( - 'create', - [ - 'model' => $model, - 'modelLangs' => $model->modelLangs, - 'parentCategories' => $parentCategories, - ] - ); - - } - - /** - * Updates an existing BlogCategory model. - * If update is successful, the browser will be redirected to the 'view' page. - * - * @param integer $id - * - * @return mixed - */ - public function actionUpdate($id) - { - $model = $this->findModel($id); - $model->generateLangs(); - $parentCategories = ArrayHelper::map( - BlogCategory::find() - ->joinWith('lang') - ->where( - [ - 'parent_id' => 0, - ] - ) - ->andWhere( - [ - '!=', - BlogCategory::tableName() . '_id', - $model->id, - ] - ) - ->all(), - 'id', - 'lang.title' - ); - - if ($model->load(Yii::$app->request->post())) { - $model->loadLangs(\Yii::$app->request); - if ($model->save() && $model->transactionStatus) { - return $this->redirect( - [ - 'view', - 'id' => $model->id, - ] - ); - } - } - return $this->render( - 'update', - [ - 'model' => $model, - 'modelLangs' => $model->modelLangs, - 'parentCategories' => $parentCategories, - ] - ); - - } - - /** - * Deletes an existing BlogCategory model. - * If deletion is successful, the browser will be redirected to the 'index' page. - * - * @param integer $id - * - * @return mixed - */ - public function actionDelete($id) - { - $this->findModel($id) - ->delete(); - - return $this->redirect([ 'index' ]); - } - - public function actionDeleteImage($id) - { - $model = $this->findModel($id); - $model->image = null; - $model->updateAttributes(['image']); - return true; - } - - /** - * Finds the BlogCategory model based on its primary key value. - * If the model is not found, a 404 HTTP exception will be thrown. - * - * @param integer $id - * - * @return BlogCategory the loaded model - * @throws NotFoundHttpException if the model cannot be found - */ - protected function findModel($id) - { - if (( $model = BlogCategory::findOne($id) ) !== NULL) { - return $model; - } else { - throw new NotFoundHttpException('The requested page does not exist.'); - } - } - } diff --git a/controllers/BlogTagController.php b/controllers/BlogTagController.php deleted file mode 100755 index 8288d01..0000000 --- a/controllers/BlogTagController.php +++ /dev/null @@ -1,169 +0,0 @@ - [ - 'class' => VerbFilter::className(), - 'actions' => [ - 'delete' => [ 'POST' ], - ], - ], - ]; - } - - /** - * Lists all BlogTag models. - * - * @return mixed - */ - public function actionIndex() - { - $searchModel = new BlogTagSearch(); - $dataProvider = $searchModel->search(Yii::$app->request->queryParams); - - return $this->render( - 'index', - [ - 'searchModel' => $searchModel, - 'dataProvider' => $dataProvider, - ] - ); - } - - /** - * Displays a single BlogTag model. - * - * @param integer $id - * - * @return mixed - */ - public function actionView($id) - { - return $this->render( - 'view', - [ - 'model' => $this->findModel($id), - ] - ); - } - - /** - * Creates a new BlogTag model. - * If creation is successful, the browser will be redirected to the 'view' page. - * - * @return mixed - */ - public function actionCreate() - { - $model = new BlogTag(); - $model->generateLangs(); - - if (\Yii::$app->request->isPost) { - $model->loadLangs(\Yii::$app->request); - $model->markAttributeDirty('id'); - if ($model->save() && $model->transactionStatus) { - return $this->redirect( - [ - 'view', - 'id' => $model->id, - ] - ); - } - } - return $this->render( - 'create', - [ - 'model' => $model, - 'modelLangs' => $model->modelLangs, - ] - ); - - } - - /** - * Updates an existing BlogTag model. - * If update is successful, the browser will be redirected to the 'view' page. - * - * @param integer $id - * - * @return mixed - */ - public function actionUpdate($id) - { - $model = $this->findModel($id); - $model->generateLangs(); - - if (Yii::$app->request->isPost) { - $model->loadLangs(\Yii::$app->request); - $model->markAttributeDirty('id'); - if ($model->save() && $model->transactionStatus) { - return $this->redirect( - [ - 'view', - 'id' => $model->id, - ] - ); - } - } - return $this->render( - 'update', - [ - 'model' => $model, - 'modelLangs' => $model->modelLangs, - ] - ); - - } - - /** - * Deletes an existing BlogTag model. - * If deletion is successful, the browser will be redirected to the 'index' page. - * - * @param integer $id - * - * @return mixed - */ - public function actionDelete($id) - { - $this->findModel($id) - ->delete(); - - return $this->redirect([ 'index' ]); - } - - /** - * Finds the BlogTag model based on its primary key value. - * If the model is not found, a 404 HTTP exception will be thrown. - * - * @param integer $id - * - * @return BlogTag the loaded model - * @throws NotFoundHttpException if the model cannot be found - */ - protected function findModel($id) - { - if (( $model = BlogTag::findOne($id) ) !== NULL) { - return $model; - } else { - throw new NotFoundHttpException('The requested page does not exist.'); - } - } - } diff --git a/controllers/CategoryController.php b/controllers/CategoryController.php new file mode 100755 index 0000000..d4157ac --- /dev/null +++ b/controllers/CategoryController.php @@ -0,0 +1,216 @@ + [ + 'class' => VerbFilter::className(), + 'actions' => [ + 'delete' => [ 'POST' ], + ], + ], + ]; + } + + /** + * Lists all BlogCategory models. + * + * @return mixed + */ + public function actionIndex() + { + $searchModel = new CategorySearch(); + $dataProvider = $searchModel->search(Yii::$app->request->queryParams); + + return $this->render( + 'index', + [ + 'searchModel' => $searchModel, + 'dataProvider' => $dataProvider, + ] + ); + } + + /** + * Displays a single BlogCategory model. + * + * @param integer $id + * + * @return mixed + */ + public function actionView($id) + { + return $this->render( + 'view', + [ + 'model' => $this->findModel($id), + ] + ); + } + + /** + * Creates a new BlogCategory model. + * If creation is successful, the browser will be redirected to the 'view' page. + * + * @return mixed + */ + public function actionCreate() + { + $model = new BlogCategory(); + $model->generateLangs(); + $parentCategories = ArrayHelper::map( + BlogCategory::find() + ->joinWith('lang') + ->where( + [ + 'parent_id' => 0, + ] + ) + ->all(), + 'id', + 'lang.title' + ); + + if ($model->load(Yii::$app->request->post())) { + $model->loadLangs(\Yii::$app->request); + if ($model->save() && $model->transactionStatus) { + return $this->redirect( + [ + 'view', + 'id' => $model->id, + ] + ); + } + } + return $this->render( + 'create', + [ + 'model' => $model, + 'modelLangs' => $model->modelLangs, + 'parentCategories' => $parentCategories, + ] + ); + + } + + /** + * Updates an existing BlogCategory model. + * If update is successful, the browser will be redirected to the 'view' page. + * + * @param integer $id + * + * @return mixed + */ + public function actionUpdate($id) + { + $model = $this->findModel($id); + $model->generateLangs(); + $parentCategories = ArrayHelper::map( + BlogCategory::find() + ->joinWith('lang') + ->where( + [ + 'parent_id' => 0, + ] + ) + ->andWhere( + [ + '!=', + BlogCategory::tableName() . '_id', + $model->id, + ] + ) + ->all(), + 'id', + 'lang.title' + ); + + if ($model->load(Yii::$app->request->post())) { + $model->loadLangs(\Yii::$app->request); + if ($model->save() && $model->transactionStatus) { + return $this->redirect( + [ + 'view', + 'id' => $model->id, + ] + ); + } + } + return $this->render( + 'update', + [ + 'model' => $model, + 'modelLangs' => $model->modelLangs, + 'parentCategories' => $parentCategories, + ] + ); + + } + + /** + * Deletes an existing BlogCategory model. + * If deletion is successful, the browser will be redirected to the 'index' page. + * + * @param integer $id + * + * @return mixed + */ + public function actionDelete($id) + { + $this->findModel($id) + ->delete(); + + return $this->redirect([ 'index' ]); + } + + public function actionDeleteImage($id) + { + $model = $this->findModel($id); + $model->image = null; + $model->updateAttributes(['image']); + return true; + } + + /** + * Finds the BlogCategory model based on its primary key value. + * If the model is not found, a 404 HTTP exception will be thrown. + * + * @param integer $id + * + * @return BlogCategory the loaded model + * @throws NotFoundHttpException if the model cannot be found + */ + protected function findModel($id) + { + if (( $model = BlogCategory::findOne($id) ) !== NULL) { + return $model; + } else { + throw new NotFoundHttpException('The requested page does not exist.'); + } + } + } diff --git a/controllers/TagController.php b/controllers/TagController.php new file mode 100755 index 0000000..ad217ec --- /dev/null +++ b/controllers/TagController.php @@ -0,0 +1,173 @@ + [ + 'class' => VerbFilter::className(), + 'actions' => [ + 'delete' => [ 'POST' ], + ], + ], + ]; + } + + /** + * Lists all BlogTag models. + * + * @return mixed + */ + public function actionIndex() + { + $searchModel = new TagSearch(); + $dataProvider = $searchModel->search(Yii::$app->request->queryParams); + + return $this->render( + 'index', + [ + 'searchModel' => $searchModel, + 'dataProvider' => $dataProvider, + ] + ); + } + + /** + * Displays a single BlogTag model. + * + * @param integer $id + * + * @return mixed + */ + public function actionView($id) + { + return $this->render( + 'view', + [ + 'model' => $this->findModel($id), + ] + ); + } + + /** + * Creates a new BlogTag model. + * If creation is successful, the browser will be redirected to the 'view' page. + * + * @return mixed + */ + public function actionCreate() + { + $model = new BlogTag(); + $model->generateLangs(); + + if (\Yii::$app->request->isPost) { + $model->loadLangs(\Yii::$app->request); + $model->markAttributeDirty('id'); + if ($model->save() && $model->transactionStatus) { + return $this->redirect( + [ + 'view', + 'id' => $model->id, + ] + ); + } + } + return $this->render( + 'create', + [ + 'model' => $model, + 'modelLangs' => $model->modelLangs, + ] + ); + + } + + /** + * Updates an existing BlogTag model. + * If update is successful, the browser will be redirected to the 'view' page. + * + * @param integer $id + * + * @return mixed + */ + public function actionUpdate($id) + { + $model = $this->findModel($id); + $model->generateLangs(); + + if (Yii::$app->request->isPost) { + $model->loadLangs(\Yii::$app->request); + $model->markAttributeDirty('id'); + if ($model->save() && $model->transactionStatus) { + return $this->redirect( + [ + 'view', + 'id' => $model->id, + ] + ); + } + } + return $this->render( + 'update', + [ + 'model' => $model, + 'modelLangs' => $model->modelLangs, + ] + ); + + } + + /** + * Deletes an existing BlogTag model. + * If deletion is successful, the browser will be redirected to the 'index' page. + * + * @param integer $id + * + * @return mixed + */ + public function actionDelete($id) + { + $this->findModel($id) + ->delete(); + + return $this->redirect([ 'index' ]); + } + + /** + * Finds the BlogTag model based on its primary key value. + * If the model is not found, a 404 HTTP exception will be thrown. + * + * @param integer $id + * + * @return BlogTag the loaded model + * @throws NotFoundHttpException if the model cannot be found + */ + protected function findModel($id) + { + if (( $model = BlogTag::findOne($id) ) !== NULL) { + return $model; + } else { + throw new NotFoundHttpException('The requested page does not exist.'); + } + } + } diff --git a/migrations/m161101_142334_blog_article.php b/migrations/m161101_142334_blog_article.php index bf8eab0..2925825 100755 --- a/migrations/m161101_142334_blog_article.php +++ b/migrations/m161101_142334_blog_article.php @@ -13,7 +13,7 @@ 'blog_article', [ 'id' => $this->primaryKey(), - 'image' => $this->string(255), + 'image_id' => $this->integer(), 'created_at' => $this->integer(), 'updated_at' => $this->integer(), 'deleted_at' => $this->integer(), diff --git a/migrations/m161101_142752_blog_article_lang.php b/migrations/m161101_142752_blog_article_lang.php index 9fb8b9f..5d49fa8 100755 --- a/migrations/m161101_142752_blog_article_lang.php +++ b/migrations/m161101_142752_blog_article_lang.php @@ -12,19 +12,15 @@ $this->createTable( 'blog_article_lang', [ - 'id' => $this->primaryKey(), - 'blog_article_id' => $this->integer() + 'id' => $this->primaryKey(), + 'blog_article_id' => $this->integer() ->notNull(), - 'language_id' => $this->integer() - ->notNull(), - 'title' => $this->string(255), - 'body' => $this->text(), - 'body_preview' => $this->text(), - 'alias' => $this->string(255), - 'meta_title' => $this->string(255), - 'meta_description' => $this->string(255), - 'h1' => $this->string(255), - 'seo_text' => $this->string(255), + 'language_id' => $this->integer() + ->notNull(), + 'title' => $this->string(255), + 'body' => $this->text(), + 'body_preview' => $this->text(), + 'alias_id' => $this->integer(), ] ); @@ -44,7 +40,7 @@ $this->createIndex( 'blog_article_alias_uk', 'blog_article_lang', - 'alias', + 'alias_id', true ); diff --git a/migrations/m161101_143033_blog_category.php b/migrations/m161101_143033_blog_category.php index ff1c560..f7ecb54 100755 --- a/migrations/m161101_143033_blog_category.php +++ b/migrations/m161101_143033_blog_category.php @@ -14,7 +14,7 @@ [ 'id' => $this->primaryKey(), 'sort' => $this->integer(), - 'image' => $this->string(255), + 'image_id' => $this->integer(), 'parent_id' => $this->integer() ->defaultValue(0), 'status' => $this->boolean(), diff --git a/migrations/m161101_143259_blog_category_lang.php b/migrations/m161101_143259_blog_category_lang.php index 31ea407..2a31d4e 100755 --- a/migrations/m161101_143259_blog_category_lang.php +++ b/migrations/m161101_143259_blog_category_lang.php @@ -18,12 +18,8 @@ 'language_id' => $this->integer() ->notNull(), 'title' => $this->string(255), - 'alias' => $this->string(255), + 'alias_id' => $this->integer(), 'description' => $this->text(), - 'meta_title' => $this->string(255), - 'meta_description' => $this->string(255), - 'h1' => $this->string(255), - 'seo_text' => $this->string(255), ] ); @@ -43,7 +39,7 @@ $this->createIndex( 'blog_category_alias_uk', 'blog_category_lang', - 'alias', + 'alias_id', true ); diff --git a/migrations/m161101_143541_blog_article_to_category.php b/migrations/m161101_143541_blog_article_to_category.php index f492ecb..3527ff7 100755 --- a/migrations/m161101_143541_blog_article_to_category.php +++ b/migrations/m161101_143541_blog_article_to_category.php @@ -12,7 +12,6 @@ $this->createTable( 'blog_article_to_category', [ - 'id' => $this->primaryKey(), 'blog_article_id' => $this->integer() ->notNull(), 'blog_category_id' => $this->integer() diff --git a/migrations/m161101_143939_blog_tag_lang.php b/migrations/m161101_143939_blog_tag_lang.php index fbf0575..841c4de 100755 --- a/migrations/m161101_143939_blog_tag_lang.php +++ b/migrations/m161101_143939_blog_tag_lang.php @@ -17,6 +17,7 @@ ->notNull(), 'language_id' => $this->integer() ->notNull(), + 'alias_id' => $this->integer(), 'label' => $this->string(255), ] ); @@ -33,6 +34,8 @@ ], true ); + + $this->createIndex('blog_tag_lang_auk', 'blog_tag_lang', 'alias_id', true); $this->addForeignKey( 'blog_tag_lang_fk', diff --git a/migrations/m161101_144140_blog_article_to_tag.php b/migrations/m161101_144140_blog_article_to_tag.php index da13061..a772f95 100755 --- a/migrations/m161101_144140_blog_article_to_tag.php +++ b/migrations/m161101_144140_blog_article_to_tag.php @@ -12,7 +12,6 @@ $this->createTable( 'blog_article_to_tag', [ - 'id' => $this->primaryKey(), 'blog_article_id' => $this->integer() ->notNull(), 'blog_tag_id' => $this->integer() diff --git a/migrations/m161101_144312_blog_article_to_article.php b/migrations/m161101_144312_blog_article_to_article.php index 39f1691..6022968 100755 --- a/migrations/m161101_144312_blog_article_to_article.php +++ b/migrations/m161101_144312_blog_article_to_article.php @@ -12,7 +12,6 @@ $this->createTable( 'blog_article_to_article', [ - 'id' => $this->primaryKey(), 'blog_article_id' => $this->integer() ->notNull(), 'related_blog_article_id' => $this->integer() diff --git a/migrations/m161101_144434_blog_article_to_product.php b/migrations/m161101_144434_blog_article_to_product.php index 671ab08..78e1ed0 100755 --- a/migrations/m161101_144434_blog_article_to_product.php +++ b/migrations/m161101_144434_blog_article_to_product.php @@ -12,7 +12,6 @@ $this->createTable( 'blog_article_to_product', [ - 'id' => $this->primaryKey(), 'blog_article_id' => $this->integer() ->notNull(), 'product_id' => $this->integer() diff --git a/models/Article.php b/models/Article.php index 562a9f2..6fa62c1 100755 --- a/models/Article.php +++ b/models/Article.php @@ -90,6 +90,7 @@ 'deleted_at', 'sort', 'author_id', + 'image_id', ], 'integer', ], @@ -97,11 +98,6 @@ [ 'status' ], 'boolean', ], - [ - [ 'image' ], - 'string', - 'max' => 255, - ], ]; } diff --git a/models/ArticleLang.php b/models/ArticleLang.php index f3b1410..62ac52e 100755 --- a/models/ArticleLang.php +++ b/models/ArticleLang.php @@ -1,10 +1,11 @@ [ + 'class' => SlugBehavior::className(), + 'action' => 'article/view', + 'params' => [ + 'id' => 'blog_article_id', + ], + 'fields' => [ + 'title' => 'Article title', + ], + ], + ]; } - + /** * @inheritdoc */ @@ -68,19 +80,11 @@ [ [ 'title', - 'alias', - 'meta_title', - 'meta_description', - 'h1', - 'seo_text', ], 'string', 'max' => 255, ], - [ - [ 'alias' ], - 'unique', - ], + [ [ 'blog_article_id', @@ -109,7 +113,7 @@ ], ]; } - + /** * @inheritdoc */ @@ -129,7 +133,7 @@ 'seo_text' => 'Seo Text', ]; } - + /** * @return \yii\db\ActiveQuery */ @@ -137,7 +141,7 @@ { return $this->hasOne(Article::className(), [ 'id' => 'blog_article_id' ]); } - + /** * @return \yii\db\ActiveQuery */ diff --git a/models/ArticleSearch.php b/models/ArticleSearch.php index 09f6fad..f45edf7 100755 --- a/models/ArticleSearch.php +++ b/models/ArticleSearch.php @@ -30,10 +30,6 @@ 'integer', ], [ - [ 'image' ], - 'safe', - ], - [ [ 'status' ], 'boolean', ], @@ -112,14 +108,6 @@ $query->andFilterWhere( [ 'like', - 'image', - $this->image, - ] - ); - - $query->andFilterWhere( - [ - 'like', 'blog_article_lang.title', $this->title, ] diff --git a/models/BlogCategory.php b/models/BlogCategory.php deleted file mode 100755 index 80a2847..0000000 --- a/models/BlogCategory.php +++ /dev/null @@ -1,141 +0,0 @@ - SaveImgBehavior::className(), - 'fields' => [ - [ - 'name' => 'image', - 'directory' => 'blog/category', - ], - ], - ], - 'language' => [ - 'class' => LanguageBehavior::className(), - ], - 'Slug' => [ - 'class' => 'artweb\artbox\behaviors\Slug', - ], - ]; - } - - /** - * @inheritdoc - */ - public function rules() - { - return [ - [ - [ - 'sort', - 'parent_id', - ], - 'integer', - ], - [ - [ 'status' ], - 'boolean', - ], - [ - [ 'image' ], - 'string', - 'max' => 255, - ], - [ - [ 'parent_id' ], - 'default', - 'value' => 0, - ], - ]; - } - - /** - * @inheritdoc - */ - public function attributeLabels() - { - return [ - 'id' => 'ID', - 'sort' => 'Sort', - 'image' => 'Image', - 'parent_id' => 'Parent ID', - 'status' => 'Status', - ]; - } - - /** - * @return \yii\db\ActiveQuery - */ - public function getBlogArticles() - { - return $this->hasMany(BlogArticle::className(), [ 'id' => 'blog_article_id' ]) - ->viaTable('blog_article_to_category', [ 'blog_category_id' => 'id' ]); - } - - public function getParent() - { - return $this->hasOne(BlogCategory::className(), [ 'id' => 'parent_id' ]); - } - } diff --git a/models/BlogCategoryLang.php b/models/BlogCategoryLang.php deleted file mode 100755 index c16bff1..0000000 --- a/models/BlogCategoryLang.php +++ /dev/null @@ -1,146 +0,0 @@ - [ - 'class' => 'artweb\artbox\behaviors\Slug', - ], - ]; - } - - /** - * @inheritdoc - */ - public function rules() - { - return [ - [ - [ - 'blog_category_id', - 'language_id', - ], - 'required', - ], - [ - [ - 'blog_category_id', - 'language_id', - ], - 'integer', - ], - [ - [ 'description' ], - 'string', - ], - [ - [ - 'title', - 'alias', - 'meta_title', - 'meta_description', - 'h1', - 'seo_text', - ], - 'string', - 'max' => 255, - ], - [ - [ 'alias' ], - 'unique', - ], - [ - [ - 'blog_category_id', - 'language_id', - ], - 'unique', - 'targetAttribute' => [ - 'blog_category_id', - 'language_id', - ], - 'message' => 'The combination of Blog Category ID and Language ID has already been taken.', - ], - [ - [ 'blog_category_id' ], - 'exist', - 'skipOnError' => true, - 'targetClass' => BlogCategory::className(), - 'targetAttribute' => [ 'blog_category_id' => 'id' ], - ], - [ - [ 'language_id' ], - 'exist', - 'skipOnError' => true, - 'targetClass' => Language::className(), - 'targetAttribute' => [ 'language_id' => 'id' ], - ], - ]; - } - - /** - * @inheritdoc - */ - public function attributeLabels() - { - return [ - 'id' => 'ID', - 'blog_category_id' => 'Blog Category ID', - 'language_id' => 'Language ID', - 'title' => 'Title', - 'alias' => 'Alias', - 'description' => 'Description', - 'meta_title' => 'Meta Title', - 'meta_description' => 'Meta Description', - 'h1' => 'H1', - 'seo_text' => 'Seo Text', - ]; - } - - /** - * @return \yii\db\ActiveQuery - */ - public function getBlogCategory() - { - return $this->hasOne(BlogCategory::className(), [ 'id' => 'blog_category_id' ]); - } - - /** - * @return \yii\db\ActiveQuery - */ - public function getLanguage() - { - return $this->hasOne(Language::className(), [ 'id' => 'language_id' ]); - } - } diff --git a/models/BlogCategorySearch.php b/models/BlogCategorySearch.php deleted file mode 100755 index cd720e8..0000000 --- a/models/BlogCategorySearch.php +++ /dev/null @@ -1,128 +0,0 @@ -joinWith('lang', 'parent.lang'); - - // add conditions that should always apply here - - $dataProvider = new ActiveDataProvider( - [ - 'query' => $query, - 'sort' => [ - 'attributes' => [ - 'title' => [ - 'asc' => [ 'blog_category_lang.title' => SORT_ASC ], - 'desc' => [ 'blog_category_lang.title' => SORT_DESC ], - ], - 'id', - ], - ], - ] - ); - - $this->load($params); - - if (!$this->validate()) { - // uncomment the following line if you do not want to return any records when validation fails - // $query->where('0=1'); - return $dataProvider; - } - - // grid filtering conditions - $query->andFilterWhere( - [ - 'id' => $this->id, - 'sort' => $this->sort, - 'parent_id' => $this->parent_id, - 'status' => $this->status, - ] - ); - - $query->andFilterWhere( - [ - 'like', - 'image', - $this->image, - ] - ); - - $query->andFilterWhere( - [ - 'like', - 'blog_category_lang.title', - $this->title, - ] - ); - - return $dataProvider; - } - } diff --git a/models/BlogTag.php b/models/BlogTag.php deleted file mode 100755 index 1793cd8..0000000 --- a/models/BlogTag.php +++ /dev/null @@ -1,92 +0,0 @@ - [ - 'class' => LanguageBehavior::className(), - ], - ]; - } - - /** - * @inheritdoc - */ - public function rules() - { - return [ - [ - [ 'id' ], - 'integer', - ], - ]; - } - - /** - * @inheritdoc - */ - public function attributeLabels() - { - return [ - 'id' => 'ID', - ]; - } - - /** - * @return \yii\db\ActiveQuery - */ - public function getBlogArticles() - { - return $this->hasMany(BlogArticle::className(), [ 'id' => 'blog_article_id' ]) - ->viaTable('blog_article_to_tag', [ 'blog_tag_id' => 'id' ]); - } - } diff --git a/models/BlogTagLang.php b/models/BlogTagLang.php deleted file mode 100755 index faf329a..0000000 --- a/models/BlogTagLang.php +++ /dev/null @@ -1,110 +0,0 @@ - 255, - ], - [ - [ - 'blog_tag_id', - 'language_id', - ], - 'unique', - 'targetAttribute' => [ - 'blog_tag_id', - 'language_id', - ], - 'message' => 'The combination of Blog Tag ID and Language ID has already been taken.', - ], - [ - [ 'blog_tag_id' ], - 'exist', - 'skipOnError' => true, - 'targetClass' => BlogTag::className(), - 'targetAttribute' => [ 'blog_tag_id' => 'id' ], - ], - [ - [ 'language_id' ], - 'exist', - 'skipOnError' => true, - 'targetClass' => Language::className(), - 'targetAttribute' => [ 'language_id' => 'id' ], - ], - ]; - } - - /** - * @inheritdoc - */ - public function attributeLabels() - { - return [ - 'id' => 'ID', - 'blog_tag_id' => 'Blog Tag ID', - 'language_id' => 'Language ID', - 'label' => 'Label', - ]; - } - - /** - * @return \yii\db\ActiveQuery - */ - public function getBlogTag() - { - return $this->hasOne(BlogTag::className(), [ 'id' => 'blog_tag_id' ]); - } - - /** - * @return \yii\db\ActiveQuery - */ - public function getLanguage() - { - return $this->hasOne(Language::className(), [ 'id' => 'language_id' ]); - } - } diff --git a/models/BlogTagSearch.php b/models/BlogTagSearch.php deleted file mode 100755 index 9e1b89f..0000000 --- a/models/BlogTagSearch.php +++ /dev/null @@ -1,106 +0,0 @@ -joinWith('lang'); - - // add conditions that should always apply here - - $dataProvider = new ActiveDataProvider( - [ - 'query' => $query, - 'sort' => [ - 'attributes' => [ - 'id', - 'label' => [ - 'asc' => [ 'blog_tag_lang.label' => SORT_ASC ], - 'desc' => [ 'blog_tag_lang.label' => SORT_DESC ], - ], - ], - ], - ] - ); - - $this->load($params); - - if (!$this->validate()) { - // uncomment the following line if you do not want to return any records when validation fails - // $query->where('0=1'); - return $dataProvider; - } - - // grid filtering conditions - $query->andFilterWhere( - [ - 'id' => $this->id, - ] - ); - - $query->andFilterWhere( - [ - 'like', - 'blog_tag_lang.label', - $this->label, - ] - ); - - return $dataProvider; - } - } diff --git a/models/Category.php b/models/Category.php new file mode 100755 index 0000000..337b13b --- /dev/null +++ b/models/Category.php @@ -0,0 +1,130 @@ + [ + 'class' => LanguageBehavior::className(), + ], + ]; + } + + /** + * @inheritdoc + */ + public function rules() + { + return [ + [ + [ + 'sort', + 'parent_id', + ], + 'integer', + ], + [ + [ 'status' ], + 'boolean', + ], + [ + [ 'image' ], + 'string', + 'max' => 255, + ], + [ + [ 'parent_id' ], + 'default', + 'value' => 0, + ], + ]; + } + + /** + * @inheritdoc + */ + public function attributeLabels() + { + return [ + 'id' => 'ID', + 'sort' => 'Sort', + 'image' => 'Image', + 'parent_id' => 'Parent ID', + 'status' => 'Status', + ]; + } + + /** + * @return \yii\db\ActiveQuery + */ + public function getBlogArticles() + { + return $this->hasMany(BlogArticle::className(), [ 'id' => 'blog_article_id' ]) + ->viaTable('blog_article_to_category', [ 'blog_category_id' => 'id' ]); + } + + public function getParent() + { + return $this->hasOne(BlogCategory::className(), [ 'id' => 'parent_id' ]); + } + } diff --git a/models/CategoryLang.php b/models/CategoryLang.php new file mode 100755 index 0000000..35a259f --- /dev/null +++ b/models/CategoryLang.php @@ -0,0 +1,155 @@ + [ + 'class' => SlugBehavior::className(), + 'action' => 'blog-category/view', + 'params' => [ + 'id' => 'blog_category_id', + ], + 'fields' => [ + 'title' => 'Category title', + ], + ], + ]; + } + + /** + * @inheritdoc + */ + public function rules() + { + return [ + [ + [ + 'blog_category_id', + 'language_id', + ], + 'required', + ], + [ + [ + 'blog_category_id', + 'language_id', + ], + 'integer', + ], + [ + [ 'description' ], + 'string', + ], + [ + [ + 'title', + 'alias', + 'meta_title', + 'meta_description', + 'h1', + 'seo_text', + ], + 'string', + 'max' => 255, + ], + [ + [ 'alias' ], + 'unique', + ], + [ + [ + 'blog_category_id', + 'language_id', + ], + 'unique', + 'targetAttribute' => [ + 'blog_category_id', + 'language_id', + ], + 'message' => 'The combination of Blog Category ID and Language ID has already been taken.', + ], + [ + [ 'blog_category_id' ], + 'exist', + 'skipOnError' => true, + 'targetClass' => BlogCategory::className(), + 'targetAttribute' => [ 'blog_category_id' => 'id' ], + ], + [ + [ 'language_id' ], + 'exist', + 'skipOnError' => true, + 'targetClass' => Language::className(), + 'targetAttribute' => [ 'language_id' => 'id' ], + ], + ]; + } + + /** + * @inheritdoc + */ + public function attributeLabels() + { + return [ + 'id' => 'ID', + 'blog_category_id' => 'Blog Category ID', + 'language_id' => 'Language ID', + 'title' => 'Title', + 'alias' => 'Alias', + 'description' => 'Description', + 'meta_title' => 'Meta Title', + 'meta_description' => 'Meta Description', + 'h1' => 'H1', + 'seo_text' => 'Seo Text', + ]; + } + + /** + * @return \yii\db\ActiveQuery + */ + public function getBlogCategory() + { + return $this->hasOne(BlogCategory::className(), [ 'id' => 'blog_category_id' ]); + } + + /** + * @return \yii\db\ActiveQuery + */ + public function getLanguage() + { + return $this->hasOne(Language::className(), [ 'id' => 'language_id' ]); + } + } diff --git a/models/CategorySearch.php b/models/CategorySearch.php new file mode 100755 index 0000000..2591118 --- /dev/null +++ b/models/CategorySearch.php @@ -0,0 +1,116 @@ +joinWith('lang', 'parent.lang'); + + // add conditions that should always apply here + + $dataProvider = new ActiveDataProvider( + [ + 'query' => $query, + 'sort' => [ + 'attributes' => [ + 'title' => [ + 'asc' => [ 'blog_category_lang.title' => SORT_ASC ], + 'desc' => [ 'blog_category_lang.title' => SORT_DESC ], + ], + 'id', + ], + ], + ] + ); + + $this->load($params); + + if (!$this->validate()) { + // uncomment the following line if you do not want to return any records when validation fails + // $query->where('0=1'); + return $dataProvider; + } + + // grid filtering conditions + $query->andFilterWhere( + [ + 'id' => $this->id, + 'sort' => $this->sort, + 'parent_id' => $this->parent_id, + 'status' => $this->status, + ] + ); + + $query->andFilterWhere( + [ + 'like', + 'blog_category_lang.title', + $this->title, + ] + ); + + return $dataProvider; + } + } diff --git a/models/Tag.php b/models/Tag.php new file mode 100755 index 0000000..c2e3c37 --- /dev/null +++ b/models/Tag.php @@ -0,0 +1,93 @@ + [ + 'class' => LanguageBehavior::className(), + ], + ]; + } + + /** + * @inheritdoc + */ + public function rules() + { + return [ + [ + [ 'id' ], + 'integer', + ], + ]; + } + + /** + * @inheritdoc + */ + public function attributeLabels() + { + return [ + 'id' => 'ID', + ]; + } + + /** + * @return \yii\db\ActiveQuery + */ + public function getBlogArticles() + { + return $this->hasMany(Article::className(), [ 'id' => 'blog_article_id' ]) + ->viaTable('blog_article_to_tag', [ 'blog_tag_id' => 'id' ]); + } + } diff --git a/models/TagLang.php b/models/TagLang.php new file mode 100755 index 0000000..8388a04 --- /dev/null +++ b/models/TagLang.php @@ -0,0 +1,111 @@ + 255, + ], + [ + [ + 'blog_tag_id', + 'language_id', + ], + 'unique', + 'targetAttribute' => [ + 'blog_tag_id', + 'language_id', + ], + 'message' => 'The combination of Blog Tag ID and Language ID has already been taken.', + ], + [ + [ 'blog_tag_id' ], + 'exist', + 'skipOnError' => true, + 'targetClass' => Tag::className(), + 'targetAttribute' => [ 'blog_tag_id' => 'id' ], + ], + [ + [ 'language_id' ], + 'exist', + 'skipOnError' => true, + 'targetClass' => Language::className(), + 'targetAttribute' => [ 'language_id' => 'id' ], + ], + ]; + } + + /** + * @inheritdoc + */ + public function attributeLabels() + { + return [ + 'id' => 'ID', + 'blog_tag_id' => 'Blog Tag ID', + 'language_id' => 'Language ID', + 'label' => 'Label', + ]; + } + + /** + * @return \yii\db\ActiveQuery + */ + public function getBlogTag() + { + return $this->hasOne(Tag::className(), [ 'id' => 'blog_tag_id' ]); + } + + /** + * @return \yii\db\ActiveQuery + */ + public function getLanguage() + { + return $this->hasOne(Language::className(), [ 'id' => 'language_id' ]); + } + } diff --git a/models/TagSearch.php b/models/TagSearch.php new file mode 100755 index 0000000..3be2308 --- /dev/null +++ b/models/TagSearch.php @@ -0,0 +1,106 @@ +joinWith('lang'); + + // add conditions that should always apply here + + $dataProvider = new ActiveDataProvider( + [ + 'query' => $query, + 'sort' => [ + 'attributes' => [ + 'id', + 'label' => [ + 'asc' => [ 'blog_tag_lang.label' => SORT_ASC ], + 'desc' => [ 'blog_tag_lang.label' => SORT_DESC ], + ], + ], + ], + ] + ); + + $this->load($params); + + if (!$this->validate()) { + // uncomment the following line if you do not want to return any records when validation fails + // $query->where('0=1'); + return $dataProvider; + } + + // grid filtering conditions + $query->andFilterWhere( + [ + 'id' => $this->id, + ] + ); + + $query->andFilterWhere( + [ + 'like', + 'blog_tag_lang.label', + $this->label, + ] + ); + + return $dataProvider; + } + } diff --git a/views/blog-article/_form.php b/views/blog-article/_form.php index 964c2f1..fef4680 100755 --- a/views/blog-article/_form.php +++ b/views/blog-article/_form.php @@ -1,26 +1,28 @@ @@ -36,151 +38,137 @@ echo LanguageForm::widget( [ 'modelLangs' => $modelLangs, - 'formView' => '@artweb/artbox/blog/views/blog-article/_form_language', + 'formView' => '@artbox/weblog/views/blog-article/_form_language', 'form' => $form, ] ); ?> field($model, 'blogCategories') - ->widget( - Select2::className(), - [ - 'data' => $categories, - 'theme' => Select2::THEME_BOOTSTRAP, - 'options' => [ - 'placeholder' => \Yii::t('blog', 'Select category'), - 'multiple' => true, - ], - 'pluginOptions' => [ - 'allowClear' => true, - ], - ] - ); + // echo $form->field($model, 'blogCategories') + // ->widget( + // Select2::className(), + // [ + // 'data' => $categories, + // 'theme' => Select2::THEME_BOOTSTRAP, + // 'options' => [ + // 'placeholder' => \Yii::t('blog', 'Select category'), + // 'multiple' => true, + // ], + // 'pluginOptions' => [ + // 'allowClear' => true, + // ], + // ] + // ); ?> field($model, 'blogTags') - ->widget( - Select2::className(), - [ - 'data' => $tags, - 'theme' => Select2::THEME_BOOTSTRAP, - 'options' => [ - 'placeholder' => \Yii::t('blog', 'Select tag'), - 'multiple' => true, - ], - 'pluginOptions' => [ - 'allowClear' => true, - ], - ] - ); + // echo $form->field($model, 'blogTags') + // ->widget( + // Select2::className(), + // [ + // 'data' => $tags, + // 'theme' => Select2::THEME_BOOTSTRAP, + // 'options' => [ + // 'placeholder' => \Yii::t('blog', 'Select tag'), + // 'multiple' => true, + // ], + // 'pluginOptions' => [ + // 'allowClear' => true, + // ], + // ] + // ); ?> - field($model, 'image') + field($model, 'image_id') ->widget( - \kartik\file\FileInput::className(), + ImageManagerInputWidget::className(), [ - 'language' => 'ru', - 'options' => [ - 'accept' => 'image/*', - 'multiple' => false, - 'deleteurl' => $model->isNewRecord?false:Url::to(['/blog/blog-article/delete-image', 'id' => $model->id]), - 'class' => $model->isNewRecord?'':'artbox-delete-file', - ], - 'pluginOptions' => [ - 'allowedFileExtensions' => [ - 'jpg', - 'gif', - 'png', - ], - 'initialPreview' => !empty( $model->getImageUrl(0, false) ) ? \artweb\artbox\components\artboximage\ArtboxImageHelper::getImage( - $model->imageUrl, - 'list' - ) : '', - 'initialPreviewShowDelete' => false, - 'overwriteInitial' => true, - 'showRemove' => true, - 'showUpload' => false, - 'showClose' => false, - 'previewFileType' => 'image', - ], + 'aspectRatio' => ( 16 / 9 ), + //set the aspect ratio + 'showPreview' => true, + //false to hide the preview + 'showDeletePickedImageConfirm' => false, + //on true show warning before detach image ] ); ?> field($model, 'products') - ->widget( - Select2::className(), - [ - 'data' => $products, - 'options' => [ - 'placeholder' => \Yii::t('blog', 'Select related products'), - 'multiple' => true, - ], - 'pluginOptions' => [ - 'allowClear' => true, - 'minimumInputLength' => 3, - 'language' => [ - 'errorLoading' => new JsExpression( - "function () { return '" . \Yii::t('blog', 'Waiting for results') . "'; }" - ), - ], - 'ajax' => [ - 'url' => yii\helpers\Url::to([ '/blog/blog-article/product-list' ]), - 'dataType' => 'json', - 'data' => new JsExpression('function(params) { return {q:params.term}; }'), - ], - 'templateResult' => new JsExpression('function(product) { return product.text; }'), - 'templateSelection' => new JsExpression('function (product) { return product.text; }'), - ], - ] - ); + // echo $form->field($model, 'products') + // ->widget( + // Select2::className(), + // [ + // 'data' => $products, + // 'options' => [ + // 'placeholder' => \Yii::t('blog', 'Select related products'), + // 'multiple' => true, + // ], + // 'pluginOptions' => [ + // 'allowClear' => true, + // 'minimumInputLength' => 3, + // 'language' => [ + // 'errorLoading' => new JsExpression( + // "function () { return '" . \Yii::t('blog', 'Waiting for results') . "'; }" + // ), + // ], + // 'ajax' => [ + // 'url' => yii\helpers\Url::to([ '/blog/blog-article/product-list' ]), + // 'dataType' => 'json', + // 'data' => new JsExpression('function(params) { return {q:params.term}; }'), + // ], + // 'templateResult' => new JsExpression('function(product) { return product.text; }'), + // 'templateSelection' => new JsExpression('function (product) { return product.text; }'), + // ], + // ] + // ); ?> id )) { - $data = 'function(params) { return {q:params.term}; }'; - } else { - $data = 'function(params) { return {q:params.term, id:' . $model->id . '}; }'; - } - echo $form->field($model, 'blogArticles') - ->widget( - Select2::className(), - [ - 'data' => $articles, - 'options' => [ - 'placeholder' => \Yii::t('blog', 'Select related articles'), - 'multiple' => true, - ], - 'pluginOptions' => [ - 'allowClear' => true, - 'minimumInputLength' => 3, - 'language' => [ - 'errorLoading' => new JsExpression( - "function () { return '" . \Yii::t('blog', 'Waiting for results') . "'; }" - ), - ], - 'ajax' => [ - 'url' => yii\helpers\Url::to([ '/blog/blog-article/article-list' ]), - 'dataType' => 'json', - 'data' => new JsExpression( - $data - ), - ], - 'templateResult' => new JsExpression('function(article) { return article.text; }'), - 'templateSelection' => new JsExpression('function (article) { return article.text; }'), - ], - ] - ); + // if (empty( $model->id )) { + // $data = 'function(params) { return {q:params.term}; }'; + // } else { + // $data = 'function(params) { return {q:params.term, id:' . $model->id . '}; }'; + // } + // echo $form->field($model, 'blogArticles') + // ->widget( + // Select2::className(), + // [ + // 'data' => $articles, + // 'options' => [ + // 'placeholder' => \Yii::t('blog', 'Select related articles'), + // 'multiple' => true, + // ], + // 'pluginOptions' => [ + // 'allowClear' => true, + // 'minimumInputLength' => 3, + // 'language' => [ + // 'errorLoading' => new JsExpression( + // "function () { return '" . \Yii::t('blog', 'Waiting for results') . "'; }" + // ), + // ], + // 'ajax' => [ + // 'url' => yii\helpers\Url::to([ '/blog/blog-article/article-list' ]), + // 'dataType' => 'json', + // 'data' => new JsExpression( + // $data + // ), + // ], + // 'templateResult' => new JsExpression('function(article) { return article.text; }'), + // 'templateSelection' => new JsExpression('function (article) { return article.text; }'), + // ], + // ] + // ); ?> field($model, 'sort') ->textInput() ?> field($model, 'status') - ->checkbox() ?> + ->checkbox( + [ + 'class' => 'flat', + ] + ) ?> field($model, 'author_id') ->textInput() ?> diff --git a/views/blog-article/_form_language.php b/views/blog-article/_form_language.php index 1555405..496c979 100755 --- a/views/blog-article/_form_language.php +++ b/views/blog-article/_form_language.php @@ -1,39 +1,60 @@ -field($model_lang, '[' . $language->id . ']title') - ->textInput([ 'maxlength' => true ]); ?> +field($model_lang, '[' . $language->id . ']title') + ->textInput([ 'maxlength' => true ]); + echo $attributeField; +?> -field($model_lang, '[' . $language->id . ']alias') - ->textInput([ 'maxlength' => true ]); ?> +field($model_lang, '[' . $language->id . ']aliasValue'), + [ '/alias/slugify' ], + $attributeField +) + ->textInput([ 'maxlength' => true ]); ?> field($model_lang, '[' . $language->id . ']body') ->widget( - CKEditor::className(), + TinyMce::className(), [ - 'editorOptions' => ElFinder::ckeditorOptions( - 'elfinder', - [ - 'preset' => 'full', - 'inline' => false, - 'filebrowserUploadUrl' => Yii::$app->getUrlManager() - ->createUrl('file/uploader/images-upload'), - ] - ), + 'options' => [ 'rows' => 6 ], + 'language' => 'ru', + 'clientOptions' => [ + 'file_browser_callback' => new JsExpression( + "function(field_name, url, type, win) { +window.open('" . Url::to( + [ + 'imagemanager/manager', + 'view-mode' => 'iframe', + 'select-type' => 'tinymce', + ] + ) . "&tag_name='+field_name,'','width=800,height=540 ,toolbar=no,status=no,menubar=no,scrollbars=no,resizable=no'); +}" + ), + 'plugins' => [ + "advlist autolink lists link charmap print preview anchor", + "searchreplace visualblocks code fullscreen", + "insertdatetime media table contextmenu paste image", + ], + 'toolbar' => "undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image | code", + ], ] - ) ?> + ); ?> field($model_lang, '[' . $language->id . ']body_preview') ->textarea( @@ -41,15 +62,3 @@ 'rows' => '10', ] ) ?> - -field($model_lang, '[' . $language->id . ']meta_title') - ->textInput([ 'maxlength' => true ]); ?> - -field($model_lang, '[' . $language->id . ']meta_description') - ->textInput([ 'maxlength' => true ]); ?> - -field($model_lang, '[' . $language->id . ']seo_text') - ->textInput([ 'maxlength' => true ]); ?> - -field($model_lang, '[' . $language->id . ']h1') - ->textInput([ 'maxlength' => true ]); ?> diff --git a/views/blog-article/create.php b/views/blog-article/create.php index ad5d97b..dcec804 100755 --- a/views/blog-article/create.php +++ b/views/blog-article/create.php @@ -1,20 +1,16 @@ title = \Yii::t('blog', 'Create Blog Article'); @@ -26,18 +22,24 @@ ?>
-

title) ?>

+ $this->title, + ] + ); ?> render( '_form', [ 'model' => $model, 'modelLangs' => $modelLangs, - 'categories' => $categories, - 'tags' => $tags, + // 'categories' => $categories, + // 'tags' => $tags, 'products' => $products, 'articles' => $articles, ] ) ?> + +
diff --git a/views/blog-article/index.php b/views/blog-article/index.php index c5e301b..89c90b8 100755 --- a/views/blog-article/index.php +++ b/views/blog-article/index.php @@ -6,6 +6,7 @@ use yii\helpers\Html; use yii\grid\GridView; use yii\web\View; + use yiister\gentelella\widgets\Panel; /** * @var View $this @@ -18,12 +19,18 @@ ?>
-

title) ?>

- render('_search', ['model' => $searchModel]); ?> - -

- 'Blog Article']), [ 'create' ], [ 'class' => 'btn btn-success' ]) ?> -

+ $this->title, + ] + ); ?> +

+ 'Blog Article' ]), + [ 'create' ], + [ 'class' => 'btn btn-success' ] + ) ?> +

$dataProvider, @@ -37,7 +44,7 @@ 'imageUrl:image', [ 'attribute' => 'status', - 'value' => function($model) { + 'value' => function ($model) { /** * @var Article $model */ @@ -54,4 +61,7 @@ ], ] ); ?> + + +
diff --git a/views/blog-category/index.php b/views/blog-category/index.php index 960a553..ee13bd1 100755 --- a/views/blog-category/index.php +++ b/views/blog-category/index.php @@ -1,11 +1,10 @@
-

title) ?>

- render('_search', ['model' => $searchModel]); ?> - -

- 'btn btn-success' ]) ?> -

+ $this->title, + ] + ); ?> + +

+ 'btn btn-success' ]) ?> +

$dataProvider, @@ -37,11 +39,11 @@ 'imageUrl:image', [ 'label' => \Yii::t('blog', 'Parent category'), - 'value' => function($model) { + 'value' => function ($model) { /** * @var BlogCategory $model */ - if (!empty( $model->parent )) { + if (!empty($model->parent)) { return $model->parent->lang->title; } else { return false; @@ -50,7 +52,7 @@ ], [ 'attribute' => 'status', - 'value' => function($model) { + 'value' => function ($model) { /** * @var BlogCategory $model */ @@ -65,4 +67,7 @@ ], ] ); ?> + + +
diff --git a/views/blog-tag/index.php b/views/blog-tag/index.php index 086fb34..d396505 100755 --- a/views/blog-tag/index.php +++ b/views/blog-tag/index.php @@ -1,14 +1,15 @@
-

title) ?>

- render('_search', ['model' => $searchModel]); ?> - -

- 'btn btn-success' ]) ?> -

+ $this->title, + ] + ); ?> + +

+ 'btn btn-success' ]) ?> +

$dataProvider, @@ -39,4 +43,7 @@ ], ] ); ?> + + +
-- libgit2 0.21.4