Commit 327110e4 authored by Shakarim Sapa's avatar Shakarim Sapa

Merge remote-tracking branch 'origin/master'

parents e6112437 8125d08a
...@@ -22,6 +22,7 @@ class AppAsset extends AssetBundle ...@@ -22,6 +22,7 @@ class AppAsset extends AssetBundle
'plugins/bootstrap-datetimepicker/css/datetimepicker.css', 'plugins/bootstrap-datetimepicker/css/datetimepicker.css',
'plugins/switchery/switchery.min.css', 'plugins/switchery/switchery.min.css',
'plugins/powerange/powerange.min.css', 'plugins/powerange/powerange.min.css',
'plugins/jquery-tag-it/css/jquery.tagit.css',
'css/site.css', 'css/site.css',
]; ];
public $js = [ public $js = [
...@@ -29,8 +30,14 @@ class AppAsset extends AssetBundle ...@@ -29,8 +30,14 @@ class AppAsset extends AssetBundle
'plugins/bootstrap-datetimepicker/js/bootstrap-datetimepicker.js', 'plugins/bootstrap-datetimepicker/js/bootstrap-datetimepicker.js',
'plugins/bootstrap-datetimepicker/js/locales/bootstrap-datetimepicker.ru.js', 'plugins/bootstrap-datetimepicker/js/locales/bootstrap-datetimepicker.ru.js',
'plugins/tinymce/js/tinymce/tinymce.min.js', 'plugins/tinymce/js/tinymce/tinymce.min.js',
'plugins/jquery-tag-it/js/tag-it.min.js',
'js/form-load.js'
]; ];
public $depends = [ public $depends = [
'yii\web\JqueryAsset',
'yii\jui\JuiAsset',
'yii\bootstrap\BootstrapAsset',
'yii\bootstrap\BootstrapPluginAsset',
'backend\assets\HeadAsset',
]; ];
} }
...@@ -22,15 +22,19 @@ class HeadAsset extends AssetBundle ...@@ -22,15 +22,19 @@ class HeadAsset extends AssetBundle
public $js = [ public $js = [
'plugins/switchery/switchery.min.js', 'plugins/switchery/switchery.min.js',
'plugins/powerange/powerange.min.js', 'plugins/powerange/powerange.min.js',
'plugins/pace/pace.min.js',
'js/form-slider-switcher.demo.min.js', 'js/form-slider-switcher.demo.min.js',
'js/apps.min.js',
'js/packages/adminBaseClasses/buttonSet.js', 'js/packages/adminBaseClasses/buttonSet.js',
'js/packages/adminBaseClasses/gridBase.js', 'js/packages/adminBaseClasses/gridBase.js',
'js/apps.min.js',
]; ];
public $jsOptions = [ public $jsOptions = [
'position' => \yii\web\View::POS_HEAD 'position' => \yii\web\View::POS_HEAD
]; ];
public $depends = [ public $depends = [
'yii\web\JqueryAsset',
'yii\jui\JuiAsset',
'yii\bootstrap\BootstrapAsset',
'yii\bootstrap\BootstrapPluginAsset',
]; ];
} }
...@@ -66,6 +66,10 @@ return [ ...@@ -66,6 +66,10 @@ return [
'assetManager'=>[ 'assetManager'=>[
'linkAssets' => true, 'linkAssets' => true,
'bundles' => [ 'bundles' => [
'xj\tagit\TagitAsset' => [
'js' => [],
'css' => []
],
'yii\bootstrap\BootstrapPluginAsset' => [ 'yii\bootstrap\BootstrapPluginAsset' => [
'js' => [ 'js' => [
], ],
......
...@@ -54,11 +54,6 @@ AppAsset::register($this); ...@@ -54,11 +54,6 @@ AppAsset::register($this);
<?php $this->endBody() ?> <?php $this->endBody() ?>
<?php <?php
$this->registerJsFile('/plugins/jquery/jquery-1.9.1.js', ['position' => \yii\web\View::POS_END]);
$this->registerJsFile('/plugins/jquery/jquery-migrate-1.1.0.js', ['position' => \yii\web\View::POS_END ]);
$this->registerJsFile('/plugins/jquery-ui/ui/minified/jquery-ui.min.js', ['position' => \yii\web\View::POS_END ]);
$this->registerJsFile('/plugins/bootstrap/js/bootstrap.min.js', ['position' => \yii\web\View::POS_END ]);
$this->registerJsFile('/js/yii.activeForm.js', ['position' => \yii\web\View::POS_END]);
$this->registerJsFile('/plugins/jquery/jquery-1.9.1.js', ['position' => \yii\web\View::POS_HEAD]); $this->registerJsFile('/plugins/jquery/jquery-1.9.1.js', ['position' => \yii\web\View::POS_HEAD]);
$this->registerJsFile('/plugins/jquery/jquery-migrate-1.1.0.js', ['position' => \yii\web\View::POS_HEAD ]); $this->registerJsFile('/plugins/jquery/jquery-migrate-1.1.0.js', ['position' => \yii\web\View::POS_HEAD ]);
......
<!-- ================== BEGIN BASE JS ================== --> <!-- ================== BEGIN BASE JS ================== -->
<?php $this->registerJsFile('/plugins/jquery/jquery-1.9.1.min.js', ['position' => \yii\web\View::POS_HEAD ]);?>
<?php $this->registerJsFile('/plugins/jquery/jquery-migrate-1.1.0.min.js', ['position' => \yii\web\View::POS_END ]);?> <?php $this->registerJsFile('/plugins/jquery/jquery-migrate-1.1.0.min.js', ['position' => \yii\web\View::POS_END ]);?>
<?php $this->registerJsFile('/plugins/jquery-ui/ui/minified/jquery-ui.min.js', ['position' => \yii\web\View::POS_END ]);?>
<?php $this->registerJsFile('/plugins/bootstrap/js/bootstrap.min.js', ['position' => \yii\web\View::POS_END ]);?> <?php $this->registerJsFile('/plugins/bootstrap/js/bootstrap.min.js', ['position' => \yii\web\View::POS_END ]);?>
<!--[if lt IE 9]> <!--[if lt IE 9]>
...@@ -28,7 +26,6 @@ ...@@ -28,7 +26,6 @@
<?php $this->registerJsFile('/plugins/bootstrap-select/bootstrap-select.js', ['position' => \yii\web\View::POS_END ]);?> <?php $this->registerJsFile('/plugins/bootstrap-select/bootstrap-select.js', ['position' => \yii\web\View::POS_END ]);?>
<?php //$this->registerJsFile('/js/dashboard.min.js', ['position' => \yii\web\View::POS_END ]);?> <?php //$this->registerJsFile('/js/dashboard.min.js', ['position' => \yii\web\View::POS_END ]);?>
<?php $this->registerJsFile('/js/dashboard.js', ['position' => \yii\web\View::POS_END ]);?> <?php $this->registerJsFile('/js/dashboard.js', ['position' => \yii\web\View::POS_END ]);?>
<?php $this->registerJsFile('/js/apps.min.js', ['position' => \yii\web\View::POS_END ]);?>
<!-- ================== END PAGE LEVEL JS ================== --> <!-- ================== END PAGE LEVEL JS ================== -->
......
...@@ -16,7 +16,3 @@ ...@@ -16,7 +16,3 @@
<?php $this->registerCssFile('/plugins/gritter/css/jquery.gritter.css', ['position' => \yii\web\View::POS_HEAD ]);?> <?php $this->registerCssFile('/plugins/gritter/css/jquery.gritter.css', ['position' => \yii\web\View::POS_HEAD ]);?>
<?php $this->registerCssFile('/plugins/DataTables/css/data-table.css', ['position' => \yii\web\View::POS_HEAD ]);?> <?php $this->registerCssFile('/plugins/DataTables/css/data-table.css', ['position' => \yii\web\View::POS_HEAD ]);?>
<?php $this->registerJsFile('/plugins/pace/pace.min.js', ['position' => \yii\web\View::POS_HEAD ]);?>
<?php $this->registerJsFile('/js/form-load.js', ['position' => \yii\web\View::POS_END ]);?>
...@@ -9,7 +9,6 @@ use yii\widgets\Breadcrumbs; ...@@ -9,7 +9,6 @@ use yii\widgets\Breadcrumbs;
/* @var $content string */ /* @var $content string */
//die('-!-!-'); //die('-!-!-');
assets\AppAsset::register($this); assets\AppAsset::register($this);
assets\HeadAsset::register($this);
?> ?>
<?php $this->beginPage() ?> <?php $this->beginPage() ?>
<!DOCTYPE html> <!DOCTYPE html>
......
...@@ -119,6 +119,6 @@ $this->params['breadcrumbs'][] = $this->title; ...@@ -119,6 +119,6 @@ $this->params['breadcrumbs'][] = $this->title;
<?php <?php
$this->registerJsFile('/js/login-v2.demo.min.js', ['position' => \yii\web\View::POS_END ]); $this->registerJsFile('/js/login-v2.demo.min.js', ['position' => \yii\web\View::POS_END ]);
$this->registerJsFile('/js/apps.min.js', ['position' => \yii\web\View::POS_END ]); // $this->registerJsFile('/js/apps.min.js', ['position' => \yii\web\View::POS_END ]);
$this->registerJs('App.init();LoginV2.init();', \yii\web\View::POS_READY); $this->registerJs('App.init();LoginV2.init();', \yii\web\View::POS_READY);
?> ?>
\ No newline at end of file
...@@ -236,12 +236,12 @@ ...@@ -236,12 +236,12 @@
that._lastTag().removeClass('remove ui-state-highlight'); that._lastTag().removeClass('remove ui-state-highlight');
} }
// Comma/Space/Enter are all valid delimiters for new tags, // Space/Enter are all valid delimiters for new tags,
// except when there is an open quote or if setting allowSpaces = true. // except when there is an open quote or if setting allowSpaces = true.
// Tab will also create a tag, unless the tag input is empty, // Tab will also create a tag, unless the tag input is empty,
// in which case it isn't caught. // in which case it isn't caught.
if ( if (
(event.which === $.ui.keyCode.COMMA && event.shiftKey === false) || /*(event.which === $.ui.keyCode.COMMA && event.shiftKey === false) || */
event.which === $.ui.keyCode.ENTER || event.which === $.ui.keyCode.ENTER ||
( (
event.which == $.ui.keyCode.TAB && event.which == $.ui.keyCode.TAB &&
......
...@@ -3,7 +3,7 @@ this;this.element.is("input")?(this.tagList=b("<ul></ul>").insertAfter(this.elem ...@@ -3,7 +3,7 @@ this;this.element.is("input")?(this.tagList=b("<ul></ul>").insertAfter(this.elem
this.options.placeholderText);this.options.autocomplete.source||(this.options.autocomplete.source=function(a,e){var d=a.term.toLowerCase(),c=b.grep(this.options.availableTags,function(a){return 0===a.toLowerCase().indexOf(d)});this.options.allowDuplicates||(c=this._subtractArray(c,this.assignedTags()));e(c)});this.options.showAutocompleteOnFocus&&(this.tagInput.focus(function(b,d){a._showAutocomplete()}),"undefined"===typeof this.options.autocomplete.minLength&&(this.options.autocomplete.minLength= this.options.placeholderText);this.options.autocomplete.source||(this.options.autocomplete.source=function(a,e){var d=a.term.toLowerCase(),c=b.grep(this.options.availableTags,function(a){return 0===a.toLowerCase().indexOf(d)});this.options.allowDuplicates||(c=this._subtractArray(c,this.assignedTags()));e(c)});this.options.showAutocompleteOnFocus&&(this.tagInput.focus(function(b,d){a._showAutocomplete()}),"undefined"===typeof this.options.autocomplete.minLength&&(this.options.autocomplete.minLength=
0));b.isFunction(this.options.autocomplete.source)&&(this.options.autocomplete.source=b.proxy(this.options.autocomplete.source,this));b.isFunction(this.options.tagSource)&&(this.options.tagSource=b.proxy(this.options.tagSource,this));this.tagList.addClass("tagit").addClass("ui-widget ui-widget-content ui-corner-all").append(b('<li class="tagit-new"></li>').append(this.tagInput)).click(function(d){var c=b(d.target);c.hasClass("tagit-label")?(c=c.closest(".tagit-choice"),c.hasClass("removed")||a._trigger("onTagClicked", 0));b.isFunction(this.options.autocomplete.source)&&(this.options.autocomplete.source=b.proxy(this.options.autocomplete.source,this));b.isFunction(this.options.tagSource)&&(this.options.tagSource=b.proxy(this.options.tagSource,this));this.tagList.addClass("tagit").addClass("ui-widget ui-widget-content ui-corner-all").append(b('<li class="tagit-new"></li>').append(this.tagInput)).click(function(d){var c=b(d.target);c.hasClass("tagit-label")?(c=c.closest(".tagit-choice"),c.hasClass("removed")||a._trigger("onTagClicked",
d,{tag:c,tagLabel:a.tagLabel(c)})):a.tagInput.focus()});var c=!1;if(this.options.singleField)if(this.options.singleFieldNode){var d=b(this.options.singleFieldNode),f=d.val().split(this.options.singleFieldDelimiter);d.val("");b.each(f,function(b,d){a.createTag(d,null,!0);c=!0})}else this.options.singleFieldNode=b('<input type="hidden" style="display:none;" value="" name="'+this.options.fieldName+'" />'),this.tagList.after(this.options.singleFieldNode);c||this.tagList.children("li").each(function(){b(this).hasClass("tagit-new")|| d,{tag:c,tagLabel:a.tagLabel(c)})):a.tagInput.focus()});var c=!1;if(this.options.singleField)if(this.options.singleFieldNode){var d=b(this.options.singleFieldNode),f=d.val().split(this.options.singleFieldDelimiter);d.val("");b.each(f,function(b,d){a.createTag(d,null,!0);c=!0})}else this.options.singleFieldNode=b('<input type="hidden" style="display:none;" value="" name="'+this.options.fieldName+'" />'),this.tagList.after(this.options.singleFieldNode);c||this.tagList.children("li").each(function(){b(this).hasClass("tagit-new")||
(a.createTag(b(this).text(),b(this).attr("class"),!0),b(this).remove())});this.tagInput.keydown(function(c){if(c.which==b.ui.keyCode.BACKSPACE&&""===a.tagInput.val()){var d=a._lastTag();!a.options.removeConfirmation||d.hasClass("remove")?a.removeTag(d):a.options.removeConfirmation&&d.addClass("remove ui-state-highlight")}else a.options.removeConfirmation&&a._lastTag().removeClass("remove ui-state-highlight");if(c.which===b.ui.keyCode.COMMA&&!1===c.shiftKey||c.which===b.ui.keyCode.ENTER||c.which== (a.createTag(b(this).text(),b(this).attr("class"),!0),b(this).remove())});this.tagInput.keydown(function(c){if(c.which==b.ui.keyCode.BACKSPACE&&""===a.tagInput.val()){var d=a._lastTag();!a.options.removeConfirmation||d.hasClass("remove")?a.removeTag(d):a.options.removeConfirmation&&d.addClass("remove ui-state-highlight")}else a.options.removeConfirmation&&a._lastTag().removeClass("remove ui-state-highlight");if(/*c.which===b.ui.keyCode.COMMA&&!1===c.shiftKey||*/c.which===b.ui.keyCode.ENTER||c.which==
b.ui.keyCode.TAB&&""!==a.tagInput.val()||c.which==b.ui.keyCode.SPACE&&!0!==a.options.allowSpaces&&('"'!=b.trim(a.tagInput.val()).replace(/^s*/,"").charAt(0)||'"'==b.trim(a.tagInput.val()).charAt(0)&&'"'==b.trim(a.tagInput.val()).charAt(b.trim(a.tagInput.val()).length-1)&&0!==b.trim(a.tagInput.val()).length-1))c.which===b.ui.keyCode.ENTER&&""===a.tagInput.val()||c.preventDefault(),a.options.autocomplete.autoFocus&&a.tagInput.data("autocomplete-open")||(a.tagInput.autocomplete("close"),a.createTag(a._cleanedInput()))}).blur(function(b){a.tagInput.data("autocomplete-open")|| b.ui.keyCode.TAB&&""!==a.tagInput.val()||c.which==b.ui.keyCode.SPACE&&!0!==a.options.allowSpaces&&('"'!=b.trim(a.tagInput.val()).replace(/^s*/,"").charAt(0)||'"'==b.trim(a.tagInput.val()).charAt(0)&&'"'==b.trim(a.tagInput.val()).charAt(b.trim(a.tagInput.val()).length-1)&&0!==b.trim(a.tagInput.val()).length-1))c.which===b.ui.keyCode.ENTER&&""===a.tagInput.val()||c.preventDefault(),a.options.autocomplete.autoFocus&&a.tagInput.data("autocomplete-open")||(a.tagInput.autocomplete("close"),a.createTag(a._cleanedInput()))}).blur(function(b){a.tagInput.data("autocomplete-open")||
a.createTag(a._cleanedInput())});if(this.options.availableTags||this.options.tagSource||this.options.autocomplete.source)d={select:function(b,c){a.createTag(c.item.value);return!1}},b.extend(d,this.options.autocomplete),d.source=this.options.tagSource||d.source,this.tagInput.autocomplete(d).bind("autocompleteopen.tagit",function(b,c){a.tagInput.data("autocomplete-open",!0)}).bind("autocompleteclose.tagit",function(b,c){a.tagInput.data("autocomplete-open",!1)}),this.tagInput.autocomplete("widget").addClass("tagit-autocomplete")}, a.createTag(a._cleanedInput())});if(this.options.availableTags||this.options.tagSource||this.options.autocomplete.source)d={select:function(b,c){a.createTag(c.item.value);return!1}},b.extend(d,this.options.autocomplete),d.source=this.options.tagSource||d.source,this.tagInput.autocomplete(d).bind("autocompleteopen.tagit",function(b,c){a.tagInput.data("autocomplete-open",!0)}).bind("autocompleteclose.tagit",function(b,c){a.tagInput.data("autocomplete-open",!1)}),this.tagInput.autocomplete("widget").addClass("tagit-autocomplete")},
destroy:function(){b.Widget.prototype.destroy.call(this);this.element.unbind(".tagit");this.tagList.unbind(".tagit");this.tagInput.removeData("autocomplete-open");this.tagList.removeClass("tagit ui-widget ui-widget-content ui-corner-all tagit-hidden-field");this.element.is("input")?(this.element.removeClass("tagit-hidden-field"),this.tagList.remove()):(this.element.children("li").each(function(){b(this).hasClass("tagit-new")?b(this).remove():(b(this).removeClass("tagit-choice ui-widget-content ui-state-default ui-state-highlight ui-corner-all remove tagit-choice-editable tagit-choice-read-only"), destroy:function(){b.Widget.prototype.destroy.call(this);this.element.unbind(".tagit");this.tagList.unbind(".tagit");this.tagInput.removeData("autocomplete-open");this.tagList.removeClass("tagit ui-widget ui-widget-content ui-corner-all tagit-hidden-field");this.element.is("input")?(this.element.removeClass("tagit-hidden-field"),this.tagList.remove()):(this.element.children("li").each(function(){b(this).hasClass("tagit-new")?b(this).remove():(b(this).removeClass("tagit-choice ui-widget-content ui-state-default ui-state-highlight ui-corner-all remove tagit-choice-editable tagit-choice-read-only"),
......
...@@ -12,6 +12,8 @@ class MetaTagBehavior extends Behavior ...@@ -12,6 +12,8 @@ class MetaTagBehavior extends Behavior
{ {
public $meta; public $meta;
public $actions = [];
public function events() public function events()
{ {
return [ return [
...@@ -25,25 +27,25 @@ class MetaTagBehavior extends Behavior ...@@ -25,25 +27,25 @@ class MetaTagBehavior extends Behavior
public function eventInit($event) public function eventInit($event)
{ {
$langs = Languages::find()->all(); if(in_array(Yii::$app->controller->action->id, $this->actions))
if($this->owner->isNewRecord)
{ {
$langs = Languages::find()->all();
foreach ($langs as $lang) foreach ($langs as $lang)
{ {
$mt = new MetaTags; $mt = new MetaTags;
$mt->lang_id = $lang->id; $mt->lang_id = $lang->id;
$this->meta[$lang->id] = $mt; $this->meta[$lang->id] = $mt;
} }
} }
} }
public function eventFind($event) public function eventFind($event)
{ {
$langs = Languages::find()->all(); if(in_array(Yii::$app->controller->action->id, $this->actions))
if(!$this->owner->isNewRecord)
{ {
$langs = Languages::find()->all();
foreach ($langs as $lang) foreach ($langs as $lang)
{ {
$mt = $this->owner->getMetaTags($lang->id)->one(); $mt = $this->owner->getMetaTags($lang->id)->one();
......
<?php
namespace common\modules\blog\components;
use Yii;
use yii\base\Behavior;
use yii\db\ActiveRecord;
use yii\helpers\ArrayHelper;
use common\modules\blog\models\PostTag;
use common\modules\blog\models\PostTagAssign;
class TagBehavior extends Behavior
{
public $tags;
public function events()
{
return [
ActiveRecord::EVENT_AFTER_FIND => 'eventFind',
ActiveRecord::EVENT_AFTER_UPDATE => 'Save',
ActiveRecord::EVENT_AFTER_INSERT => 'Insert',
ActiveRecord::EVENT_BEFORE_DELETE => 'Delete',
];
}
private function clearPostTags()
{
if($this->owner->postTagAssigns)
{
foreach ($this->owner->postTagAssigns as $tag)
{
$tag->delete();
}
}
}
private function insertPostTags()
{
if($this->tags)
{
foreach ($this->tags as $tag)
{
$tg = PostTag::find()->where(['name' => $tag])->one();
if(!$tg)
{
$tg = new PostTag;
$tg->name = $tag;
$tg->save();
}
$tgs = new PostTagAssign;
$tgs->post_id = $this->owner->id;
$tgs->tag_id = $tg->id;
$tgs->save();
}
}
}
public function eventFind($event)
{
$this->tags = array_keys(ArrayHelper::map($this->owner->postTags, 'name', 'id'));
}
public function Save($event)
{
$this->clearPostTags();
$this->insertPostTags();
return true;
}
public function Insert($event)
{
$this->insertPostTags();
return true;
}
public function Delete($event)
{
$this->clearPostTags();
return true;
}
}
...@@ -6,10 +6,13 @@ use Yii; ...@@ -6,10 +6,13 @@ use Yii;
use common\components\AdminController; use common\components\AdminController;
use yii\web\NotFoundHttpException; use yii\web\NotFoundHttpException;
use yii\filters\VerbFilter; use yii\filters\VerbFilter;
use yii\web\Response;
use yii\helpers\ArrayHelper;
use common\modules\languages\models\Languages; use common\modules\languages\models\Languages;
use common\modules\blog\models\Post; use common\modules\blog\models\Post;
use common\modules\blog\models\PostLang; use common\modules\blog\models\PostLang;
use common\modules\blog\models\PostTag;
use common\modules\blog\models\SearchPost; use common\modules\blog\models\SearchPost;
/** /**
...@@ -24,6 +27,7 @@ class PostAdminController extends AdminController ...@@ -24,6 +27,7 @@ class PostAdminController extends AdminController
'Update' => 'Редактирование записи', 'Update' => 'Редактирование записи',
'Delete' => 'Удаление записи', 'Delete' => 'Удаление записи',
'View' => 'Просмотр записи', 'View' => 'Просмотр записи',
'Autocomplete' => 'Автокомплит для поля тегов'
]; ];
} }
...@@ -155,6 +159,13 @@ class PostAdminController extends AdminController ...@@ -155,6 +159,13 @@ class PostAdminController extends AdminController
return $this->redirect(['index']); return $this->redirect(['index']);
} }
public function actionAutocomplete($term)
{
Yii::$app->response->format = Response::FORMAT_JSON;
return array_keys(ArrayHelper::map(PostTag::find()->where(['like', 'name', $term])->all(), 'name', 'id'));
}
/** /**
* Finds the Post model based on its primary key value. * Finds the Post model based on its primary key value.
* If the model is not found, a 404 HTTP exception will be thrown. * If the model is not found, a 404 HTTP exception will be thrown.
......
...@@ -40,7 +40,10 @@ class PostController extends BaseController ...@@ -40,7 +40,10 @@ class PostController extends BaseController
*/ */
protected function findModelByUrl($url) protected function findModelByUrl($url)
{ {
if (($model = Post::find()->where(['url' => $url])->one()) !== null) { if (($model = Post::find()->where([
'url' => $url,
'active' => 1
])->one()) !== null) {
return $model; return $model;
} else { } else {
throw new NotFoundHttpException('The requested page does not exist.'); throw new NotFoundHttpException('The requested page does not exist.');
......
...@@ -6,7 +6,7 @@ use Yii; ...@@ -6,7 +6,7 @@ use Yii;
use common\modules\languages\models\Languages; use common\modules\languages\models\Languages;
use common\modules\blog\models\PostLang; use common\modules\blog\models\PostLang;
use common\modules\blog\models\PostTags; use common\modules\blog\models\PostTag;
use common\models\MetaTags; use common\models\MetaTags;
/** /**
...@@ -55,7 +55,7 @@ class Post extends \common\components\ActiveRecordModel ...@@ -55,7 +55,7 @@ class Post extends \common\components\ActiveRecordModel
[['active', 'created_at', 'updated_at'], 'integer'], [['active', 'created_at', 'updated_at'], 'integer'],
[['url'], 'string', 'max' => 255], [['url'], 'string', 'max' => 255],
[['url'], 'unique'], [['url'], 'unique'],
[['preview', 'unlinkFile'], 'safe'], [['preview', 'unlinkFile', 'tags'], 'safe'],
[['file'], 'file', 'skipOnEmpty' => true, 'extensions' => 'png, jpg, jpeg, gif'], [['file'], 'file', 'skipOnEmpty' => true, 'extensions' => 'png, jpg, jpeg, gif'],
]; ];
} }
...@@ -68,6 +68,7 @@ class Post extends \common\components\ActiveRecordModel ...@@ -68,6 +68,7 @@ class Post extends \common\components\ActiveRecordModel
return [ return [
'meta' => [ 'meta' => [
'class' => 'common\components\activeRecordBehaviors\MetaTagBehavior', 'class' => 'common\components\activeRecordBehaviors\MetaTagBehavior',
'actions' => ['create', 'update']
], ],
'langs' => [ 'langs' => [
'class' => 'common\modules\languages\components\LanguageHelperBehavior', 'class' => 'common\modules\languages\components\LanguageHelperBehavior',
...@@ -75,6 +76,12 @@ class Post extends \common\components\ActiveRecordModel ...@@ -75,6 +76,12 @@ class Post extends \common\components\ActiveRecordModel
'langClass' => 'common\modules\blog\models\PostLang', 'langClass' => 'common\modules\blog\models\PostLang',
'actions' => ['create', 'update'] 'actions' => ['create', 'update']
], ],
'tags' => [
'class' => 'common\modules\blog\components\TagBehavior',
],
'Timestamp' => [
'class' => '\yii\behaviors\TimestampBehavior',
],
'file' => [ 'file' => [
'class' => 'common\components\activeRecordBehaviors\FileUploadBehavior', 'class' => 'common\components\activeRecordBehaviors\FileUploadBehavior',
'path' => '@frontend/web', 'path' => '@frontend/web',
...@@ -94,6 +101,7 @@ class Post extends \common\components\ActiveRecordModel ...@@ -94,6 +101,7 @@ class Post extends \common\components\ActiveRecordModel
'url' => 'Ссылка', 'url' => 'Ссылка',
'active' => 'Видимость', 'active' => 'Видимость',
'file' => 'Изображение', 'file' => 'Изображение',
'tags' => 'Теги',
'preview' => 'Изображение', 'preview' => 'Изображение',
'unlinkFile' => 'Удалить изображение', 'unlinkFile' => 'Удалить изображение',
'created_at' => 'Дата добавления', 'created_at' => 'Дата добавления',
...@@ -150,8 +158,16 @@ class Post extends \common\components\ActiveRecordModel ...@@ -150,8 +158,16 @@ class Post extends \common\components\ActiveRecordModel
/** /**
* @return \yii\db\ActiveQuery * @return \yii\db\ActiveQuery
*/ */
public function getTags() public function getPostTags()
{
return $this->hasMany(PostTag::className(), ['id' => 'tag_id'])->viaTable('posts_tags_assign', ['post_id' => 'id']);
}
/**
* @return \yii\db\ActiveQuery
*/
public function getPostTagAssigns()
{ {
return $this->hasMany(PostTags::className(), ['id' => 'tag_id'])->viaTable('posts_tags_assign', ['post_id' => 'id']); return $this->hasMany(PostTagAssign::className(), ['post_id' => 'id']);
} }
} }
...@@ -5,7 +5,7 @@ namespace common\modules\blog\models; ...@@ -5,7 +5,7 @@ namespace common\modules\blog\models;
use Yii; use Yii;
use common\modules\blog\models\Post; use common\modules\blog\models\Post;
use common\modules\blog\models\PostTags; use common\modules\blog\models\PostTag;
/** /**
* This is the model class for table "posts_tags_assign". * This is the model class for table "posts_tags_assign".
...@@ -44,7 +44,7 @@ class PostTagAssign extends \common\components\ActiveRecordModel ...@@ -44,7 +44,7 @@ class PostTagAssign extends \common\components\ActiveRecordModel
[['tag_id', 'post_id', 'created_at', 'updated_at'], 'integer'], [['tag_id', 'post_id', 'created_at', 'updated_at'], 'integer'],
[['tag_id', 'post_id'], 'unique', 'targetAttribute' => ['tag_id', 'post_id'], 'message' => 'The combination of Tag ID and Post ID has already been taken.'], [['tag_id', 'post_id'], 'unique', 'targetAttribute' => ['tag_id', 'post_id'], 'message' => 'The combination of Tag ID and Post ID has already been taken.'],
[['post_id'], 'exist', 'skipOnError' => true, 'targetClass' => Post::className(), 'targetAttribute' => ['post_id' => 'id']], [['post_id'], 'exist', 'skipOnError' => true, 'targetClass' => Post::className(), 'targetAttribute' => ['post_id' => 'id']],
[['tag_id'], 'exist', 'skipOnError' => true, 'targetClass' => PostTags::className(), 'targetAttribute' => ['tag_id' => 'id']], [['tag_id'], 'exist', 'skipOnError' => true, 'targetClass' => PostTag::className(), 'targetAttribute' => ['tag_id' => 'id']],
]; ];
} }
......
<?php <?php
use yii\helpers\Html; use yii\helpers\Html;
use yii\helpers\Url;
use yii\widgets\ActiveForm; use yii\widgets\ActiveForm;
use \xj\tagit\Tagit;
use common\modules\blog\models\Post; use common\modules\blog\models\Post;
use common\modules\content\widgets\MetaTagsWidget; use common\modules\content\widgets\MetaTagsWidget;
...@@ -39,14 +41,25 @@ use common\modules\content\widgets\MetaTagsWidget; ...@@ -39,14 +41,25 @@ use common\modules\content\widgets\MetaTagsWidget;
<?= $form->field($model, 'unlinkFile')->checkbox(); ?> <?= $form->field($model, 'unlinkFile')->checkbox(); ?>
<?= $form->field($model, 'tags')->widget(Tagit::className(), [
'clientOptions' => [
'tagSource' => Url::to(['autocomplete']),
'autocomplete' => [
'delay' => 500,
'minLength' => 1,
],
'triggerKeys' => ['enter', 'space', 'tab'],
]
]); ?>
<ul class="nav nav-pills"> <ul class="nav nav-pills">
<?php $c = 0; foreach ($model->langs as $i => $content) : $c++; ?> <?php $c = 0; foreach ($model->getLangsHelper() as $i => $content) : $c++; ?>
<li class="<?=($c==1?'active':'')?>"><a href="#lang-<?=$content->lang->url?>" data-toggle="tab"><?=$content->lang->name?></a></li> <li class="<?=($c==1?'active':'')?>"><a href="#lang-<?=$content->lang->url?>" data-toggle="tab"><?=$content->lang->name?></a></li>
<?php endforeach; ?> <?php endforeach; ?>
</ul> </ul>
<div class="tab-content"> <div class="tab-content">
<?php $c = 0; foreach ($model->langs as $content) : $c++; <?php $c = 0; foreach ($model->getLangsHelper() as $content) : $c++;
$lang_id = $content->lang->id; ?> $lang_id = $content->lang->id; ?>
<div class="tab-pane fade <?=($c==1?'active in':'')?>" id="lang-<?=$content->lang->url;?>"> <div class="tab-pane fade <?=($c==1?'active in':'')?>" id="lang-<?=$content->lang->url;?>">
...@@ -69,4 +82,4 @@ use common\modules\content\widgets\MetaTagsWidget; ...@@ -69,4 +82,4 @@ use common\modules\content\widgets\MetaTagsWidget;
<?php ActiveForm::end(); ?> <?php ActiveForm::end(); ?>
</div> </div>
\ No newline at end of file
...@@ -33,7 +33,7 @@ class PageController extends \common\components\BaseController ...@@ -33,7 +33,7 @@ class PageController extends \common\components\BaseController
$model = CoContent::findOne(['url' => $page]); $model = CoContent::findOne(['url' => $page]);
} }
$content = $model->lang->content; $content = $model->lang->getFinishedContent();
$this->meta_title = $model->metaTag->title . ' - ' . \Yii::$app->params['name']; $this->meta_title = $model->metaTag->title . ' - ' . \Yii::$app->params['name'];
$this->meta_description = $model->metaTag->description; $this->meta_description = $model->metaTag->description;
$this->meta_keywords = $model->metaTag->keywords; $this->meta_keywords = $model->metaTag->keywords;
......
...@@ -94,8 +94,8 @@ class CoBlocks extends \common\components\ActiveRecordModel ...@@ -94,8 +94,8 @@ class CoBlocks extends \common\components\ActiveRecordModel
return $model->lang->text; return $model->lang->text;
} }
public static function printStaticBlock($block, $addPath = false) public static function printStaticBlock($block, $params = [])
{ {
return Yii::$app->getView()->render( '@app/views/layouts/block/' . $block . '.php'); return Yii::$app->getView()->render( '@app/views/layouts/block/' . $block . '.php', $params);
} }
} }
...@@ -53,6 +53,7 @@ class CoContent extends \common\components\ActiveRecordModel ...@@ -53,6 +53,7 @@ class CoContent extends \common\components\ActiveRecordModel
return [ return [
'meta' => [ 'meta' => [
'class' => 'common\components\activeRecordBehaviors\MetaTagBehavior', 'class' => 'common\components\activeRecordBehaviors\MetaTagBehavior',
'actions' => ['create', 'update']
], ],
'langs' => [ 'langs' => [
'class' => 'common\modules\languages\components\LanguageHelperBehavior', 'class' => 'common\modules\languages\components\LanguageHelperBehavior',
......
...@@ -91,10 +91,18 @@ class CoContentLang extends \common\components\ActiveRecordModel ...@@ -91,10 +91,18 @@ class CoContentLang extends \common\components\ActiveRecordModel
return $this->hasOne(Languages::className(), ['id' => 'lang_id']); return $this->hasOne(Languages::className(), ['id' => 'lang_id']);
} }
/**
* @return \yii\db\ActiveQuery
*/
public function getContent()
{
return $this->hasOne(CoContent::className(), ['id' => 'content_id']);
}
/** /**
* @return html * @return html
*/ */
public function getContent() public function getFinishedContent()
{ {
$content = $this->text; $content = $this->text;
$content = \common\components\AppManager::prepareWidget($content); $content = \common\components\AppManager::prepareWidget($content);
...@@ -118,17 +126,19 @@ class CoContentLang extends \common\components\ActiveRecordModel ...@@ -118,17 +126,19 @@ class CoContentLang extends \common\components\ActiveRecordModel
} }
$arrWhatReplaceNext[] = '[about-reviews]'; $arrWhatReplaceNext[] = '[about-reviews]';
$arrReplaceNext[] = CoBlocks::printStaticBlock('about-reviews', true); $arrReplaceNext[] = CoBlocks::printStaticBlock('about-reviews');
$arrWhatReplaceNext[] = '[reviews]'; $arrWhatReplaceNext[] = '[reviews]';
$arrReplaceNext[] = CoBlocks::printStaticBlock('reviews', true); $arrReplaceNext[] = CoBlocks::printStaticBlock('reviews');
$arrWhatReplaceNext[] = '[content-phone]'; $arrWhatReplaceNext[] = '[content-phone]';
$arrReplaceNext[] = \common\models\Settings::getValue('content-phone'); $arrReplaceNext[] = \common\models\Settings::getValue('content-phone');
$arrWhatReplaceNext[] = '[cases]'; $arrWhatReplaceNext[] = '[cases]';
$arrReplaceNext[] = CoBlocks::printStaticBlock('cases', true); $arrReplaceNext[] = CoBlocks::printStaticBlock('cases');
$arrWhatReplaceNext[] = '[projects]'; $arrWhatReplaceNext[] = '[projects]';
$arrReplaceNext[] = CoBlocks::printStaticBlock('projects', true); $arrReplaceNext[] = CoBlocks::printStaticBlock('projects');
$arrWhatReplaceNext[] = '[case-subscribe]'; $arrWhatReplaceNext[] = '[case-subscribe]';
$arrReplaceNext[] = CoBlocks::printStaticBlock('case-subscribe', true); $arrReplaceNext[] = CoBlocks::printStaticBlock('case-subscribe');
$arrWhatReplaceNext[] = '[case-more]';
$arrReplaceNext[] = CoBlocks::printStaticBlock('case-more', ['model' => $this->content]);
$arrWhatReplaceNext[] = '[footer]'; $arrWhatReplaceNext[] = '[footer]';
$arrReplaceNext[] = \Yii::$app->getView()->render('@app/views/layouts/footer'); $arrReplaceNext[] = \Yii::$app->getView()->render('@app/views/layouts/footer');
$arrWhatReplaceNext[] = '[footer-index]'; $arrWhatReplaceNext[] = '[footer-index]';
......
...@@ -30,13 +30,13 @@ use common\modules\content\models\CoBlocks; ...@@ -30,13 +30,13 @@ use common\modules\content\models\CoBlocks;
<?= $form->field($model, 'title')->textInput(['maxlength' => 250])->hint('Заголовок страницы виден пользователю сайта и как правило оформляется в тег &lt;h1&gt;. Если дизайном страницы не предусмотрен вывод заголовка, то он не будет выводиться даже если был введен в данное поле.') ?> <?= $form->field($model, 'title')->textInput(['maxlength' => 250])->hint('Заголовок страницы виден пользователю сайта и как правило оформляется в тег &lt;h1&gt;. Если дизайном страницы не предусмотрен вывод заголовка, то он не будет выводиться даже если был введен в данное поле.') ?>
<ul class="nav nav-pills"> <ul class="nav nav-pills">
<?php $c = 0; foreach ($model->langs as $i => $block) : $c++; ?> <?php $c = 0; foreach ($model->getLangsHelper() as $i => $block) : $c++; ?>
<li class="<?=($c==1?'active':'')?>"><a href="#lang-<?=$block->lang->url?>" data-toggle="tab"><?=$block->lang->name?></a></li> <li class="<?=($c==1?'active':'')?>"><a href="#lang-<?=$block->lang->url?>" data-toggle="tab"><?=$block->lang->name?></a></li>
<?php endforeach; ?> <?php endforeach; ?>
</ul> </ul>
<div class="tab-content"> <div class="tab-content">
<?php $c = 0; foreach ($model->langs as $block) : $c++; <?php $c = 0; foreach ($model->getLangsHelper() as $block) : $c++;
$lang_id = $block->lang->id; ?> $lang_id = $block->lang->id; ?>
<div class="tab-pane fade <?=($c==1?'active in':'')?>" id="lang-<?=$block->lang->url;?>"> <div class="tab-pane fade <?=($c==1?'active in':'')?>" id="lang-<?=$block->lang->url;?>">
......
...@@ -53,7 +53,7 @@ $blocks = \common\modules\content\models\CoBlocks::find()->all(); ...@@ -53,7 +53,7 @@ $blocks = \common\modules\content\models\CoBlocks::find()->all();
<?= $form->field($model, 'file')->fileInput() ?> <?= $form->field($model, 'file')->fileInput() ?>
<ul class="nav nav-pills"> <ul class="nav nav-pills">
<?php $c = 0; foreach ($model->langs as $i => $content) : $c++; ?> <?php $c = 0; foreach ($model->getLangsHelper() as $i => $content) : $c++; ?>
<li class="<?=($c==1?'active':'')?>"><a href="#lang-<?=$content->lang->url?>" data-toggle="tab"><?=$content->lang->name?></a></li> <li class="<?=($c==1?'active':'')?>"><a href="#lang-<?=$content->lang->url?>" data-toggle="tab"><?=$content->lang->name?></a></li>
<?php endforeach; ?> <?php endforeach; ?>
</ul> </ul>
...@@ -72,7 +72,7 @@ $blocks = \common\modules\content\models\CoBlocks::find()->all(); ...@@ -72,7 +72,7 @@ $blocks = \common\modules\content\models\CoBlocks::find()->all();
?> ?>
<div class="tab-content"> <div class="tab-content">
<?php $c = 0; foreach ($model->langs as $content) : $c++; <?php $c = 0; foreach ($model->getLangsHelper() as $content) : $c++;
$lang_id = $content->lang->id; ?> $lang_id = $content->lang->id; ?>
<div class="tab-pane fade <?=($c==1?'active in':'')?>" id="lang-<?=$content->lang->url;?>"> <div class="tab-pane fade <?=($c==1?'active in':'')?>" id="lang-<?=$content->lang->url;?>">
......
...@@ -4,6 +4,6 @@ use \yii\helpers\Html; ...@@ -4,6 +4,6 @@ use \yii\helpers\Html;
?> ?>
<div class="col-sm-5 col-md-4"> <div class="col-sm-5 col-md-4">
<?php echo \common\modules\content\models\CoBlocks::printStaticBlock( 'faq-form', true);?> <?php echo \common\modules\content\models\CoBlocks::printStaticBlock( 'faq-form' );?>
</div><!-- /col-sm-5 col-md-4 --> </div><!-- /col-sm-5 col-md-4 -->
\ No newline at end of file
...@@ -9,13 +9,14 @@ use common\modules\languages\models\Languages; ...@@ -9,13 +9,14 @@ use common\modules\languages\models\Languages;
class LanguageHelperBehavior extends Behavior class LanguageHelperBehavior extends Behavior
{ {
public $langs; private $_langs;
public $langClass; public $langClass;
public $field; public $field;
public $langField = 'lang_id'; public $langField = 'lang_id';
public $actions; public $actions = [];
public function events() public function events()
{ {
...@@ -28,6 +29,11 @@ class LanguageHelperBehavior extends Behavior ...@@ -28,6 +29,11 @@ class LanguageHelperBehavior extends Behavior
]; ];
} }
public function getLangsHelper()
{
return $this->_langs;
}
private function getShotNameClass() private function getShotNameClass()
{ {
return (new \ReflectionClass($this->langClass))->getShortName(); return (new \ReflectionClass($this->langClass))->getShortName();
...@@ -39,16 +45,13 @@ class LanguageHelperBehavior extends Behavior ...@@ -39,16 +45,13 @@ class LanguageHelperBehavior extends Behavior
{ {
$langs = Languages::find()->all(); $langs = Languages::find()->all();
if($this->owner->isNewRecord) $field = $this->langField;
{
foreach ($langs as $lang)
{
$field = $this->langField;
$lng = new $this->langClass; foreach ($langs as $lang)
$lng->$field = $lang->id; {
$this->langs[$lang->id] = $lng; $lng = new $this->langClass;
} $lng->$field = $lang->id;
$this->_langs[$lang->id] = $lng;
} }
} }
} }
...@@ -59,22 +62,19 @@ class LanguageHelperBehavior extends Behavior ...@@ -59,22 +62,19 @@ class LanguageHelperBehavior extends Behavior
{ {
$langs = Languages::find()->all(); $langs = Languages::find()->all();
if(!$this->owner->isNewRecord) $field = $this->langField;
{
foreach ($langs as $lang)
{
$lng = $this->owner->getLang($lang->id)->one();
if(!$lng) foreach ($langs as $lang)
{ {
$field = $this->langField; $lng = $this->owner->getLang($lang->id)->one();
$lng = new $this->langClass; if(!$lng)
$lng->$field = $lang->id; {
} $lng = new $this->langClass;
$lng->$field = $lang->id;
}
$this->langs[$lang->id] = $lng; $this->_langs[$lang->id] = $lng;
}
} }
} }
} }
......
...@@ -34,7 +34,8 @@ ...@@ -34,7 +34,8 @@
"himiklab/yii2-sitemap-module" : "*", "himiklab/yii2-sitemap-module" : "*",
"mirocow/yii2-minify-view" : "*", "mirocow/yii2-minify-view" : "*",
"kartik-v/yii2-widget-fileinput": "@dev", "kartik-v/yii2-widget-fileinput": "@dev",
"nodge/yii2-eauth": "~2.0" "nodge/yii2-eauth": "~2.0",
"xj/yii2-tagit-widget": "*"
}, },
"require-dev": { "require-dev": {
"yiisoft/yii2-codeception": "*", "yiisoft/yii2-codeception": "*",
......
<?php
use yii\db\Schema;
use yii\db\Migration;
class m160209_233922_create_table_courses_lang extends Migration
{
public function safeUp()
{
$tableOptions = null;
if ($this->db->driverName === 'mysql')
{
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB';
}
// Структура таблицы `courses_lang`
$this->createTable('courses_lang', [
'id' => Schema::TYPE_PK,
'lang_id' => Schema::TYPE_INTEGER . '(11) NOT NULL',
'course_id' => Schema::TYPE_INTEGER . '(11) NOT NULL',
'title' => Schema::TYPE_STRING . '(150) NOT NULL',
'description' => Schema::TYPE_TEXT . ' NOT NULL',
'description_for_course' => Schema::TYPE_TEXT . ' NOT NULL',
], $tableOptions);
$this->createIndex('FK_courses_lang_languages', 'courses_lang', 'lang_id');
$this->createIndex('FK_courses_lang_courses', 'courses_lang', 'course_id');
}
public function safeDown()
{
$this->dropTable('courses_lang');
}
}
<?php
use yii\db\Schema;
use yii\db\Migration;
class m160210_004018_create_table_lessons_lang extends Migration
{
public function safeUp()
{
$tableOptions = null;
if ($this->db->driverName === 'mysql')
{
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB';
}
// Структура таблицы `courses_lang`
$this->createTable('lessons_lang', [
'id' => Schema::TYPE_PK,
'lang_id' => Schema::TYPE_INTEGER . '(11) NOT NULL',
'lesson_id' => Schema::TYPE_INTEGER . '(11) NOT NULL',
'title' => Schema::TYPE_STRING . '(150) NOT NULL',
'text' => Schema::TYPE_TEXT . ' NOT NULL',
], $tableOptions);
$this->createIndex('FK_lessons_lang_languages', 'lessons_lang', 'lang_id');
$this->createIndex('FK_lessons_lang_lessons', 'lessons_lang', 'lesson_id');
}
public function safeDown()
{
$this->dropTable('lessons_lang');
}
}
...@@ -107,7 +107,7 @@ class SiteController extends BaseController ...@@ -107,7 +107,7 @@ class SiteController extends BaseController
{ {
$model = \common\modules\content\models\CoContent::findOne(['url' => 'site/error']); $model = \common\modules\content\models\CoContent::findOne(['url' => 'site/error']);
$content = $model->lang->content; $content = $model->lang->getFinishedContent();
$this->meta_title = $model->metaTag->title . ' - ' . \Yii::$app->params['name']; $this->meta_title = $model->metaTag->title . ' - ' . \Yii::$app->params['name'];
$this->meta_description = $model->metaTag->description; $this->meta_description = $model->metaTag->description;
$this->meta_keywords = $model->metaTag->keywords; $this->meta_keywords = $model->metaTag->keywords;
......
<?php <?php
return [ return [
'Update' => 'Редактировать', 'Request a call' => 'Заказать звонок',
'Delete' => 'Удалить',
]; ];
\ No newline at end of file
<?php
return [
'Update' => 'Редактировать',
'Delete' => '.удалить',
];
\ No newline at end of file
<?php <?php
return [ return [
'Create Category' => 'Создать категорию', 'References about us' => 'Отзывы о нас',
'Create Content' => 'Добавить контент', 'Look all reviews' => 'Смотреть все отзывы',
'Delete' => 'Удалить',
'Update' => 'Редактировать',
'Title' => 'Заголовок',
'Name' => 'Название',
'Url' => 'Ссылка',
'Category ID' => 'Категория',
'Active' => 'Активность',
]; ];
\ No newline at end of file
<?php
return [
'Surname' => 'Фамилия',
'Name' => 'Имя',
'Patronymic' => 'Отчество',
'Name Add' => 'Фамилия, имя, отчество родственника',
'Status Add' => 'Степень родства',
'Status Fail' => 'Отклонена',
'Gender' => 'Ваш пол',
'Day' => 'День',
'Month' => 'Месяц',
'Year' => 'Год',
'Ser_doc' => 'Серия паспорта',
'Nom_doc' => 'Номер паспорта',
'Vyd_doc' => 'Кем выдан паспорт',
'Request Sum' => 'Сумма',
'Request Day' => 'Кол-во дней',
'Status' => 'Статус',
'Created At' => 'Создана',
];
\ No newline at end of file
...@@ -13,7 +13,7 @@ $reviews = Reviews::find() ...@@ -13,7 +13,7 @@ $reviews = Reviews::find()
<div class="container"> <div class="container">
<div class="row"> <div class="row">
<div class="col-md-12 col-xs-12 col-sm-12"> <div class="col-md-12 col-xs-12 col-sm-12">
<span class="rev_title">Отзывы о нас</span> <span class="rev_title"><?=Yii::t('reviews', 'References about us')?></span>
</div> </div>
</div> </div>
<?php foreach ($reviews as $review) : ?> <?php foreach ($reviews as $review) : ?>
...@@ -55,7 +55,7 @@ $reviews = Reviews::find() ...@@ -55,7 +55,7 @@ $reviews = Reviews::find()
<?php endif; ?> <?php endif; ?>
<?php endforeach; ?> <?php endforeach; ?>
<a href="/otzyvy-art-proekt" class="all_rev__btn">Смотреть все отзывы</a> <a href="/otzyvy-art-proekt" class="all_rev__btn"><?=Yii::t('reviews', 'Look all reviews')?></a>
</div> </div>
</section> </section>
<?php endif; ?> <?php endif; ?>
\ No newline at end of file
<?php
use yii\widgets\ActiveForm;
use yii\helpers\Html;
use yii\helpers\Url;
use common\modules\content\models\CoContent;
use common\modules\bids\models\Bid;
$more = CoContent::find()
->where([
'category_id' => 4,
'active' => true
])
->andWhere(['!=', 'id', $model->id])
->orderBy('RAND()')
->one();
?>
<section class="short_keys_sect">
<div class="container">
<div class="row">
<div class="col-md-12 col-xs-12 col-sm-12">
<h2 class="short_keys_title">Посмотрите еще один<br/> короткий кейс</h2>
</div>
</div>
<div class="row">
<?php if($more) : ?>
<div class="col-md-6 col-xs-6 col-sm-12">
<div class="short_keys_block">
<img src="<?=$more->preview?>" height="338" width="455">
<a href="<?=Url::to(['/'.$more->url]);?>" style="color:<?if($more->custom==CoContent::CUSTOM_WHITE){?>#fff<?}else{?>#2d3642<?}?>;" class="short_keys_title_link"><?=$more->lang->title?></a>
<div class="short_keys_foot">
<a href="<?=Url::to(['/'.$more->url]);?>" class="short_keys_btn_more"><span>Подробнее</span></a>
<!-- <a href="#" class="short_keys_tags"># Big data</a> -->
</div>
</div>
</div>
<?php endif; ?>
<div class="col-md-6 col-xs-6 col-sm-12">
<div class="subsc_block">
<h2 class="subsc_block_title">Подписаться на обновление</h2>
<div class="subsc_block_txt">Нам будет приятно, если вы захотите подписаться на обновление наших проектов</div>
<?php
$model = new Bid;
$model->scenario = Bid::SCENARIO_SUBSCRIBE;
$form = ActiveForm::begin([
'action' => '/',
'options' => [
'class' => 'subsc_form bids-form',
],
]); ?>
<?php echo Html::hiddenInput('scenario', $model->scenario, ['class' => 'not_clear']); ?>
<?php echo Html::hiddenInput('Bid[form]', Bid::FORM_SUBSCRIBE, ['class' => 'not_clear']); ?>
<?php echo $form->field($model, 'email', [
'template' => '<div class="row"><div class="col-sm-4">{input}</div></div>',
'errorOptions' => []
])->textInput([
'placeholder' => 'E-mail*'
]); ?>
<?php echo Html::submitButton('Подписаться', ['class' => 'save-button']); ?>
<?php ActiveForm::end(); ?>
</div>
</div>
</div>
</div>
</section>
\ No newline at end of file
...@@ -12,7 +12,7 @@ $reviews = Reviews::find() ...@@ -12,7 +12,7 @@ $reviews = Reviews::find()
<div class="container"> <div class="container">
<div class="row" style="margin:50px -15px 0;"> <div class="row" style="margin:50px -15px 0;">
<div class="col-md-12 col-xs-12 col-sm-12"> <div class="col-md-12 col-xs-12 col-sm-12">
<span class="rev_title">Отзывы о нас</span> <span class="rev_title"><?=Yii::t('reviews', 'References about us')?></span>
</div> </div>
</div> </div>
<?php foreach ($reviews as $review) : ?> <?php foreach ($reviews as $review) : ?>
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<div class="col-md-4 col-xs-4 col-sm-12"> <div class="col-md-4 col-xs-4 col-sm-12">
<a href="mailto:info@task-on.com" class="foot_mail">info@task-on.com</a> <a href="mailto:info@task-on.com" class="foot_mail">info@task-on.com</a>
</div> </div>
<div class="col-md-4 col-xs-4 col-sm-12"><a href="#zvonok_form" class="zvonok_bt popup-form"><span>Заказать звонок</span></a></div> <div class="col-md-4 col-xs-4 col-sm-12"><a href="#zvonok_form" class="zvonok_bt popup-form"><span><?=Yii::t('app', 'Request a call');?></span></a></div>
<div class="col-md-4 col-xs-4 col-sm-12"> <div class="col-md-4 col-xs-4 col-sm-12">
<!-- <div class="phone_hover_foot">Стоимость звонка 0 руб,<br/> в том числе с мобильного</div> --> <!-- <div class="phone_hover_foot">Стоимость звонка 0 руб,<br/> в том числе с мобильного</div> -->
<span class="foot_phone"><?=\common\models\Settings::getValue('content-phone');?></span> <span class="foot_phone"><?=\common\models\Settings::getValue('content-phone');?></span>
......
...@@ -6,8 +6,8 @@ ...@@ -6,8 +6,8 @@
margin: 0; margin: 0;
} }
.has-error input { .has-error input {
background: #fff url(../images/icon-fail.png) no-repeat 96% center; background: #fff url(../images/icon-fail.png) no-repeat 96% center !important;
border: 1px solid #E9A2A2; border: 1px solid #E9A2A2 !important;
} }
/* EAuth widget */ /* EAuth widget */
.eauth-list .eauth-service-id-vk .eauth-service-link:before { .eauth-list .eauth-service-id-vk .eauth-service-link:before {
...@@ -56,4 +56,22 @@ a.login_form_link, a.login_form_popup_link, a.reg_popup_link, a.reg_form_link{ ...@@ -56,4 +56,22 @@ a.login_form_link, a.login_form_popup_link, a.reg_popup_link, a.reg_form_link{
} }
.sh_ft .popup_text, .reg_form .popup_text{ .sh_ft .popup_text, .reg_form .popup_text{
margin-top: 10px; margin-top: 10px;
}
.subsc_form input {
display: block;
width: 273px;
height: 49px;
background: #FDFDFD;
border: 1px solid #E9E9E9;
padding: 0 10px;
border-radius: 10px;
-moz-border-radius: 10px;
-webkit-border-radius: 10px;
-o-border-radius: 10px;
-ms-border-radius: 10px;
font-size: 16px;
color: #83999e;
}
.txt_server:before {
position: absolute;
} }
\ No newline at end of file
This diff is collapsed.
...@@ -37,27 +37,26 @@ $(document).ready(function() { ...@@ -37,27 +37,26 @@ $(document).ready(function() {
}); });
$('.about_hide_block').hide(); $('.about_hide_block').hide();
$('.about_hide_btn').click(function(){ $('.about_hide_btn').click(function(){
if ($('.about_hide_btn').text() == 'Подробнее'){ if ($('.about_hide_btn').text() == $(this).data('show')){
$('.about_hide_block').slideDown(1000); $('.about_hide_block').slideDown(1000);
$(this).text('Скрыть') $(this).text($(this).data('hide'));
} }
else { else {
$('.about_hide_block').slideUp(1000); $('.about_hide_block').slideUp(1000);
$(this).text('Подробнее'); $(this).text($(this).data('show'));
} }
}); });
$('.dep_block__hide').hide(); $('.dep_block__hide').hide();
$('.dep_block_hide__btn').click(function(){ $('.dep_block_hide__btn').click(function(){
if ($('.dep_block_hide__btn').text() == 'Смотреть полную схему'){ if ($('.dep_block_hide__btn').text() == $(this).data('show')){
$('.line_hide').fadeTo( "slow" , 0);
$('.dep_block__hide').slideDown(1000); $('.dep_block__hide').slideDown(1000);
$(this).text('Скрыть полную схему') $(this).text($(this).data('hide'));
} }
else { else {
$('.line_hide').fadeTo( "slow" , 1);
$('.dep_block__hide').slideUp(1000); $('.dep_block__hide').slideUp(1000);
$(this).text('Смотреть полную схему'); $(this).text($(this).data('show'));
} }
}); });
...@@ -594,7 +593,6 @@ $(function() { ...@@ -594,7 +593,6 @@ $(function() {
} }
}); });
}); });
jQuery(document).ready(function(){ jQuery(document).ready(function(){
$(".box_off").on('click', function () { $(".box_off").on('click', function () {
......
...@@ -51,12 +51,20 @@ body ...@@ -51,12 +51,20 @@ body
font-family: "RobotoRegular" font-family: "RobotoRegular"
position: relative position: relative
overflow-x: hidden overflow-x: hidden
min-width: 320px
.hidden .hidden
display: none display: none
strong strong
font-family: "RobotoBold" font-family: "RobotoBold"
color: #494949 color: #494949
line-height: 22px line-height: 22px
i
font-style: italic
color: #494949
line-height: 22px
u
color: #494949
line-height: 22px
.container .container
+r(768,970) +r(768,970)
width: 750px width: 750px
...@@ -8658,4 +8666,402 @@ a.appl_btn ...@@ -8658,4 +8666,402 @@ a.appl_btn
font-size: 17px font-size: 17px
line-height: 26px line-height: 26px
+r(320,479) +r(320,479)
font-size: 14px font-size: 14px
\ No newline at end of file .blog_container
background: #fff
width: 100%
padding-top: 46px
.blog
padding-bottom: 30px
h1
font-size: 29px
font-family: "RobotoBold"
color: #2d3642
margin-bottom: 16px
.subsc_blog
background: #F1F1F1
padding: 20px
&_title
color: #2d323a
font-size: 25px
font-family: "RobotoBold"
+r(320,479)
font-size: 17px
&_txt
font-size: 17px
color: #2d323a
line-height: 26px
margin: 15px 0px
+r(768,970)
margin: 10px 0 15px
+r(320,479)
font-size: 14px
.subsc_blog_form
input[type="email"]
display: block
width: 273px
height: 49px
background: #FDFDFD
border: 1px solid #E9E9E9
padding: 0 10px
+br(10px)
font-size: 16px
color: #83999e
+r(320,479)
width: 100%
&::-webkit-input-placeholder
color: #83999e
font-size: 16px
opacity: 1
&:-moz-placeholder
color: #83999e
font-size: 16px
opacity: 1
&::-moz-placeholder
color: #83999e
font-size: 16px
opacity: 1
&:-ms-input-placeholder
color: #83999e
font-size: 16px
opacity: 1
.field-input.input-error
background: #fff url(../images/icon-fail.png) no-repeat 96% center
border: 1px solid #E9A2A2
button
width: 178px
height: 50px
+br(50px)
text-align: center
color: #655d04
font-family: "RobotoBold"
font-size: 20px
background-image: linear-gradient(to top, #fdd000 0%, #fff04e 100%)
box-shadow: 2px 3.5px 5px rgba(0, 0, 0, 0.12)
color: #908505
border: none
border-bottom: 4px solid #D2BF00
line-height: 43px
display: inline-block
margin: 20px 0px 0px
&:hover, &:focus
background-image: linear-gradient(to top, #fde654 0%, #fef77d 100%)
box-shadow: 2px 3.5px 5px rgba(0, 0, 0, 0.12)
color: #908505
border-bottom: 4px solid #D2BF00
text-decoration: none
&:active
background-image: linear-gradient(to top, #f4db15 0%, #fbd20d 100%)
box-shadow: 2px 3.5px 5px rgba(0, 0, 0, 0.12)
color: #908505
border: none
border-top: 4px solid #D2BF00
text-decoration: none
.article_short
margin-bottom: 57px
&:last-child
margin-bottom: 0
&_title
font-size: 25px
line-height: 35px
color: #3d3d3d
font-family: "RobotoBold"
+r(768,970)
font-size: 20px
line-height: 27px
+r(320,479)
font-size: 20px
line-height: 27px
&:hover, &:focus, &:active
color: #49acc5
text-decoration: none
&_head
height: 30px
width: 100%
line-height: 30px
font-size: 13px
color: #949494
margin-top: 5px
+r(320,479)
height: auto
&_date
margin-right: 19px
&_view
position: relative
&:hover
.blog_toltip_left
display: block
&:before
content: ''
background: url(../images/icon/article_view.png) no-repeat
width: 21px
height: 14px
display: inline-block
vertical-align: middle
margin-right: 6px
margin-top: -3px
.blog_toltip_left
display: none
width: 209px
height: 66px
line-height: 65px
padding-left: 5px
background: url(../images/blog_toltip_left.png) no-repeat center center
text-align: center
font-size: 14px
font-family: "RobotoLight"
position: absolute
right: -214px
top: -23px
&_tags
margin-top: 11px
a
font-size: 14px
color: #49acc5
margin-right: 10px
&:hover, &:focus, &:active
text-decoration: underline
&_txt
overflow-x: auto
img
margin: 14px 0 11px
width: 100%
height: auto
p
font-size: 16px
line-height: 25px
color: #525252
+r(320,479)
font-size: 14px
line-height: 22px
a
color: #49acc5
&:hover, &:focus, &:active
text-decoration: underline
ol
margin-top: 25px
li
color: #3c4755
font-size: 16px
+r(320,479)
font-size: 14px
&:before
counter-increment: myCounter
content: counter(myCounter)
color: #fff
font-size: 15px
font-family: "RobotoBold"
background: #00AEC7
display: inline-block
text-align: center
margin: 4px 12px 4px 4px
line-height: 23px
width: 23px
height: 23px
+br(50px)
ul
margin-top: 32px
li
background: url(../images/icon/ul_list_blue.png) no-repeat left center
height: 30px
line-height: 30px
padding-left: 34px
font-size: 16px
color: #3c4755
+r(320,479)
font-size: 14px
line-height: 17px
margin-bottom: 10px
.tb_blog
margin-top: 23px
overflow-x: auto
tr
th
padding: 15px 20px
border: 1px solid #C7C7C7
vertical-align: top
color: #2d323a
font-size: 16px
line-height: 20px
thead
tr
th
background: #00AEC7
font-family: "RobotoBold"
color: #fff
font-size: 16px
line-height: 21px
padding: 0px 0px 0px 20px
border: 1px solid #C7C7C7
vertical-align: middle
&_social
float: right
+r(320,479)
float: none
.sidebar
margin-top: 5px
&_module
h2
font-size: 18px
line-height: 20px
color: #3d3d3d
font-family: "RobotoBold"
margin-bottom: 25px
&_body
a.cat_link_mod
display: inline-block
font-size: 14px
color: #fff
background: #00AEC7
padding: 14px 20px
+br(5px)
margin-right: 10px
font-family: "RobotoBold"
margin-bottom: 21px
+r(768,970)
margin-right: 0px
margin-bottom: 4px
&:hover, &:focus, &:active
text-decoration: none
background: #FFDF00
color: #2d3642
.article_itm
margin-bottom: 30px
img
max-width: 100%
height: auto
display: block
a.article_itm_link
font-size: 16px
color: #2d3642
line-height: 25px
+r(768,970)
line-height: 20px
&:hover, &:focus, &:active
color: #49acc5
text-decoration: none
&_social
li
display: inline-block
margin-right: 26px
margin-bottom: 26px
+r(768,970)
margin-right: 20px
margin-bottom: 20px
+r(480,767)
margin-right: 20px
margin-bottom: 20px
+r(320,479)
margin-right: 20px
margin-bottom: 20px
&:nth-child(4)
margin-right: 0
+r(768,970)
margin-right: 20px
+r(480,767)
margin-right: 20px
+r(320,479)
margin-right: 20px
&_fb
background: #324C84 url(../images/icon/sidebar_social_fb.png) no-repeat center center
width: 48px
height: 48px
display: inline-block
+br(50%)
&:hover, &:focus, &:active
background: #0093A9 url(../images/icon/sidebar_social_fb.png) no-repeat center center
&_ok
background: #daaa03 url(../images/icon/sidebar_social_ok.png) no-repeat center center
width: 48px
height: 48px
display: inline-block
+br(50%)
&:hover, &:focus, &:active
background: #0093A9 url(../images/icon/sidebar_social_ok.png) no-repeat center center
&_tw
background: #69baf3 url(../images/icon/sidebar_social_tw.png) no-repeat center center
width: 48px
height: 48px
display: inline-block
+br(50%)
&:hover, &:focus, &:active
background: #0093A9 url(../images/icon/sidebar_social_tw.png) no-repeat center center
&_gp
background: #ff5400 url(../images/icon/sidebar_social_gp.png) no-repeat center center
width: 48px
height: 48px
display: inline-block
+br(50%)
&:hover, &:focus, &:active
background: #0093A9 url(../images/icon/sidebar_social_gp.png) no-repeat center center
&_yt
background: #e73500 url(../images/icon/sidebar_social_yt.png) no-repeat center center
width: 48px
height: 48px
display: inline-block
+br(50%)
&:hover, &:focus, &:active
background: #0093A9 url(../images/icon/sidebar_social_yt.png) no-repeat center center
&_vk
background: #5872c4 url(../images/icon/sidebar_social_vk.png) no-repeat center center
width: 48px
height: 48px
display: inline-block
+br(50%)
&:hover, &:focus, &:active
background: #0093A9 url(../images/icon/sidebar_social_vk.png) no-repeat center center
&_inst
background: #745e51 url(../images/icon/sidebar_social_inst.png) no-repeat center center
width: 48px
height: 48px
display: inline-block
+br(50%)
&:hover, &:focus, &:active
background: #0093A9 url(../images/icon/sidebar_social_inst.png) no-repeat center center
&_btn
width: 190px
height: 35px
+br(50px)
text-align: center
color: #655d04
font-size: 15px
background-image: linear-gradient(to top, #fdd000 0%, #fff04e 100%)
box-shadow: 2px 3.5px 5px rgba(0, 0, 0, 0.12)
color: #908505
border: none
border-bottom: 4px solid #D2BF00
line-height: 30px
display: inline-block
margin: 15px 0px 15px
position: relative
&:hover, &:focus
background-image: linear-gradient(to top, #fde654 0%, #fef77d 100%)
box-shadow: 2px 3.5px 5px rgba(0, 0, 0, 0.12)
color: #908505
border-bottom: 4px solid #D2BF00
text-decoration: none
.blog_toltip_right
display: block
&:active
background-image: linear-gradient(to top, #f4db15 0%, #fbd20d 100%)
box-shadow: 2px 3.5px 5px rgba(0, 0, 0, 0.12)
color: #908505
border: none
border-top: 4px solid #D2BF00
text-decoration: none
&:last-child
margin-bottom: 40px
.blog_toltip_right
display: none
width: 209px
height: 66px
line-height: 17px
color: #3c4755
background: url(../images/blog_toltip_right.png) no-repeat center center
text-align: left
font-size: 14px
font-family: "RobotoLight"
position: absolute
padding: 14px 30px 14px 20px
left: -215px
top: -16px
\ 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