#996 - Выбор цвета заголовка

parent fce17cf5
......@@ -29,10 +29,18 @@ use common\models\MetaTags;
*/
class CoContent extends \common\components\ActiveRecordModel
{
public $image;
const CUSTOM_DARK = 'dark';
const CUSTOM_WHITE = 'white';
const PHOTO_FOLDER = '/uploads/content/';
public $image;
public static $cutom_list = [
self::CUSTOM_DARK => 'Темный',
self::CUSTOM_WHITE => 'Светлый',
];
/**
* @inheritdoc
*/
......@@ -95,7 +103,7 @@ class CoContent extends \common\components\ActiveRecordModel
[['image'], 'file', 'skipOnEmpty' => true, 'extensions' => 'png, jpg, jpeg, gif'],
[['url'], 'required'],
[['url'], 'string', 'max' => 250],
[['category_id', 'priority'], 'safe'],
[['category_id', 'priority', 'custom'], 'safe'],
[['priority'], 'double']
];
}
......@@ -111,6 +119,7 @@ class CoContent extends \common\components\ActiveRecordModel
'url' => Yii::t('content', 'Url'),
'name' => Yii::t('content', 'Name'),
'image' => 'Превью',
'custom' => 'Заголовок',
'priority' => 'Приоритет в Sitemap',
'title' => Yii::t('content', 'Title'),
'text' => Yii::t('content', 'Content'),
......
......@@ -72,6 +72,10 @@ $blocks = \common\modules\content\models\CoBlocks::find()->all();
<?= $form->field($model, 'priority')->textInput(['maxlength' => 3])->hint('По умолчанию: 0.8') ?>
<?= $form->field($model, 'custom')->dropDownList(CoContent::$cutom_list, [
'class' => 'form-control',
]) ?>
<?php if($model->preview)
{
echo Html::img(\Yii::$app->params['frontUrl'] . CoContent::PHOTO_FOLDER . $model->preview);
......
<?php
use yii\db\Schema;
use yii\db\Migration;
class m160208_123717_add_column_co_content extends Migration
{
// Use safeUp/safeDown to run migration code within a transaction
public function safeUp()
{
$this->addColumn('co_content', 'custom', Schema::TYPE_STRING . '(20) DEFAULT NULL');
}
public function safeDown()
{
$this->dropColumn('co_content', 'custom');
}
}
......@@ -14,7 +14,7 @@ $models = CoContent::find()
<div class="col-md-6 col-xs-6 col-sm-12">
<div class="keys_block_small">
<img src="<?=CoContent::PHOTO_FOLDER . $model->preview?>" height="338" width="455">
<div class="keys_small_title"><?=$model->lang->title?></div>
<div class="keys_small_title" <?if($model->custom==CoContent::CUSTOM_WHITE){?>style="color:#fff;"<?}?>><?=$model->lang->title?></div>
<div class="keys_small_foot">
<?=Html::a('<span>Подробнее</span>', ['/'.$model->url], ['class' => 'keys_small_btn_more'])?>
<!-- <a href="#" class="keys_small_tags"># Big data</a> -->
......
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