Commit d911bcd6 authored by Шакарим Сапа's avatar Шакарим Сапа

Merge remote-tracking branch 'origin/master'

parents a6f0711e d4f6ae9c
...@@ -41,7 +41,10 @@ class PageController extends \common\components\BaseController ...@@ -41,7 +41,10 @@ class PageController extends \common\components\BaseController
$this->meta_description = $model->metaTag->description; $this->meta_description = $model->metaTag->description;
$this->meta_keywords = $model->metaTag->keywords; $this->meta_keywords = $model->metaTag->keywords;
return $this->render('view', ['content'=>$content]); return $this->render('view', [
'content' => $content,
'model' => $model
]);
} }
} }
...@@ -32,6 +32,9 @@ class CoContent extends \common\components\ActiveRecordModel ...@@ -32,6 +32,9 @@ class CoContent extends \common\components\ActiveRecordModel
const CUSTOM_DARK = 'dark'; const CUSTOM_DARK = 'dark';
const CUSTOM_WHITE = 'white'; const CUSTOM_WHITE = 'white';
const TYPE_SIMPLE = 0;
const TYPE_LANDING = 1;
public $copyLangs; public $copyLangs;
public static $cutom_list = [ public static $cutom_list = [
...@@ -39,6 +42,11 @@ class CoContent extends \common\components\ActiveRecordModel ...@@ -39,6 +42,11 @@ class CoContent extends \common\components\ActiveRecordModel
self::CUSTOM_WHITE => 'Светлый', self::CUSTOM_WHITE => 'Светлый',
]; ];
public static $type_titles = [
self::TYPE_SIMPLE => 'Простой',
self::TYPE_LANDING => 'Лендинг',
];
/** /**
* @inheritdoc * @inheritdoc
*/ */
...@@ -107,9 +115,9 @@ class CoContent extends \common\components\ActiveRecordModel ...@@ -107,9 +115,9 @@ class CoContent extends \common\components\ActiveRecordModel
public function rules() public function rules()
{ {
return [ return [
[['active'], 'integer'], [['active', 'type'], 'integer'],
[['file'], 'file', 'skipOnEmpty' => true, 'extensions' => 'png, jpg, jpeg, gif'], [['file'], 'file', 'skipOnEmpty' => true, 'extensions' => 'png, jpg, jpeg, gif'],
[['url'], 'required'], [['url', 'type'], 'required'],
[['url'], 'string', 'max' => 250], [['url'], 'string', 'max' => 250],
[['category_id', 'priority', 'custom'], 'safe'], [['category_id', 'priority', 'custom'], 'safe'],
[['priority'], 'double'] [['priority'], 'double']
...@@ -123,6 +131,7 @@ class CoContent extends \common\components\ActiveRecordModel ...@@ -123,6 +131,7 @@ class CoContent extends \common\components\ActiveRecordModel
{ {
return [ return [
'id' => Yii::t('content', 'ID'), 'id' => Yii::t('content', 'ID'),
'type' => 'Тип страницы',
'category_id' => Yii::t('content', 'Category ID'), 'category_id' => Yii::t('content', 'Category ID'),
'url' => Yii::t('content', 'Url'), 'url' => Yii::t('content', 'Url'),
'name' => Yii::t('content', 'Name'), 'name' => Yii::t('content', 'Name'),
......
...@@ -45,6 +45,10 @@ $blocks = \common\modules\content\models\CoBlocks::find()->all(); ...@@ -45,6 +45,10 @@ $blocks = \common\modules\content\models\CoBlocks::find()->all();
'class' => 'form-control', 'class' => 'form-control',
]) ?> ]) ?>
<?= $form->field($model, 'type')->dropDownList(CoContent::$type_titles, [
'class' => 'form-control',
]) ?>
<?php if($model->preview) <?php if($model->preview)
{ {
echo Html::img(\Yii::$app->params['frontUrl'] . $model->preview); echo Html::img(\Yii::$app->params['frontUrl'] . $model->preview);
......
<?php <?php
/* @var $this yii\web\View */
echo $content; use common\modules\content\models\CoContent;
?> ?>
<?php if($model->type == CoContent::TYPE_SIMPLE) : ?>
<section class="simple-section <?=($model->custom==CoContent::CUSTOM_DARK?'dark':'')?>">
<div class="container">
<?php endif; ?>
<?=$content;?>
<?php if($model->type == CoContent::TYPE_SIMPLE) : ?>
</div>
</section>
<?=$this->render('@app/views/layouts/footer')?>
<?php endif; ?>
\ No newline at end of file
<?php
use yii\db\Schema;
use yii\db\Migration;
class m160316_114638_upgrade_content extends Migration
{
public function up()
{
$this->addColumn('co_content', 'type', Schema::TYPE_INTEGER . '(1) NOT NULL DEFAULT 1');
}
public function down()
{
$this->dropColumn('co_content', 'type');
}
}
...@@ -2654,4 +2654,86 @@ width: 95%; ...@@ -2654,4 +2654,86 @@ width: 95%;
padding-bottom: 20px; padding-bottom: 20px;
} }
}
.simple-section {
background: white;
color: #2d323a;
padding-top: 30px;
padding-bottom: 30px;
}
.simple-section p {
font-size: 17px;
line-height: 26px;
color: #2d323a;
}
.simple-section em {
font-style: italic;
}
.simple-section h1,
.simple-section h2,
.simple-section h3,
.simple-section h4,
.simple-section h5,
.simple-section h6 {
color: #444;
font-family: "RobotoBold";
margin: 30px 0 36px;
text-align: left;
}
.simple-section h1 {
font-size: 31px;
}
.simple-section h2 {
font-size: 28px;
}
.simple-section h3 {
font-size: 25px;
}
.simple-section h4 {
font-size: 22px;
}
.simple-section h5 {
font-size: 19px;
}
.simple-section h6 {
font-size: 16px;
}
.simple-section.dark {
background: url(../images/no_found_bg.jpg) repeat-y center center;
background-size: cover;
-moz-background-size: cover;
-webkit-background-size: cover;
-o-background-size: cover;
}
.simple-section ul {
list-style: none !important;
margin-top: 14px !important;
}
.simple-section ul li {
background: url(../images/how_rosneft_list.png) no-repeat left 6px;
padding-left: 27px !important;
margin-bottom: 14px !important;
font-size: 21px;
color: #2d323a;
font-family: "RobotoBold";
}
.simple-section ol {
margin-top: 14px !important;
padding-left: 47px !important;
}
.simple-section ol li {
margin-bottom: 14px !important;
font-size: 21px;
color: #2d323a;
font-family: "RobotoBold";
} }
\ No newline at end of file
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