Skip to content

Commit

Permalink
redone Menus: widget instead of create+render
Browse files Browse the repository at this point in the history
  • Loading branch information
hiqsol committed Dec 21, 2016
1 parent 230674a commit e15b87e
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 20 deletions.
2 changes: 1 addition & 1 deletion src/menus/CheckDomainMenu.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public function items()
{
return [
'check-domain' => [
'label' => $this->renderView('checkDomain'),
'label' => $this->render('checkDomain'),
'encode' => false,
],
];
Expand Down
2 changes: 1 addition & 1 deletion src/menus/DomainBulkActionsMenu.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public function items()
' . Yii::t('hipanel', 'Basic actions') . '
<span class="caret"></span>
</button>
' . DomainBulkBasicActionsMenu::create()->render([
' . DomainBulkBasicActionsMenu::widget([], [
'class' => Dropdown::class,
'encodeLabels' => false,
]) . '
Expand Down
2 changes: 1 addition & 1 deletion src/menus/DomainDetailMenu.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
use yii\bootstrap\Modal;
use yii\helpers\Html;

class DomainDetailMenu extends \hiqdev\menumanager\Menu
class DomainDetailMenu extends \hipanel\menus\AbstractDetailMenu
{
public $model;

Expand Down
4 changes: 1 addition & 3 deletions src/menus/HostDetailMenu.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

namespace hipanel\modules\domain\menus;

use hiqdev\menumanager\Menu;

class HostDetailMenu extends Menu
class HostDetailMenu extends \hipanel\menus\AbstractDetailMenu
{
public $model;

Expand Down
10 changes: 3 additions & 7 deletions src/views/domain/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
<?php $page->endContent() ?>

<?php $page->beginContent('bulk-actions') ?>
<?= DomainBulkActionsMenu::create()->render([
<?= DomainBulkActionsMenu::widget([], [
'encodeLabels' => false,
'itemOptions' => [
'tag' => false,
Expand All @@ -51,12 +51,8 @@
'columns' => [
'checkbox',
'domain', 'actions', 'client', 'seller',
'state',
'whois_protected',
'is_secured',
'created_date',
'expires',
'autorenewal',
'state', 'whois_protected', 'is_secured',
'created_date', 'expires', 'autorenewal',
],
]) ?>
<?php $page->endBulkForm() ?>
Expand Down
5 changes: 2 additions & 3 deletions src/views/domain/view.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
use hipanel\modules\dns\widgets\DnsZoneEditWidget;
use hipanel\modules\domain\grid\DomainGridView;
use hipanel\modules\domain\menus\DomainDetailMenu;
use hiqdev\menumanager\widgets\DetailMenu;
use hipanel\modules\domain\widgets\AuthCode;
use hipanel\modules\domain\widgets\NsWidget;
use hipanel\widgets\Box;
Expand Down Expand Up @@ -64,11 +63,11 @@
<p class="text-center">
<span class="profile-user-role"><?= $this->title ?></span>
<br>
<span class="profile-user-name"><?= ClientSellerLink::widget(compact('model')) ?></span>
<span class="profile-user-name"><?= ClientSellerLink::widget(['model' => $model]) ?></span>
</p>

<div class="profile-usermenu">
<?= DomainDetailMenu::create(['model' => $model])->render(DetailMenu::class) ?>
<?= DomainDetailMenu::widget(['model' => $model]) ?>
</div>
<?php Box::end() ?>
</div>
Expand Down
7 changes: 3 additions & 4 deletions src/views/host/view.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@
use hipanel\widgets\Box;
use hipanel\widgets\ClientSellerLink;
use hipanel\widgets\Pjax;
use hiqdev\menumanager\widgets\DetailMenu;
use yii\helpers\Html;

$this->title = Html::encode($model->host);
$this->title = Html::encode($model->host);
$this->params['subtitle'] = Yii::t('hipanel:domain', 'Name server detailed information') . ' #' . $model->id;
$this->params['breadcrumbs'][] = ['label' => Yii::t('hipanel:domain', 'Name Servers'), 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
Expand All @@ -32,10 +31,10 @@
<p class="text-center">
<span class="profile-user-role"><?= $this->title ?></span>
<br>
<span class="profile-user-name"><?= ClientSellerLink::widget(compact('model')) ?></span>
<span class="profile-user-name"><?= ClientSellerLink::widget(['model' => $model]) ?></span>
</p>
<div class="profile-usermenu">
<?= HostDetailMenu::create(['model' => $model])->render(DetailMenu::class) ?>
<?= HostDetailMenu::widget(['model' => $model]) ?>
</div>
<?php Box::end() ?>
</div>
Expand Down

0 comments on commit e15b87e

Please sign in to comment.