Skip to content

Commit

Permalink
Note column separated to note/label
Browse files Browse the repository at this point in the history
  • Loading branch information
SilverFire committed Aug 27, 2015
1 parent e9f8728 commit 280bb07
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 5 deletions.
9 changes: 7 additions & 2 deletions src/controllers/ServerController.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,17 @@ public function actions()
'set-note' => [
'class' => 'hipanel\actions\SmartUpdateAction',
'success' => Yii::t('app', 'Note changed'),
'error' => Yii::t('app', 'Failed change note'),
'error' => Yii::t('app', 'Failed to change note'),
],
'set-label' => [
'class' => 'hipanel\actions\SmartUpdateAction',
'success' => Yii::t('app', 'Internal note changed'),
'error' => Yii::t('app', 'Failed to change internal note'),
],
'set-lock' => [
'class' => 'hipanel\actions\SwitchAction',
'success' => Yii::t('app', 'Record was changed'),
'error' => Yii::t('app', 'Error occurred!'),
'error' => Yii::t('app', 'Error occurred'),
'POST pjax' => [
'save' => true,
'success' => [
Expand Down
13 changes: 12 additions & 1 deletion src/grid/ServerGridView.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,10 @@ public static function defaultColumns()
'class' => MainColumn::className(),
'attribute' => 'name',
'filterAttribute' => 'name_like',
'note' => true
'note' => Yii::$app->user->can('support') ? 'label' : 'note',
'noteOptions' => [
'url' => Yii::$app->user->can('support') ? Url::to('set-label') : Url::to('set-note'),
]
],
'state' => [
'class' => RefColumn::className(),
Expand Down Expand Up @@ -165,6 +168,14 @@ public static function defaultColumns()
'emptytext' => Yii::t('app', 'set note'),
'url' => Url::to('set-note')
]
],
'label' => [
'class' => 'hiqdev\xeditable\grid\XEditableColumn',
'visible' => Yii::$app->user->can('support'),
'pluginOptions' => [
'emptytext' => Yii::t('app', 'set internal note'),
'url' => Url::to('set-label')
],
]
];
}
Expand Down
4 changes: 3 additions & 1 deletion src/models/Server.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ public function rules()
'statuses',
'running_task',
'note',
'label',
],
'safe'
],
Expand All @@ -78,7 +79,7 @@ public function rules()
'reset-password',
]
],
[['id'], 'required', 'on' => ['set-note']],
[['id'], 'required', 'on' => ['set-note', 'set-label']],
[['id'], 'required', 'on' => ['enable-vnc']],
[['id'], 'required', 'on' => ['enable-autorenewal']],
[['id'], 'required', 'on' => ['refuse']],
Expand Down Expand Up @@ -196,6 +197,7 @@ public function attributeLabels()
'block_reason_label' => Yii::t('app', 'Block reason label'),
'request_state_label' => Yii::t('app', 'Request state label'),
'ips' => Yii::t('app', 'IP addresses'),
'label' => Yii::t('app', 'Internal note'),
]);
}
}
2 changes: 1 addition & 1 deletion src/views/server/view.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
'boxed' => false,
'model' => $model,
'columns' => [
'client_id', 'seller_id', 'note',
'client_id', 'seller_id', 'note', 'label',
['attribute' => 'name'],
'state', 'ips', 'os', 'panel'
],
Expand Down

0 comments on commit 280bb07

Please sign in to comment.