bugfix content

parent f263f64b
......@@ -28,7 +28,7 @@ class ContentAdminController extends AdminController
'Update' => 'Редактирование контента',
'Delete' => 'Удаление контента',
'View' => 'Просмотр контента',
'Copypage' => '',
// 'Copy' => '',
];
}
......@@ -44,21 +44,22 @@ class ContentAdminController extends AdminController
];
}
public function actionCopypage($id) {
$model = $this->findModel($id);
$meta = $model->metaTags->attributes;
\Yii::$app->request->setBodyParams(['MetaTags' => $meta]);
$newPage = new CoContent();
$data = $model->attributes;
unset($data['id']);
$data['url'] = '';
$newPage->setAttributes($data);
$newPage->name .= ' (Копия)';
$newPage->save(false);
$this->redirect(['manage']);
}
// public function actionCopy($id)
// {
// $model = $this->findModel($id);
// $meta = $model->metaTags->attributes;
// \Yii::$app->request->setBodyParams(['MetaTags' => $meta]);
// $newPage = new CoContent();
// $data = $model->attributes;
// unset($data['id']);
// $data['url'] = '';
// $newPage->setAttributes($data);
// $newPage->name .= ' (Копия)';
// $newPage->save(false);
// $this->redirect(['manage']);
// }
/**
* Lists all CoContent models.
......
......@@ -19,7 +19,7 @@ class SearchCoBlocks extends CoBlocks
{
return [
[['id'], 'integer'],
[['lang', 'title', 'name', 'text', 'category_id'], 'safe'],
[['lang', 'title', 'name', 'category_id'], 'safe'],
];
}
......@@ -62,8 +62,7 @@ class SearchCoBlocks extends CoBlocks
$query->andFilterWhere(['like', 'lang', $this->lang])
->andFilterWhere(['like', 'title', $this->title])
->andFilterWhere(['like', 'name', $this->name])
->andFilterWhere(['like', 'text', $this->text]);
->andFilterWhere(['like', 'name', $this->name]);
return $dataProvider;
}
......
......@@ -40,17 +40,15 @@ use yii\grid\GridView;
],
[
'class' => 'common\components\ColorActionColumn',
'template' => '{copy} {update} {delete}',
'template' => '{update} {delete}',
'buttons' => [
// Дмитрий Королев: хочется посмотреть как это будет вглядеть
'copy' => function ($url, $model, $key) {
return '<a href="'.Url::toRoute(['copypage', 'id' => $model->id]).'">'.Html::beginTag('i', [
'title' => "Копировать страницу",
'data-toggle' => 'tooltip',
'class' => 'fa fa-copy fa-lg'
]) . Html::endTag('i') . '</a>';
},
// 'copy' => function ($url, $model, $key) {
// return '<a href="'.Url::toRoute(['copy', 'id' => $model->id]).'">'.Html::beginTag('i', [
// 'title' => "Копировать страницу",
// 'data-toggle' => 'tooltip',
// '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