Skip to content

Commit

Permalink
Refactor index page. Add new ActionBox and Advanced Search
Browse files Browse the repository at this point in the history
  • Loading branch information
tafid committed Aug 4, 2015
1 parent 68cbb4d commit 039fa4c
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 37 deletions.
41 changes: 16 additions & 25 deletions src/views/account/_search.php
Original file line number Diff line number Diff line change
@@ -1,36 +1,27 @@
<?php

use hipanel\modules\client\widgets\combo\ClientCombo;
use hipanel\widgets\AdvancedSearch;
use hiqdev\combo\StaticCombo;
use yii\helpers\Html;

?>

<?php $form = AdvancedSearch::begin(compact('model')) ?>
<div class="col-md-4">
<?= $form->field('login_like') ?>
</div>
<div class="col-md-6">
<?= $search->field('login_like') ?>
<?= $search->field('state')->widget(StaticCombo::classname(), [
'data' => $state_data,
'hasId' => true,
'pluginOptions' => [
'select2Options' => [
'multiple' => true,
]
],
]) ?>

<div class="col-md-4">
<?= $form->field('client_id')->widget(ClientCombo::classname()) ?>
<?= $form->field('seller_id')->widget(ClientCombo::classname()) ?>
</div>
</div>

<div class="col-md-4">
<?= $form->field('state')->widget(StaticCombo::classname(), [
'data' => $state_data,
'hasId' => true,
'pluginOptions' => [
'select2Options' => [
'multiple' => true,
]
],
]) ?>
</div>
<div class="col-md-6">
<?= $search->field('client_id')->widget(ClientCombo::classname()) ?>
<?= $search->field('seller_id')->widget(ClientCombo::classname()) ?>
</div>

<div class="col-md-12">
<?= Html::submitButton(Yii::t('app', 'Search'), ['class' => 'btn btn-primary']) ?>
</div>

<?php $form::end() ?>
10 changes: 7 additions & 3 deletions src/views/account/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,26 +21,29 @@
Pjax::begin(array_merge(Yii::$app->params['pjax'], ['enablePushState' => true]));

echo Html::beginForm();
$box = ActionBox::begin(['bulk' => true, 'options' => ['class' => 'box-info']]);
$box = ActionBox::begin(['model' => $model, 'bulk' => true, 'options' => ['class' => 'box-info']]);
$box->beginActions();
echo Html::a(Yii::t('app', 'Advanced search'), '#', ['class' => 'btn btn-info search-button']) . '&nbsp;';

echo Html::a(Yii::t('app', 'Create {modelClass}', ['modelClass' => 'account']), ['create'], ['class' => 'btn btn-success']) . '&nbsp;';
echo Html::a(Yii::t('app', 'Create FTP {modelClass}', ['modelClass' => 'account']), ['create-ftponly'], ['class' => 'btn btn-success']) . '&nbsp;';
print $box->renderSearchButton();
echo LinkSorter::widget([
'show' => true,
'sort' => $dataProvider->getSort(),
'attributes' => [
'login', 'client', 'server', 'state', 'type'
],
]);

$box->endActions();

$box->beginBulkActions();
echo Html::submitButton(Yii::t('app', 'Delete'), ['class' => 'btn btn-danger', 'formmethod' => 'POST', 'formaction' => Url::to('delete')]);
$box->endBulkActions();
echo $this->render('_search', compact('model'));
print $box->renderSearchForm();
$box::end();

$box->beginBulkForm();
echo AccountGridView::widget([
'dataProvider' => $dataProvider,
'filterModel' => $searchModel,
Expand All @@ -54,5 +57,6 @@
'actions',
],
]);
$box::endBulkForm();

Pjax::end();
16 changes: 16 additions & 0 deletions src/views/db/_search.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

use hipanel\modules\client\widgets\combo\ClientCombo;
use hipanel\modules\client\widgets\combo\SellerCombo;

?>

<div class="col-md-6">
<?= $search->field('name') ?>
<?= $search->field('description') ?>
</div>

<div class="col-md-6">
<?= $search->field('client_id')->widget(ClientCombo::classname()) ?>
<?= $search->field('seller_id')->widget(SellerCombo::classname()) ?>
</div>
11 changes: 6 additions & 5 deletions src/views/db/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@

Pjax::begin(array_merge(Yii::$app->params['pjax'], ['enablePushState' => true]));

echo Html::beginForm();
$box = ActionBox::begin(['bulk' => true, 'options' => ['class' => 'box-info']]);
$box = ActionBox::begin(['model' => $model, 'options' => ['class' => 'box-info']]);
$box->beginActions();
echo Html::a(Yii::t('app', 'Create {modelClass}', ['modelClass' => 'DB']), ['create'], ['class' => 'btn btn-success']) . '&nbsp;';
print $box->renderCreateButton(Yii::t('app', 'Create {modelClass}', ['modelClass' => 'DB'])) . '&nbsp;';
print $box->renderSearchButton();
echo LinkSorter::widget([
'show' => true,
'sort' => $dataProvider->getSort(),
Expand All @@ -29,8 +29,9 @@
$box->beginBulkActions();
echo Html::submitButton(Yii::t('app', 'Delete'), ['class' => 'btn btn-danger', 'formmethod' => 'POST', 'formaction' => Url::to('delete')]);
$box->endBulkActions();
print $box->renderSearchForm();
$box::end();

$box->beginBulkForm();
echo DbGridView::widget([
'dataProvider' => $dataProvider,
'filterModel' => $searchModel,
Expand All @@ -45,5 +46,5 @@
'actions'
],
]);

$box::endBulkForm();
Pjax::end();
2 changes: 2 additions & 0 deletions src/views/hdomain/_search.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?php

10 changes: 6 additions & 4 deletions src/views/hdomain/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,19 @@


echo Html::beginForm();
$box = ActionBox::begin(['bulk' => true, 'options' => ['class' => 'box-info']]);
$box = ActionBox::begin(['model' => $model, 'options' => ['class' => 'box-info']]);
$box->beginActions();
echo Html::a(Yii::t('app', 'Create {modelClass}', ['modelClass' => Yii::t('app', 'Domain')]), ['create'], ['class' => 'btn btn-primary']);
print $box->renderCreateButton(Yii::t('app', 'Create {modelClass}', ['modelClass' => Yii::t('app', 'Domain')]));
echo '&nbsp;';
print $box->renderSearchButton();
$box->endActions();

$box->beginBulkActions();
echo Html::submitButton(Yii::t('app', 'Delete'), ['class' => 'btn btn-danger', 'formmethod' => 'POST', 'formaction' => Url::to('delete')]);
$box->endBulkActions();
print $box->renderSearchForm();
$box::end();

$box->beginBulkForm();
echo HdomainGridView::widget([
'dataProvider' => $dataProvider,
'filterModel' => $searchModel,
Expand All @@ -48,5 +50,5 @@
'checkbox',
],
]);

$box::endBulkForm();
Pjax::end();

0 comments on commit 039fa4c

Please sign in to comment.