From 039fa4ce8395a2327f2e91ab7fe3cc9b16617505 Mon Sep 17 00:00:00 2001 From: Andrey Klochok Date: Tue, 4 Aug 2015 19:32:21 +0300 Subject: [PATCH] Refactor index page. Add new ActionBox and Advanced Search --- src/views/account/_search.php | 41 ++++++++++++++--------------------- src/views/account/index.php | 10 ++++++--- src/views/db/_search.php | 16 ++++++++++++++ src/views/db/index.php | 11 +++++----- src/views/hdomain/_search.php | 2 ++ src/views/hdomain/index.php | 10 +++++---- 6 files changed, 53 insertions(+), 37 deletions(-) create mode 100644 src/views/db/_search.php create mode 100644 src/views/hdomain/_search.php diff --git a/src/views/account/_search.php b/src/views/account/_search.php index bad3104d..46a3552a 100644 --- a/src/views/account/_search.php +++ b/src/views/account/_search.php @@ -1,36 +1,27 @@ - -
- field('login_like') ?> -
+
+ field('login_like') ?> + field('state')->widget(StaticCombo::classname(), [ + 'data' => $state_data, + 'hasId' => true, + 'pluginOptions' => [ + 'select2Options' => [ + 'multiple' => true, + ] + ], + ]) ?> -
- field('client_id')->widget(ClientCombo::classname()) ?> - field('seller_id')->widget(ClientCombo::classname()) ?> -
+
-
- field('state')->widget(StaticCombo::classname(), [ - 'data' => $state_data, - 'hasId' => true, - 'pluginOptions' => [ - 'select2Options' => [ - 'multiple' => true, - ] - ], - ]) ?> -
+
+ field('client_id')->widget(ClientCombo::classname()) ?> + field('seller_id')->widget(ClientCombo::classname()) ?> +
-
- 'btn btn-primary']) ?> -
- diff --git a/src/views/account/index.php b/src/views/account/index.php index 7de0295f..06a29ed6 100644 --- a/src/views/account/index.php +++ b/src/views/account/index.php @@ -21,11 +21,12 @@ 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']) . ' '; + echo Html::a(Yii::t('app', 'Create {modelClass}', ['modelClass' => 'account']), ['create'], ['class' => 'btn btn-success']) . ' '; echo Html::a(Yii::t('app', 'Create FTP {modelClass}', ['modelClass' => 'account']), ['create-ftponly'], ['class' => 'btn btn-success']) . ' '; +print $box->renderSearchButton(); echo LinkSorter::widget([ 'show' => true, 'sort' => $dataProvider->getSort(), @@ -33,14 +34,16 @@ '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, @@ -54,5 +57,6 @@ 'actions', ], ]); +$box::endBulkForm(); Pjax::end(); \ No newline at end of file diff --git a/src/views/db/_search.php b/src/views/db/_search.php new file mode 100644 index 00000000..5b125e51 --- /dev/null +++ b/src/views/db/_search.php @@ -0,0 +1,16 @@ + + +
+ field('name') ?> + field('description') ?> +
+ +
+ field('client_id')->widget(ClientCombo::classname()) ?> + field('seller_id')->widget(SellerCombo::classname()) ?> +
diff --git a/src/views/db/index.php b/src/views/db/index.php index 1fca9aa9..a7420ed6 100644 --- a/src/views/db/index.php +++ b/src/views/db/index.php @@ -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']) . ' '; +print $box->renderCreateButton(Yii::t('app', 'Create {modelClass}', ['modelClass' => 'DB'])) . ' '; +print $box->renderSearchButton(); echo LinkSorter::widget([ 'show' => true, 'sort' => $dataProvider->getSort(), @@ -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, @@ -45,5 +46,5 @@ 'actions' ], ]); - +$box::endBulkForm(); Pjax::end(); diff --git a/src/views/hdomain/_search.php b/src/views/hdomain/_search.php new file mode 100644 index 00000000..a4abe2da --- /dev/null +++ b/src/views/hdomain/_search.php @@ -0,0 +1,2 @@ + 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 ' '; +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, @@ -48,5 +50,5 @@ 'checkbox', ], ]); - +$box::endBulkForm(); Pjax::end(); \ No newline at end of file