Skip to content

Commit

Permalink
Add view page
Browse files Browse the repository at this point in the history
  • Loading branch information
tafid committed Nov 13, 2015
1 parent bc0f60c commit 5eb1906
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 23 deletions.
6 changes: 6 additions & 0 deletions src/controllers/BackupingController.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ public function actions()
],
'view' => [
'class' => 'hipanel\actions\ViewAction',
'data' => function ($action) {
return [
'stateOptions' => $action->controller->getStateOptions(),
'typeOptions' => $action->controller->getTypeOptions(),
];
},
],
];
}
Expand Down
11 changes: 10 additions & 1 deletion src/grid/BackupingGridView.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@

namespace hipanel\modules\hosting\grid;

use hipanel\grid\ActionColumn;
use hipanel\grid\MainColumn;
use hipanel\helpers\Url;
use hipanel\modules\hosting\widgets\backup\ObjectLabelWidget;
use hipanel\modules\server\grid\ServerColumn;
use hiqdev\xeditable\widgets\XEditable;
use yii\helpers\Html;

class BackupingGridView extends \hipanel\grid\BoxedGridView
{
Expand All @@ -30,8 +32,11 @@ static public function defaultColumns()
$typeOptions = self::$typeOptions;
return [
'name' => [
'class' => MainColumn::className(),
'filterAttribute' => 'backuping_like',
'format' => 'raw',
'value' => function($model) {
return Html::a($model->name, [sprintf('/hosting/%s/view', $model->object), 'id' => $model->id], ['data-pjax' => 0, 'class' => 'bold']);
}
],
'account' => [
'attribute' => 'account_id',
Expand Down Expand Up @@ -82,6 +87,10 @@ static public function defaultColumns()
return sprintf('%s GB', $model->total_du_gb);
}
],
'actions' => [
'class' => ActionColumn::className(),
'template' => '{view} {delete}',
],
];
}
}
1 change: 1 addition & 0 deletions src/views/backuping/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
'state_label',
'backup_last',
'total_du_gb',
'actions',
],
]) ?>
<?php $box->endBulkForm() ?>
Expand Down
42 changes: 20 additions & 22 deletions src/views/backuping/view.php
Original file line number Diff line number Diff line change
@@ -1,32 +1,30 @@
<?php
/**
* @link http://hiqdev.com/hipanel-module-hosting
* @license http://hiqdev.com/hipanel-module-hosting/license
* @copyright Copyright (c) 2015 HiQDev
*/

use hipanel\modules\hosting\grid\BackupingGridView;
use hipanel\widgets\Pjax;
use yii\helpers\Html;

$this->title = Html::encode($model->domain);
$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Domains'), 'url' => ['index']];
$this->title = Html::encode($model->id);
$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Backup settings'), 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;

?>

<? Pjax::begin(Yii::$app->params['pjax']) ?>
<div class="row">

<div class="col-md-4">
<?= BackupingGridView::detailView([
'model' => $model,
'columns' => [
'seller_id','client_id',
['attribute' => 'backuping'],
],
]) ?>
</div>

</div>
<?php Pjax::end() ?>
<div class="col-md-4">
<?= BackupingGridView::detailView([
'model' => $model,
'columns' => [
'name',
'client',
'account',
'server',
'object',
'backup_count',
'type_label',
'state_label',
'backup_last',
'total_du_gb',
],
]) ?>
</div>
</div>

0 comments on commit 5eb1906

Please sign in to comment.