Skip to content

Commit

Permalink
+ WP un/freeze
Browse files Browse the repository at this point in the history
  • Loading branch information
hiqsol committed Apr 6, 2016
1 parent 8e5b835 commit d3cddb9
Show file tree
Hide file tree
Showing 4 changed files with 117 additions and 54 deletions.
12 changes: 10 additions & 2 deletions src/controllers/DomainController.php
Original file line number Diff line number Diff line change
Expand Up @@ -316,11 +316,19 @@ public function actions()
],
'enable-freeze' => [
'class' => SmartPerformAction::class,
'success' => Yii::t('app', 'Freeze was enabled'),
'success' => Yii::t('hipanel/domain', 'Freeze was enabled'),
],
'disable-freeze' => [
'class' => SmartPerformAction::class,
'success' => Yii::t('app', 'Freeze was disabled'),
'success' => Yii::t('hipanel/domain', 'Freeze was disabled'),
],
'enable-freeze-w-p' => [
'class' => SmartPerformAction::class,
'success' => Yii::t('hipanel/domain', 'WP freeze was enabled'),
],
'disable-freeze-w-p' => [
'class' => SmartPerformAction::class,
'success' => Yii::t('hipanel/domain', 'WP freeze was disabled'),
],
'OLD-set-ns' => [
'class' => RenderAction::class,
Expand Down
103 changes: 103 additions & 0 deletions src/views/domain/_freezeButtons.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
<?php

use hipanel\widgets\ModalButton;
use yii\helpers\Html;
use yii\helpers\Url;

?>
<?php if (!$model->isFreezed() && Yii::$app->user->can('freeze')) : ?>
<li>
<?= ModalButton::widget([
'model' => $model,
'scenario' => 'enable-freeze',
'button' => [
'label' => '<i class="fa fa-fw fa-lock"></i>' . Yii::t('hipanel/domain', 'Freeze domain'),
],
'modal' => [
'header' => Html::tag('h4', Yii::t('hipanel/domain', 'Confirm domain freezing')),
'headerOptions' => ['class' => 'label-info'],
'footer' => [
'label' => Yii::t('hipanel/domain', 'Freeze domain'),
'data-loading-text' => Yii::t('hipanel/domain', 'Freezing domain...'),
'class' => 'btn btn-danger',
],
],
'body' => Yii::t('hipanel/domain',
'Are you sure, that you want to freeze domain <b>{domain}</b>?',
['domain' => $model->domain]
)
]) ?>
</li>
<?php endif ?>
<?php if ($model->isFreezed() && Yii::$app->user->can('unfreeze')) : ?>
<li>
<?= ModalButton::widget([
'model' => $model,
'scenario' => 'disable-freeze',
'button' => [
'label' => '<i class="fa fa-fw fa-unlock"></i>' . Yii::t('hipanel/domain', 'Unfreeze domain'),
],
'modal' => [
'header' => Html::tag('h4', Yii::t('hipanel/domain', 'Confirm domain unfreezing')),
'headerOptions' => ['class' => 'label-info'],
'footer' => [
'label' => Yii::t('hipanel/domain', 'Unfreeze domain'),
'data-loading-text' => Yii::t('hipanel/domain', 'Unfreezing domain...'),
'class' => 'btn btn-danger',
],
],
'body' => Yii::t('hipanel/domain',
'Are you sure, that you want to unfreeze domain <b>{domain}</b>?',
['domain' => $model->domain]
)
]) ?>
</li>
<?php endif ?>
<?php if (!$model->isWPFreezed() && Yii::$app->user->can('freeze')) : ?>
<li>
<?= ModalButton::widget([
'model' => $model,
'scenario' => 'enable-freeze-w-p',
'button' => [
'label' => '<i class="fa fa-fw fa-lock"></i>' . Yii::t('hipanel/domain', 'Freeze WHOIS-protect'),
],
'modal' => [
'header' => Html::tag('h4', Yii::t('hipanel/domain', 'Confirm freezing WHOIS-protect')),
'headerOptions' => ['class' => 'label-info'],
'footer' => [
'label' => Yii::t('hipanel/domain', 'Freeze WHOIS-protect'),
'data-loading-text' => Yii::t('hipanel/domain', 'Freezing WHOIS-protect...'),
'class' => 'btn btn-danger',
],
],
'body' => Yii::t('hipanel/domain',
'Are you sure, that you want to freeze WHOIS-protect <b>{domain}</b>?',
['domain' => $model->domain]
)
]) ?>
</li>
<?php endif ?>
<?php if ($model->isWPFreezed() && Yii::$app->user->can('unfreeze')) : ?>
<li>
<?= ModalButton::widget([
'model' => $model,
'scenario' => 'disable-freeze-w-p',
'button' => [
'label' => '<i class="fa fa-fw fa-unlock"></i>' . Yii::t('hipanel/domain', 'Unfreeze WHOIS-protect'),
],
'modal' => [
'header' => Html::tag('h4', Yii::t('hipanel/domain', 'Confirm unfreezing WHOIS-protect')),
'headerOptions' => ['class' => 'label-info'],
'footer' => [
'label' => Yii::t('hipanel/domain', 'Unfreeze WHOIS-protect'),
'data-loading-text' => Yii::t('hipanel/domain', 'Unfreezing WHOIS-protect...'),
'class' => 'btn btn-danger',
],
],
'body' => Yii::t('hipanel/domain',
'Are you sure, that you want to unfreeze WHOIS-protect for domain <b>{domain}</b>?',
['domain' => $model->domain]
)
]) ?>
</li>
<?php endif ?>
File renamed without changes.
56 changes: 4 additions & 52 deletions src/views/domain/view.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
use hipanel\widgets\AjaxModal;
use hipanel\widgets\Box;
use hipanel\widgets\ClientSellerLink;
use hipanel\widgets\ModalButton;
use hipanel\widgets\Pjax;
use hiqdev\bootstrap_switch\BootstrapSwitchColumn;
use hiqdev\xeditable\widgets\XEditable;
Expand Down Expand Up @@ -57,7 +56,7 @@
<ul class="nav">
<li>
<?php $url = 'http://' . $model->domain . '/' ?>
<?= Html::a('<i class="fa fa-globe"></i>' . Yii::t('hipanel/domain', 'Go to site ') . \yii\helpers\StringHelper::truncate($url, 15), $url, ['target' => '_blank']); ?>
<?= Html::a('<i class="fa fa-fw fa-globe"></i>' . Yii::t('hipanel/domain', 'Go to site ') . \yii\helpers\StringHelper::truncate($url, 15), $url, ['target' => '_blank']); ?>
</li>
<li>
<?= AjaxModal::widget([
Expand All @@ -77,60 +76,13 @@
</li>
<?php if ($model->canRenew()) { ?>
<li>
<?= Html::a('<i class="fa fa-forward"></i>' . Yii::t('hipanel/domain', 'Renew domain'), ['add-to-cart-renewal', 'model_id' => $model->id], ['data-pjax' => 0]); ?>
<?= Html::a('<i class="fa fa-fw fa-forward"></i>' . Yii::t('hipanel/domain', 'Renew domain'), ['add-to-cart-renewal', 'model_id' => $model->id], ['data-pjax' => 0]); ?>
</li>
<?php } ?>
<?php if (Yii::$app->user->can('support') && Yii::$app->user->not($model->client_id)) : ?>
<li><?= $this->render('_sync_button', compact('model')) ?></li>
<?php endif ?>
<?php if ($model->isFreezed() && Yii::$app->user->can('unfreeze')) : ?>
<li>
<?= ModalButton::widget([
'model' => $model,
'scenario' => 'disable-freeze',
'button' => [
'label' => '<i class="fa fa-unlock"></i>' . Yii::t('hipanel/domain', 'Unfreeze'),
],
'modal' => [
'header' => Html::tag('h4', Yii::t('hipanel/domain', 'Confirm domain unfreezing')),
'headerOptions' => ['class' => 'label-info'],
'footer' => [
'label' => Yii::t('hipanel/domain', 'Unfreeze domain'),
'data-loading-text' => Yii::t('hipanel/domain', 'Unfreezing domain...'),
'class' => 'btn btn-danger',
],
],
'body' => Yii::t('hipanel/domain',
'Are you sure, that you want to unfreeze domain <b>{domain}</b>?',
['domain' => $model->domain]
)
]) ?>
</li>
<?php endif ?>
<?php if (!$model->isFreezed() && Yii::$app->user->can('freeze')) : ?>
<li>
<?= ModalButton::widget([
'model' => $model,
'scenario' => 'enable-freeze',
'button' => [
'label' => '<i class="fa fa-lock"></i>' . Yii::t('hipanel/domain', 'Freeze'),
],
'modal' => [
'header' => Html::tag('h4', Yii::t('hipanel/domain', 'Confirm domain freezing')),
'headerOptions' => ['class' => 'label-info'],
'footer' => [
'label' => Yii::t('hipanel/domain', 'Freeze domain'),
'data-loading-text' => Yii::t('hipanel/domain', 'Freezing domain...'),
'class' => 'btn btn-danger',
],
],
'body' => Yii::t('hipanel/domain',
'Are you sure, that you want to freeze domain <b>{domain}</b>?',
['domain' => $model->domain]
)
]) ?>
</li>
<li><?= $this->render('_syncButton', compact('model')) ?></li>
<?php endif ?>
<?= $this->render('_freezeButtons', compact('model')) ?>
</ul>
</div>
<?php Box::end() ?>
Expand Down

0 comments on commit d3cddb9

Please sign in to comment.