3
0
mirror of https://github.com/snipe/snipe-it.git synced 2026-03-29 20:04:21 +00:00

Modify Helper::categoryList() to take a category type parameter.

This allows for centralizing the category fetching code more and fixes
an error in asset model viewing (#2118).  Also add a few translated
strings and standardize on a base of 'Select a *' for the default value
in our lists.
This commit is contained in:
Daniel Meltzer
2016-06-05 09:47:44 -05:00
parent 9f6eb02afc
commit cd9cca9c6b
7 changed files with 31 additions and 28 deletions

View File

@ -55,9 +55,9 @@ class AssetModelsController extends Controller
public function getCreate()
{
// Show the page
$depreciation_list = \App\Helpers\Helper::depreciationList();
$manufacturer_list = \App\Helpers\Helper::manufacturerList();
$category_list = \App\Helpers\Helper::categoryList();
$depreciation_list = Helper::depreciationList();
$manufacturer_list = Helper::manufacturerList();
$category_list = Helper::categoryList('asset');
return View::make('models/edit')
->with('category_list', $category_list)
->with('depreciation_list', $depreciation_list)
@ -181,9 +181,9 @@ class AssetModelsController extends Controller
return redirect()->to('assets/models')->with('error', trans('admin/models/message.does_not_exist'));
}
$depreciation_list = \App\Helpers\Helper::depreciationList();
$manufacturer_list = \App\Helpers\Helper::manufacturerList();
$category_list = \App\Helpers\Helper::categoryList();
$depreciation_list = Helper::depreciationList();
$manufacturer_list = Helper::manufacturerList();
$category_list = Helper::categoryList('asset');
$view = View::make('models/edit', compact('model'));
$view->with('category_list', $category_list);
$view->with('depreciation_list', $depreciation_list);
@ -371,9 +371,9 @@ class AssetModelsController extends Controller
$model->id = null;
// Show the page
$depreciation_list = array('' => 'Do Not Depreciate') + Depreciation::lists('name', 'id');
$manufacturer_list = array('' => 'Select One') + Manufacturer::lists('name', 'id');
$category_list = array('' => '') + DB::table('categories')->whereNull('deleted_at')->lists('name', 'id');
$depreciation_list = Helper::depreciationList();
$manufacturer_list = Helper::manufacturerList();
$category_list = Helper::categoryList('asset');
$view = View::make('models/edit');
$view->with('category_list', $category_list);
$view->with('depreciation_list', $depreciation_list);