From 6f56a9e9fea3324ae7396113b60eb95fb766592c Mon Sep 17 00:00:00 2001 From: Andrey Klochok Date: Tue, 5 Jan 2016 19:46:38 +0200 Subject: [PATCH] Add designe for categories to domain check --- src/models/Domain.php | 26 ++++ src/views/domain/_checkDomainLine.php | 3 +- src/views/domain/checkDomain.php | 209 ++++++++++++++++++-------- 3 files changed, 178 insertions(+), 60 deletions(-) diff --git a/src/models/Domain.php b/src/models/Domain.php index c9438680..8452b8f0 100644 --- a/src/models/Domain.php +++ b/src/models/Domain.php @@ -294,4 +294,30 @@ public function getTransferDataProviderOptions() return $result; } + + public static function setIsotopeFilterValue($zone) + { + $getClass = function (array $arr) use ($zone) { + $result = ''; + foreach ($arr as $cssClass => $items) { + if (in_array($zone, $items)) { + $result = '.' . $cssClass; + break; + } + } + return $result; + }; + $categories = [ + 'adult' => ['sex', 'porn', 'xxx', 'adult'], + 'generic' => ['com', 'net', 'org', 'biz', 'co', 'name'], + 'european' => ['su', 'ru'], + ]; + $special = [ + 'popular' => ['info', 'com', 'net', 'org', 'biz', 'co', 'name'], + 'promotion' => ['su', 'ru'], + ]; + $result = sprintf('%s %s', $getClass($categories), $getClass($special)); + + return $result; + } } diff --git a/src/views/domain/_checkDomainLine.php b/src/views/domain/_checkDomainLine.php index 733a763b..2bf4b089 100644 --- a/src/views/domain/_checkDomainLine.php +++ b/src/views/domain/_checkDomainLine.php @@ -4,10 +4,11 @@ * @var $state */ use yii\helpers\Html; +use hipanel\modules\domain\models\Domain; ?> -
+
diff --git a/src/views/domain/checkDomain.php b/src/views/domain/checkDomain.php index f85a03c3..c823eed3 100644 --- a/src/views/domain/checkDomain.php +++ b/src/views/domain/checkDomain.php @@ -4,8 +4,50 @@ use yii\helpers\Html; use hipanel\modules\domain\assets\DomainCheckPluginAsset; -Yii::$app->assetManager->forceCopy = true; // todo: remove this string DomainCheckPluginAsset::register($this); +hipanel\frontend\assets\IsotopeAsset::register($this); +Yii::$app->assetManager->forceCopy = true; // todo: remove this string +// +//$this->registerJs(<<title = Yii::t('app', 'Domain check'); $this->breadcrumbs->setItems([ @@ -13,7 +55,7 @@ ]); $model->domain = empty($model->domain) ? Yii::$app->request->get('domain-check') : $model->domain; if (!empty($results)) { -$this->registerJs(<<<'JS' + $this->registerJs(<<<'JS' $('.domain-list').domainsCheck({ domainRowClass: '.domain-line', success: function(data, domain, element) { @@ -26,76 +68,124 @@ } }); JS -); + ); } ?> -
-
- -