Skip to content

Commit

Permalink
Add message folder, add local states for domains
Browse files Browse the repository at this point in the history
  • Loading branch information
tafid committed Dec 23, 2015
1 parent 6101948 commit acdc017
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 12 deletions.
13 changes: 13 additions & 0 deletions src/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,18 @@ class Plugin extends \hiqdev\pluginmanager\Plugin
'class' => 'hipanel\modules\domain\Module',
],
],
'components' => [
'i18n' => [
'translations' => [
'hipanel/domain' => [
'class' => 'yii\i18n\PhpMessageSource',
'basePath' => '@hipanel/modules/domain/messages',
'fileMap' => [
'hipanel/domain' => 'domain.php',
],
],
],
],
],
];
}
7 changes: 5 additions & 2 deletions src/grid/DomainGridView.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,12 @@ public static function defaultColumns()
'filterAttribute' => 'domain_like',
],
'state' => [
'class' => RefColumn::className(),
// 'class' => RefColumn::className(),
// 'gtype' => 'state,domain',
'format' => 'raw',
'gtype' => 'state,domain',
'filter' => function ($grid, $model, $attribute) {
return Html::activeDropDownList($model, $attribute, Domain::stateOptions(), ['prompt' => '--', 'class' => 'form-control']);
},
'filterInputOptions' => ['style' => 'width:120px'],
'value' => function ($model) {
return State::widget(compact('model'));
Expand Down
5 changes: 5 additions & 0 deletions src/messages/ru/domain.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?php

return [
'Domains in «ok» state' => 'В состоянии «ОК»',
];
16 changes: 15 additions & 1 deletion src/models/Domain.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,14 @@
use hipanel\validators\DomainValidator;
use Yii;
use yii\helpers\Html;
use yii\validators\IpValidator;

class Domain extends \hipanel\base\Model
{
const STATE_OK = 'ok';
const STATE_INCOMING = 'incoming';
const STATE_OUTGOING = 'outgoing';
const STATE_EXPIRED = 'expired';

public $authCode;

public static $contactOptions = [
Expand All @@ -40,6 +44,16 @@ class Domain extends \hipanel\base\Model
'billing',
];

public static function stateOptions()
{
return [
self::STATE_OK => Yii::t('hipanel/domain', 'Domains in «ok» state'),
self::STATE_INCOMING => Yii::t('hipanel/domain', 'Incoming transfer domains'),
self::STATE_OUTGOING => Yii::t('hipanel/domain', 'Outgoing transfer domains'),
self::STATE_EXPIRED => Yii::t('hipanel/domain', 'Expired domains'),
];
}

use \hipanel\base\ModelTrait;

/** {@inheritdoc} */
Expand Down
11 changes: 2 additions & 9 deletions src/views/domain/_search.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php

use hipanel\modules\client\widgets\combo\ClientCombo;
use hipanel\modules\domain\models\Domain;
use hiqdev\combo\StaticCombo;
use kartik\widgets\DatePicker;
use yii\helpers\Html;
Expand All @@ -18,15 +19,7 @@
</div>

<div class="col-md-4">
<?= $search->field('state')->widget(StaticCombo::classname(), [
'data' => $stateData,
'hasId' => true,
'pluginOptions' => [
'select2Options' => [
'multiple' => false,
],
],
]) ?>
<?= $search->field('state')->dropDownList(Domain::stateOptions(), ['prompt' => '--']) ?>
<div class="form-group">
<?= Html::tag('label', 'Registered range', ['class' => 'control-label']); ?>
<?= DatePicker::widget([
Expand Down

0 comments on commit acdc017

Please sign in to comment.