Skip to content

Commit

Permalink
Merge pull request #60 from netis-pl/aw-manager-action-delete-json
Browse files Browse the repository at this point in the history
edit actionDelete
  • Loading branch information
nineinchnick committed Jan 12, 2016
2 parents cd99538 + 9181eb1 commit c140463
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
13 changes: 11 additions & 2 deletions controllers/ManagerController.php
Expand Up @@ -156,8 +156,17 @@ public function actionUpdate($id = null)
*/
public function actionDelete($id)
{
if (!$this->loadModel($id)->delete()) {
throw new CHttpException(409, 'User account could not be deleted.');
$deleteSuccessful = $this->loadModel($id)->delete();
if (Yii::app()->request->isAjaxRequest) {
$data = [
'success' => $deleteSuccessful,
'message' => $deleteSuccessful ? Yii::t('UsrModule.manager', 'User account has been successfully deleted.') : Yii::t('UsrModule.manager', 'User account could not be deleted.'),
];
header("Content-type: application/json");
Yii::app()->getClientScript()->reset();
echo CJSON::encode($data);
} else if (!$deleteSuccessful) {
throw new CHttpException(409, Yii::t('UsrModule.manager', 'User account could not be deleted.'));
}
}

Expand Down
2 changes: 2 additions & 0 deletions messages/pl/manager.php
Expand Up @@ -53,4 +53,6 @@
'View user {id}' => 'Szczegóły użytkownika {id}',
'Yes' => 'Tak',
'You may optionally enter a comparison operator (<b>&lt;</b>, <b>&lt;=</b>, <b>&gt;</b>, <b>&gt;=</b>, <b>&lt;&gt;</b> or <b>=</b>) at the beginning of each of your search values to specify how the comparison should be done.' => 'Możesz poprzedzić każdą szukaną wartość opcjonalnym operatorem porównania (<b>&lt;</b>, <b>&lt;=</b>, <b>&gt;</b>, <b>&gt;=</b>, <b>&lt;&gt;</b> lub <b>=</b>).',
'User account has been successfully deleted.' => 'Konto użytkownika zostało usunięte pomyślnie.',
'User account could not be deleted.' => 'Nie można usunąć konta użytkownika.',
);

0 comments on commit c140463

Please sign in to comment.