Skip to content

Commit

Permalink
Minor
Browse files Browse the repository at this point in the history
  • Loading branch information
SilverFire committed Jul 31, 2015
1 parent cf36043 commit 7c3b40d
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 59 deletions.
97 changes: 42 additions & 55 deletions grid/DomainGridView.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,110 +8,97 @@
namespace hipanel\modules\domain\grid;

use hipanel\grid\ActionColumn;
use hipanel\grid\MainColumn;
use hipanel\modules\domain\widgets\State;
use hipanel\modules\domain\widgets\Expires;
use hipanel\grid\BoxedGridView;
use hipanel\grid\RefColumn;
use hipanel\widgets\ArraySpoiler;
use hiqdev\bootstrap_switch\BootstrapSwitchColumn;
use hiqdev\xeditable\widgets\XEditable;
use Yii;
use yii\helpers\Html;
use yii\helpers\Url;
//use hipanel\grid\SwitchColumn;

class DomainGridView extends BoxedGridView
{
static public function defaultColumns()
{
return [
'domain' => [
'domain' => [
'class' => MainColumn::className(),
'attribute' => 'domain',
'format' => 'raw',
'value' => function ($model, $key, $index) {
$domainLink = Html::tag('b', Html::a($model->domain, ['view', 'id' => $key]));
$note = '<br>' . Html::tag('span', Yii::t('app', 'Note') . ': ', ['class' => 'bold']) . XEditable::widget([
'model' => $model,
'attribute' => 'note',
'pluginOptions' => [
'emptytext' => Yii::t('app', 'set note'),
'url' => Url::to('set-note')
]
]);
return $domainLink . $note;
}
// 'class' => MainColumn::className(),
'note' => true
],
'state' => [
'class' => RefColumn::className(),
'format' => 'raw',
'gtype' => 'state,domain',
'value' => function ($model) {
'state' => [
'class' => RefColumn::className(),
'format' => 'raw',
'gtype' => 'state,domain',
'headerOptions' => ['style' => 'width: 1em'],
'value' => function ($model) {
return State::widget(compact('model'));
}
],
'whois_protected' => [
'class' => BootstrapSwitchColumn::className(),
'filter' => false,
'url' => Url::toRoute('set-whois-protect'),
'popover' => 'WHOIS protection',
'class' => BootstrapSwitchColumn::className(),
'filter' => false,
'url' => Url::toRoute('set-whois-protect'),
'popover' => 'WHOIS protection',
'pluginOptions' => [
'onColor' => 'success',
'onColor' => 'success',
'offColor' => 'warning',
],
],
'is_secured' => [
// 'class' => SwitchColumn::className(),
'class' => BootstrapSwitchColumn::className(),
'filter' => false,
'url' => Url::toRoute('set-lock'),
'is_secured' => [
'class' => BootstrapSwitchColumn::className(),
'filter' => false,
'url' => Url::toRoute('set-lock'),
'attribute' => 'is_secured',
'popover' => Yii::t('app', 'Protection from transfer'),
'popover' => Yii::t('app', 'Protection from transfer'),
],
'note' => [
'note' => [
'class' => 'hiqdev\xeditable\grid\XEditableColumn',
'attribute' => 'note',
'filter' => true,
'popover' => Yii::t('app','Make any notes for your convenience'),
'popover' => Yii::t('app', 'Make any notes for your convenience'),
'pluginOptions' => [
'url' => 'set-note',
],
],
'created_date' => [
'attribute' => 'created_date',
'format' => 'date',
'filter' => false,
'created_date' => [
'attribute' => 'created_date',
'format' => 'date',
'filter' => false,
'contentOptions' => ['class' => 'text-nowrap'],
],
'expires' => [
'format' => 'raw',
'filter' => false,
'expires' => [
'format' => 'raw',
'filter' => false,
'headerOptions' => ['style' => 'width:1em'],
'value' => function ($model) {
'value' => function ($model) {
return Expires::widget(compact('model'));
},
],
'autorenewal' => [
'class' => BootstrapSwitchColumn::className(),
'label' => 'Autorenew',
'filter' => false,
'url' => Url::toRoute('set-autorenewal'),
'popover' => 'The domain will be autorenewed for one year in a week before it expires if you have enough credit on your account',
'autorenewal' => [
'class' => BootstrapSwitchColumn::className(),
'label' => 'Autorenew',
'filter' => false,
'url' => Url::toRoute('set-autorenewal'),
'popover' => 'The domain will be autorenewed for one year in a week before it expires if you have enough credit on your account',
'pluginOptions' => [
'onColor' => 'info',
],
],
'nameservers' => [
'nameservers' => [
'format' => 'raw',
'value' => function ($model) {
'value' => function ($model) {
return ArraySpoiler::widget(['data' => $model->nameservers]);
},
],
'actions' => [
'class' => ActionColumn::className(),
'actions' => [
'class' => ActionColumn::className(),
'template' => '{view} {block} {delete} {update}', // {state}
'header' => Yii::t('app', 'Actions'),
'buttons' => [
'header' => Yii::t('app', 'Actions'),
'buttons' => [
'block' => function ($url, $model, $key) {
return Html::a('Close', ['block', 'id' => $model->id]);
},
Expand Down
2 changes: 1 addition & 1 deletion views/domain/view.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@
</div>

<div class="col-md-9">
<div class="nav-tabs-custom" style="cursor: move;">
<div class="nav-tabs-custom">
<!-- Tabs within a box -->
<ul class="nav nav-tabs">
<li class="active"><a href="#domain-details" data-toggle="tab" ><?= Yii::t('app', 'Domain details') ?></a></li>
Expand Down
7 changes: 6 additions & 1 deletion widgets/Expires.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,14 @@

namespace hipanel\modules\domain\widgets;

use hipanel\modules\domain\models\Domain;

class Expires extends \hipanel\widgets\Label
{
public $model = [];
/**
* @var Domain
*/
public $model;

public function run () {
$expires = $this->model->expires;
Expand Down
2 changes: 0 additions & 2 deletions widgets/State.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@

namespace hipanel\modules\domain\widgets;

use hipanel\base\Re;

class State extends \hipanel\widgets\Type
{
/** @inheritdoc */
Expand Down

0 comments on commit 7c3b40d

Please sign in to comment.