Skip to content

Commit

Permalink
KMS-39_separate_deleted_list_from_normal_list
Browse files Browse the repository at this point in the history
  • Loading branch information
MateuszUrbanowicz committed May 20, 2015
1 parent 79dbb34 commit ea422e5
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 17 deletions.
44 changes: 27 additions & 17 deletions src/Gzero/Api/Controller/Admin/ContentController.php
Expand Up @@ -71,23 +71,33 @@ public function index($id = null)
return $this->respondNotFound();
}
}
if (array_key_exists('trashed', $params['filter'])) {
unset($params['filter']['trashed']); //i unset this, couse BaseRepository::handleFilterCriteria will tread this
// like normal search condition, any better place to deal with this exception ?
$results = $this->repository->getDeletedContents(
$params['filter'],
$params['orderBy'],
$params['page'],
$params['perPage']
);
} else {
$results = $this->repository->getContents(
$params['filter'],
$params['orderBy'],
$params['page'],
$params['perPage']
);
}

$results = $this->repository->getContents(
$params['filter'],
$params['orderBy'],
$params['page'],
$params['perPage']
);

return $this->respondWithSuccess($results, new ContentTransformer);
}

/**
* Display list of soft deleted contents
*
* @return \Illuminate\Http\JsonResponse
*/
public function indexOfDeleted(){
$input = $this->validator->validate('list');
$params = $this->processor->process($input)->getProcessedFields();

$results = $this->repository->getDeletedContents(
$params['filter'],
$params['orderBy'],
$params['page'],
$params['perPage']
);

return $this->respondWithSuccess($results, new ContentTransformer);
}

Expand Down
1 change: 1 addition & 0 deletions src/routes.php
Expand Up @@ -13,6 +13,7 @@ function () {
//Route::resource('blocks', 'Gzero\Api\Controller\Admin\BlockController');
// Contents
Route::get('contents/tree/{id?}', ['uses' => 'Gzero\Api\Controller\Admin\ContentController@indexTree']);
Route::get('contents/deleted', ['uses' => 'Gzero\Api\Controller\Admin\ContentController@indexOfDeleted']);
Route::resource('contents', 'Gzero\Api\Controller\Admin\ContentController');
Route::resource(
'contents.children',
Expand Down

0 comments on commit ea422e5

Please sign in to comment.