bugfix content

parent f263f64b
...@@ -28,7 +28,7 @@ class ContentAdminController extends AdminController ...@@ -28,7 +28,7 @@ class ContentAdminController extends AdminController
'Update' => 'Редактирование контента', 'Update' => 'Редактирование контента',
'Delete' => 'Удаление контента', 'Delete' => 'Удаление контента',
'View' => 'Просмотр контента', 'View' => 'Просмотр контента',
'Copypage' => '', // 'Copy' => '',
]; ];
} }
...@@ -44,21 +44,22 @@ class ContentAdminController extends AdminController ...@@ -44,21 +44,22 @@ class ContentAdminController extends AdminController
]; ];
} }
public function actionCopypage($id) { // public function actionCopy($id)
$model = $this->findModel($id); // {
$meta = $model->metaTags->attributes; // $model = $this->findModel($id);
// $meta = $model->metaTags->attributes;
\Yii::$app->request->setBodyParams(['MetaTags' => $meta]);
$newPage = new CoContent(); // \Yii::$app->request->setBodyParams(['MetaTags' => $meta]);
$data = $model->attributes; // $newPage = new CoContent();
unset($data['id']); // $data = $model->attributes;
$data['url'] = ''; // unset($data['id']);
$newPage->setAttributes($data); // $data['url'] = '';
$newPage->name .= ' (Копия)'; // $newPage->setAttributes($data);
$newPage->save(false); // $newPage->name .= ' (Копия)';
// $newPage->save(false);
$this->redirect(['manage']);
} // $this->redirect(['manage']);
// }
/** /**
* Lists all CoContent models. * Lists all CoContent models.
......
...@@ -19,7 +19,7 @@ class SearchCoBlocks extends CoBlocks ...@@ -19,7 +19,7 @@ class SearchCoBlocks extends CoBlocks
{ {
return [ return [
[['id'], 'integer'], [['id'], 'integer'],
[['lang', 'title', 'name', 'text', 'category_id'], 'safe'], [['lang', 'title', 'name', 'category_id'], 'safe'],
]; ];
} }
...@@ -62,8 +62,7 @@ class SearchCoBlocks extends CoBlocks ...@@ -62,8 +62,7 @@ class SearchCoBlocks extends CoBlocks
$query->andFilterWhere(['like', 'lang', $this->lang]) $query->andFilterWhere(['like', 'lang', $this->lang])
->andFilterWhere(['like', 'title', $this->title]) ->andFilterWhere(['like', 'title', $this->title])
->andFilterWhere(['like', 'name', $this->name]) ->andFilterWhere(['like', 'name', $this->name]);
->andFilterWhere(['like', 'text', $this->text]);
return $dataProvider; return $dataProvider;
} }
......
...@@ -40,17 +40,15 @@ use yii\grid\GridView; ...@@ -40,17 +40,15 @@ use yii\grid\GridView;
], ],
[ [
'class' => 'common\components\ColorActionColumn', 'class' => 'common\components\ColorActionColumn',
'template' => '{copy} {update} {delete}', 'template' => '{update} {delete}',
'buttons' => [ 'buttons' => [
// 'copy' => function ($url, $model, $key) {
// Дмитрий Королев: хочется посмотреть как это будет вглядеть // return '<a href="'.Url::toRoute(['copy', 'id' => $model->id]).'">'.Html::beginTag('i', [
'copy' => function ($url, $model, $key) { // 'title' => "Копировать страницу",
return '<a href="'.Url::toRoute(['copypage', 'id' => $model->id]).'">'.Html::beginTag('i', [ // 'data-toggle' => 'tooltip',
'title' => "Копировать страницу", // 'class' => 'fa fa-copy fa-lg'
'data-toggle' => 'tooltip', // ]) . Html::endTag('i') . '</a>';
'class' => 'fa fa-copy fa-lg' // },
]) . Html::endTag('i') . '</a>';
},
], ],
], ],
], ],
......
<?php
$blocks = \common\modules\content\models\CoBlocks::find()->all();
if(count($blocks)) {
echo "<ul>";
foreach($blocks as $block) {
echo "<li>{{$block->name}} {$block->title}</li>";
}
echo "</ul><hr />";
}
echo $form;
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment