Skip to content

Commit

Permalink
Fixed error processing in answer action (#19)
Browse files Browse the repository at this point in the history
* Fixed answer action retunr ulr, when error occured.

* Added `success` section
  • Loading branch information
tafid authored and hiqsol committed Sep 5, 2018
1 parent 052e153 commit 9d61d39
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/controllers/TicketController.php
Expand Up @@ -15,6 +15,7 @@
use hipanel\actions\PrepareAjaxViewAction;
use hipanel\actions\PrepareBulkAction;
use hipanel\actions\ProxyAction;
use hipanel\actions\RedirectAction;
use hipanel\actions\SmartCreateAction;
use hipanel\actions\SmartPerformAction;
use hipanel\actions\SmartUpdateAction;
Expand Down Expand Up @@ -112,6 +113,20 @@ public function actions()
'answer' => [
'class' => SmartUpdateAction::class,
'success' => Yii::t('hipanel:ticket', 'Ticket changed'),
'POST html' => [
'save' => true,
'success' => [
'class' => RedirectAction::class,
'url' => function ($action) {
return $action->collection->count() > 1
? $action->controller->getSearchUrl()
: $action->controller->getActionUrl('view', ['id' => $action->collection->first->id]);
},
],
'error' => [
'class' => RedirectAction::class,
]
],
],
'create' => [
'class' => SmartCreateAction::class,
Expand Down

0 comments on commit 9d61d39

Please sign in to comment.