From 808cd0f72827de225f547002a081c4d16a716819 Mon Sep 17 00:00:00 2001 From: snipe Date: Tue, 5 Dec 2017 18:11:06 -0800 Subject: [PATCH] Nicer groups permission edit UI --- config/permissions.php | 9 +- resources/views/groups/edit.blade.php | 188 ++++++++++++++++++++----- resources/views/groups/index.blade.php | 4 +- 3 files changed, 156 insertions(+), 45 deletions(-) diff --git a/config/permissions.php b/config/permissions.php index 6e578ae9d..0337916c1 100644 --- a/config/permissions.php +++ b/config/permissions.php @@ -17,14 +17,7 @@ return array( 'label' => '', 'note' => 'Determines whether the user has access to most aspects of the admin. ', 'display' => true, - ), - - array( - 'permission' => 'admin.api_key', - 'label' => 'Create API Key', - 'note' => 'Determines whether the user can access the API via API key.', - 'display' => false, - ), + ) ), 'Reports' => array( diff --git a/resources/views/groups/edit.blade.php b/resources/views/groups/edit.blade.php index 0d94a7703..169f7141f 100755 --- a/resources/views/groups/edit.blade.php +++ b/resources/views/groups/edit.blade.php @@ -6,60 +6,178 @@ ]) @section('content') - + + + @parent @stop @section('inputFields')
- +
{!! $errors->first('name', ' :message') !!}
+
+ + + + + + + + + + @foreach ($permissions as $area => $area_permission) + + + @if (count($area_permission) == 1) - @foreach ($permissions as $area => $permission) - @for ($i = 0; $i < count($permission); $i++) + + + + + + @else - - @if ($permission[$i]['display']) -
-

{{ $area }}: {{ $permission[$i]['label'] }}

-

{{ $permission[$i]['note'] }}

+
+ + + + - -
- + @foreach ($area_permission as $index => $this_permission) + @if ($this_permission['display']) + + + + + + + @endif + @endforeach + + + @endif - @endfor - @endforeach + @endforeach + +
PermissionGrantDeny
+

{{ $area . ': ' . $localPermission['label'] }}

+
+ {{ Form::radio('permission['.$localPermission['permission'].']', '1',$groupPermissions[$localPermission['permission'] ] == '1',['value'=>"grant", 'class'=>'minimal']) }} + + {{ Form::radio('permission['.$localPermission['permission'].']', '0',$groupPermissions[$localPermission['permission'] ] == '0',['value'=>"grant", 'class'=>'minimal']) }} +
+

{{ $area . ': ' . $localPermission['label'] }}

+

{{ $localPermission['note'] }}

- -
- - +
+ {{ Form::radio("$area", '1',false,['value'=>"grant", 'class'=>'minimal', 'data-checker-group' => str_slug($area)]) }} + + {{ Form::radio("$area", '0',false,['value'=>"deny", 'class'=>'minimal', 'data-checker-group' => str_slug($area)]) }} +
+ {{ $this_permission['label'] }} + + {{ Form::radio('permission['.$this_permission['permission'].']', '1',$groupPermissions[$this_permission['permission'] ] == '1',['class'=>'minimal radiochecker-'.str_slug($area)]) }} + + {{ Form::radio('permission['.$this_permission['permission'].']', '0',$groupPermissions[$this_permission['permission'] ] == '0',['class'=>'minimal radiochecker-'.str_slug($area)]) }} +
+
+@stop +@section('moar_scripts') + + @stop diff --git a/resources/views/groups/index.blade.php b/resources/views/groups/index.blade.php index 140307a9a..ba29db4a6 100755 --- a/resources/views/groups/index.blade.php +++ b/resources/views/groups/index.blade.php @@ -7,8 +7,8 @@ @stop @section('header_right') - {{ trans('general.create') }} -{{ trans('general.back') }} + {{ trans('general.create') }} +{{ trans('general.back') }} @stop