mirror of
https://github.com/snipe/snipe-it.git
synced 2025-01-11 13:57:41 -08:00
Clearer/updated/named custom fields routes
This is still broken
This commit is contained in:
parent
37f93a2861
commit
37c847ea08
|
@ -33,13 +33,11 @@ class CustomFieldsController extends Controller
|
|||
* @since [v1.8]
|
||||
* @return View
|
||||
*/
|
||||
public function index()
|
||||
public function getIndex()
|
||||
{
|
||||
//
|
||||
$fieldsets=CustomFieldset::with("fields", "models")->get();
|
||||
//$fieldsets=CustomFieldset::all();
|
||||
$fields=CustomField::with("fieldset")->get();
|
||||
//$fields=CustomField::all();
|
||||
|
||||
$fieldsets = CustomFieldset::with("fields", "models")->get();
|
||||
$fields = CustomField::with("fieldset")->get();
|
||||
return View::make("custom_fields.index")->with("custom_fieldsets", $fieldsets)->with("custom_fields", $fields);
|
||||
}
|
||||
|
||||
|
@ -53,7 +51,6 @@ class CustomFieldsController extends Controller
|
|||
*/
|
||||
public function create()
|
||||
{
|
||||
//
|
||||
return View::make("custom_fields.create");
|
||||
}
|
||||
|
||||
|
@ -74,7 +71,7 @@ class CustomFieldsController extends Controller
|
|||
"user_id" => Auth::user()->id]
|
||||
);
|
||||
|
||||
$validator=Validator::make(Input::all(), $cfset->rules);
|
||||
$validator = Validator::make(Input::all(), $cfset->rules);
|
||||
if ($validator->passes()) {
|
||||
$cfset->save();
|
||||
return redirect()->route("admin.custom_fields.show", [$cfset->id])->with('success', trans('admin/custom_fields/message.fieldset.create.success'));
|
||||
|
@ -209,10 +206,10 @@ class CustomFieldsController extends Controller
|
|||
* @since [v1.8]
|
||||
* @return View
|
||||
*/
|
||||
public function show($id)
|
||||
public function getCustomFieldset($id)
|
||||
{
|
||||
$cfset = CustomFieldset::with('fields')->where('id','=',$id)->orderBy('id','ASC')->first();
|
||||
$custom_fields_list = ["" => "Add New Field to Fieldset"] + CustomField::lists("name", "id")->toArray();
|
||||
$custom_fields_list = ["" => "Add New Field to Fieldset"] + CustomField::pluck("name", "id")->toArray();
|
||||
|
||||
$maxid = 0;
|
||||
foreach ($cfset->fields() as $field) {
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
<div class="box-header with-border">
|
||||
<h3 class="box-title">{{ trans('admin/custom_fields/general.fieldsets') }}</h3>
|
||||
<div class="box-tools pull-right">
|
||||
<a href="{{ route('admin.custom_fields.create') }}" class="btn btn-sm btn-primary" data-toggle="tooltip" title="Create a new fieldset">{{ trans('admin/custom_fields/general.create_fieldset') }}</a>
|
||||
<a href="{{ route('admin.custom_fields.create-fieldset') }}" class="btn btn-sm btn-primary" data-toggle="tooltip" title="Create a new fieldset">{{ trans('admin/custom_fields/general.create_fieldset') }}</a>
|
||||
</div>
|
||||
</div><!-- /.box-header -->
|
||||
<div class="box-body">
|
||||
|
@ -50,7 +50,7 @@
|
|||
@endforeach
|
||||
</td>
|
||||
<td>
|
||||
{{ Form::open(array('route' => array('admin.custom_fields.destroy', $fieldset->id), 'method' => 'delete')) }}
|
||||
{{ Form::open(array('route' => array('admin.custom_fields.delete-field', $fieldset->id), 'method' => 'delete')) }}
|
||||
|
||||
@if($fieldset->models->count() > 0)
|
||||
<button type="submit" class="btn btn-danger btn-sm disabled" disabled><i class="fa fa-trash"></i></button>
|
||||
|
|
|
@ -48,7 +48,10 @@
|
|||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="5" class="text-right">
|
||||
{{ Form::open(['route' => ["admin.custom_fields.associate",$custom_fieldset->id], 'class'=>'form-horizontal', 'id' => 'ordering']) }}
|
||||
{{ Form::open(['route' =>
|
||||
["admin.custom_fields.associate",$custom_fieldset->id],
|
||||
'class'=>'form-horizontal',
|
||||
'id' => 'ordering']) }}
|
||||
{{ Form::checkbox("required","on") }}
|
||||
{{ trans('admin/custom_fields/general.required') }}
|
||||
{{ Form::text("order",$maxid)}}
|
||||
|
|
|
@ -797,13 +797,45 @@ Route::group([ 'prefix' => 'admin','middleware' => ['web','auth']], function ()
|
|||
});
|
||||
|
||||
# Custom fields support
|
||||
Route::get('custom_fields/create-field', ['uses' =>'CustomFieldsController@createField','as' => 'admin.custom_fields.create-field']);
|
||||
Route::post('custom_fields/create-field', ['uses' => 'CustomFieldsController@storeField','as' => 'admin.custom_fields.store-field']);
|
||||
Route::post('custom_fields/{id}/associate', ['uses' => 'CustomFieldsController@associate','as' => 'admin.custom_fields.associate']);
|
||||
Route::get('custom_fields/{field_id}/{fieldset_id}/disassociate', ['uses' => 'CustomFieldsController@deleteFieldFromFieldset','as' => 'admin.custom_fields.disassociate']);
|
||||
Route::match(['DELETE'], 'custom_fields/delete-field/{id}', ['uses' => 'CustomFieldsController@deleteField','as' => 'admin.custom_fields.delete-field']);
|
||||
Route::get('customfields/field/create',
|
||||
['uses' =>'CustomFieldsController@createField',
|
||||
'as' => 'admin.custom_fields.create-field']
|
||||
);
|
||||
|
||||
Route::get('custom_fields', ['uses' =>'CustomFieldsController@index','as' => 'admin.custom_fields.index']);
|
||||
Route::get('customfields/fieldset/create',
|
||||
['as' => 'admin.custom_fields.create-fieldset',
|
||||
'uses' => 'CustomFieldsController@create']
|
||||
);
|
||||
|
||||
Route::post('customfields/field/create',
|
||||
['uses' => 'CustomFieldsController@storeField',
|
||||
'as' => 'admin.custom_fields.store-field']
|
||||
);
|
||||
|
||||
Route::post('customfields/field/{id}/associate',
|
||||
['uses' => 'CustomFieldsController@associate',
|
||||
' as' => 'admin.custom_fields.associate']
|
||||
);
|
||||
|
||||
Route::get('customfields/fieldset/{fieldset_id}/{field_id}/disassociate',
|
||||
['uses' => 'CustomFieldsController@deleteFieldFromFieldset',
|
||||
'as' => 'admin.custom_fields.disassociate']
|
||||
);
|
||||
|
||||
Route::get('custom_fields/field/{id}/delete',
|
||||
['uses' =>'CustomFieldsController@deleteField',
|
||||
'as' => 'admin.custom_fields.delete-field']
|
||||
);
|
||||
|
||||
Route::get('customfields/fieldset/{id}/view',
|
||||
['uses' =>'CustomFieldsController@getCustomFieldset',
|
||||
'as' => 'admin.custom_fields.show']
|
||||
);
|
||||
|
||||
Route::get('customfields',
|
||||
['uses' =>'CustomFieldsController@getIndex',
|
||||
'as' => 'admin.custom_fields.index']
|
||||
);
|
||||
|
||||
|
||||
# User Management
|
||||
|
|
Loading…
Reference in a new issue