mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-25 05:34:06 -08:00
Better select/unselect all javascript for permissions
This commit is contained in:
parent
29a36b5d1c
commit
f5b3df697c
|
@ -7,7 +7,7 @@
|
|||
@stop
|
||||
|
||||
@section('header_right')
|
||||
<a href="{{ route('groups.edit', ['group' => $group->id]) }}" class="btn btn-sm btn-primary pull-right">{{ trans('admin/groups/titles.update') }} </a>
|
||||
<a href="{{ route('groups.edit', ['group' => $group->id]) }}" class="btn btn-primary text-right">{{ trans('admin/groups/titles.update') }} </a>
|
||||
<a href="{{ route('groups.index') }}" class="btn btn-default pull-right">{{ trans('general.back') }}</a>
|
||||
@stop
|
||||
|
||||
|
|
|
@ -456,16 +456,16 @@
|
|||
<table class="table table-striped permissions">
|
||||
<thead>
|
||||
<tr class="permissions-row">
|
||||
<th class="col-md-5"><span class="line"></span>Permission</th>
|
||||
<th class="col-md-1"><span class="line"></span>Grant</th>
|
||||
<th class="col-md-1"><span class="line"></span>Deny</th>
|
||||
<th class="col-md-1"><span class="line"></span>Inherit</th>
|
||||
<th class="col-md-5">Permission</th>
|
||||
<th class="col-md-1">Grant</th>
|
||||
<th class="col-md-1">Deny</th>
|
||||
<th class="col-md-1">Inherit</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
|
||||
@foreach ($permissions as $area => $permissionsArray)
|
||||
@if (count($permissionsArray) == 1)
|
||||
<tbody class="permissions-group">
|
||||
<?php $localPermission = $permissionsArray[0]; ?>
|
||||
<tr class="header-row permissions-row">
|
||||
<td class="col-md-5 tooltip-base permissions-item"
|
||||
|
@ -497,21 +497,21 @@
|
|||
@endif
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
||||
@else
|
||||
<tbody class="permissions-group">
|
||||
|
||||
<tr class="header-row permissions-row">
|
||||
<td class="col-md-5 header-name">
|
||||
<h3>{{ $area }}</h3>
|
||||
</td>
|
||||
<td class="col-md-1 permissions-item">
|
||||
{{ Form::radio("$area", '1',false,['value'=>"grant", 'class'=>'minimal']) }}
|
||||
{{ Form::radio("$area", '1',false,['value'=>"grant", 'class'=>'minimal', 'data-checker-group' => str_slug($area)]) }}
|
||||
</td>
|
||||
<td class="col-md-1 permissions-item">
|
||||
{{ Form::radio("$area", '-1',false,['value'=>"deny", 'class'=>'minimal']) }}
|
||||
{{ Form::radio("$area", '-1',false,['value'=>"deny", 'class'=>'minimal', 'data-checker-group' => str_slug($area)]) }}
|
||||
</td>
|
||||
<td class="col-md-1 permissions-item">
|
||||
{{ Form::radio("$area", '0',false,['value'=>"inherit", 'class'=>'minimal'] ) }}
|
||||
{{ Form::radio("$area", '0',false,['value'=>"inherit", 'class'=>'minimal', 'data-checker-group' => str_slug($area)] ) }}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
@ -527,31 +527,32 @@
|
|||
</td>
|
||||
<td class="col-md-1 permissions-item">
|
||||
@if (($permission['permission'] == 'superuser') && (!Auth::user()->isSuperUser()))
|
||||
{{ Form::radio('permission['.$permission['permission'].']', '1', $userPermissions[$permission['permission'] ] == '1', ["value"=>"grant", 'disabled'=>'disabled', 'class'=>'minimal']) }}
|
||||
{{ Form::radio('permission['.$permission['permission'].']', '1', $userPermissions[$permission['permission'] ] == '1', ["value"=>"grant", 'disabled'=>'disabled', 'class'=>'minimal radiochecker-'.str_slug($area)]) }}
|
||||
@else
|
||||
{{ Form::radio('permission['.$permission['permission'].']', '1', $userPermissions[ $permission['permission'] ] == '1', ["value"=>"grant",'class'=>'minimal']) }}
|
||||
{{ Form::radio('permission['.$permission['permission'].']', '1', $userPermissions[ $permission['permission'] ] == '1', ["value"=>"grant",'class'=>'minimal radiochecker-'.str_slug($area)]) }}
|
||||
@endif
|
||||
</td>
|
||||
<td class="col-md-1 permissions-item">
|
||||
@if (($permission['permission'] == 'superuser') && (!Auth::user()->isSuperUser()))
|
||||
{{ Form::radio('permission['.$permission['permission'].']', '-1', $userPermissions[$permission['permission'] ] == '-1', ["value"=>"deny", 'disabled'=>'disabled', 'class'=>'minimal']) }}
|
||||
{{ Form::radio('permission['.$permission['permission'].']', '-1', $userPermissions[$permission['permission'] ] == '-1', ["value"=>"deny", 'disabled'=>'disabled', 'class'=>'minimal radiochecker-'.str_slug($area)]) }}
|
||||
@else
|
||||
{{ Form::radio('permission['.$permission['permission'].']', '-1', $userPermissions[$permission['permission'] ] == '-1', ["value"=>"deny",'class'=>'minimal']) }}
|
||||
{{ Form::radio('permission['.$permission['permission'].']', '-1', $userPermissions[$permission['permission'] ] == '-1', ["value"=>"deny",'class'=>'minimal radiochecker-'.str_slug($area)]) }}
|
||||
@endif
|
||||
</td>
|
||||
<td class="col-md-1 permissions-item">
|
||||
@if (($permission['permission'] == 'superuser') && (!Auth::user()->isSuperUser()))
|
||||
{{ Form::radio('permission['.$permission['permission'].']', '0', $userPermissions[$permission['permission']] =='0', ["value"=>"inherit", 'disabled'=>'disabled', 'class'=>'minimal']) }}
|
||||
{{ Form::radio('permission['.$permission['permission'].']', '0', $userPermissions[$permission['permission']] =='0', ["value"=>"inherit", 'disabled'=>'disabled', 'class'=>'minimal radiochecker-'.str_slug($area)]) }}
|
||||
@else
|
||||
{{ Form::radio('permission['.$permission['permission'].']', '0', $userPermissions[$permission['permission']] =='0', ["value"=>"inherit", 'class'=>'minimal']) }}
|
||||
{{ Form::radio('permission['.$permission['permission'].']', '0', $userPermissions[$permission['permission']] =='0', ["value"=>"inherit", 'class'=>'minimal radiochecker-'.str_slug($area)]) }}
|
||||
@endif
|
||||
</td>
|
||||
@endif
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
|
||||
@endif
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div><!-- /.tab-pane -->
|
||||
</div><!-- /.tab-content -->
|
||||
|
@ -565,6 +566,8 @@
|
|||
@stop
|
||||
|
||||
@section('moar_scripts')
|
||||
<script src="{{ asset('js/pGenerator.jquery.js') }}"></script>
|
||||
|
||||
<script nonce="{{ csrf_token() }}">
|
||||
$(document).ready(function() {
|
||||
|
||||
|
@ -579,28 +582,18 @@ $(document).ready(function() {
|
|||
}
|
||||
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<script nonce="{{ csrf_token() }}">
|
||||
$('tr.header-row input:radio').on('ifClicked', function () {
|
||||
value = $(this).attr('value');
|
||||
$(this).parent().parent().parent().siblings().each(function(idx,elem) {
|
||||
$(this).find('td input:radio[value='+value+']').iCheck('check');
|
||||
})
|
||||
});
|
||||
// Check/Uncheck all radio buttons in the group
|
||||
$('tr.header-row input:radio').on('ifClicked', function () {
|
||||
value = $(this).attr('value');
|
||||
area = $(this).data('checker-group');
|
||||
console.log('Area selected is ' + area);
|
||||
$('.radiochecker-'+area+'[value='+value+']').iCheck('check');
|
||||
});
|
||||
|
||||
$('.header-name').click(function() {
|
||||
$(this).parent().nextUntil('tr.header-row').slideToggle(500);
|
||||
})
|
||||
</script>
|
||||
|
||||
<script src="{{ asset('js/pGenerator.jquery.js') }}"></script>
|
||||
|
||||
<script nonce="{{ csrf_token() }}">
|
||||
|
||||
|
||||
$(document).ready(function(){
|
||||
$('.header-name').click(function() {
|
||||
$(this).parent().nextUntil('tr.header-row').slideToggle(500);
|
||||
});
|
||||
|
||||
$('.tooltip-base').tooltip({container: 'body'})
|
||||
$(".superuser").change(function() {
|
||||
|
@ -622,10 +615,9 @@ $(document).ready(function(){
|
|||
'numbers': true,
|
||||
'specialChars': true,
|
||||
'onPasswordGenerated': function(generatedPassword) {
|
||||
$('#password_confirm').val($('#password').val());
|
||||
$('#password_confirm').val($('#password').val());
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$("#two_factor_reset").click(function(){
|
||||
$("#two_factor_resetrow").removeClass('success');
|
||||
|
@ -654,6 +646,8 @@ $(document).ready(function(){
|
|||
});
|
||||
|
||||
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
@stop
|
||||
|
|
Loading…
Reference in a new issue