mirror of
https://github.com/pterodactyl/panel.git
synced 2026-11-29 10:55:43 -05:00
Fix: Admin API mobile layout & bulk button states (#5614)
Fixes a couple of UI/UX issues on the Admin Application API page
(`new.blade.php`):
- Mobile Layout: Fixed the radio buttons stacking vertically and
breaking the page on small screens. The table now scrolls horizontally
and stays clean.
- Button States: The bulk select buttons ("Read All", etc.) now
dynamically change color to indicate which option is currently active.
Screenshots:
- Before:

- After:

Co-authored-by: Robert Dennis <31261583+robertdrakedennis@users.noreply.github.com>
This commit is contained in:
@@ -20,23 +20,41 @@
|
||||
<div class="box box-primary">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">Select Permissions</h3>
|
||||
<div class="box-tools">
|
||||
<div class="btn-group">
|
||||
<button type="button" class="btn btn-sm btn-default" id="btn-bulk-read">Read All</button>
|
||||
<button type="button" class="btn btn-sm btn-default" id="btn-bulk-rw">Read & Write All</button>
|
||||
<button type="button" class="btn btn-sm btn-default" id="btn-bulk-none">None All</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="box-body table-responsive no-padding">
|
||||
<table class="table table-hover">
|
||||
<table class="table table-hover" style="min-width: 650px;">
|
||||
@foreach($resources as $resource)
|
||||
<tr>
|
||||
<td class="col-sm-3 strong">{{ str_replace('_', ' ', title_case($resource)) }}</td>
|
||||
<td class="col-sm-3 radio radio-primary text-center">
|
||||
<input type="radio" id="r_{{ $resource }}" name="r_{{ $resource }}" value="{{ $permissions['r'] }}">
|
||||
<label for="r_{{ $resource }}">Read</label>
|
||||
<td class="strong" style="vertical-align: middle; padding-left: 15px;">
|
||||
{{ str_replace('_', ' ', title_case($resource)) }}
|
||||
</td>
|
||||
<td class="col-sm-3 radio radio-primary text-center">
|
||||
<input type="radio" id="rw_{{ $resource }}" name="r_{{ $resource }}" value="{{ $permissions['rw'] }}">
|
||||
<label for="rw_{{ $resource }}">Read & Write</label>
|
||||
|
||||
<td class="text-center" style="vertical-align: middle;">
|
||||
<div class="radio radio-primary" style="margin: 0;">
|
||||
<input type="radio" id="r_{{ $resource }}" name="r_{{ $resource }}" value="{{ $permissions['r'] }}">
|
||||
<label for="r_{{ $resource }}">Read</label>
|
||||
</div>
|
||||
</td>
|
||||
<td class="col-sm-3 radio text-center">
|
||||
<input type="radio" id="n_{{ $resource }}" name="r_{{ $resource }}" value="{{ $permissions['n'] }}" checked>
|
||||
<label for="n_{{ $resource }}">None</label>
|
||||
|
||||
<td class="text-center" style="vertical-align: middle;">
|
||||
<div class="radio radio-primary" style="margin: 0;">
|
||||
<input type="radio" id="rw_{{ $resource }}" name="r_{{ $resource }}" value="{{ $permissions['rw'] }}">
|
||||
<label for="rw_{{ $resource }}">Read & Write</label>
|
||||
</div>
|
||||
</td>
|
||||
|
||||
<td class="text-center" style="vertical-align: middle;">
|
||||
<div class="radio" style="margin: 0;">
|
||||
<input type="radio" id="n_{{ $resource }}" name="r_{{ $resource }}" value="{{ $permissions['n'] }}" checked>
|
||||
<label for="n_{{ $resource }}">None</label>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
@@ -63,8 +81,48 @@
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
|
||||
@section('footer-scripts')
|
||||
@parent
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
|
||||
function setButtonActive(activeButton) {
|
||||
$('#btn-bulk-read, #btn-bulk-rw, #btn-bulk-none')
|
||||
.removeClass('btn-primary')
|
||||
.addClass('btn-default');
|
||||
$(activeButton)
|
||||
.removeClass('btn-default')
|
||||
.addClass('btn-primary');
|
||||
}
|
||||
|
||||
|
||||
setButtonActive('#btn-bulk-none');
|
||||
|
||||
$('#btn-bulk-read').click(function(e) {
|
||||
e.preventDefault();
|
||||
$('input[id^="r_"]').prop('checked', true);
|
||||
setButtonActive(this);
|
||||
});
|
||||
|
||||
$('#btn-bulk-rw').click(function(e) {
|
||||
e.preventDefault();
|
||||
$('input[id^="rw_"]').prop('checked', true);
|
||||
setButtonActive(this);
|
||||
});
|
||||
|
||||
$('#btn-bulk-none').click(function(e) {
|
||||
e.preventDefault();
|
||||
$('input[id^="n_"]').prop('checked', true);
|
||||
setButtonActive(this);
|
||||
});
|
||||
|
||||
|
||||
$('input[type="radio"]').change(function() {
|
||||
$('#btn-bulk-read, #btn-bulk-rw, #btn-bulk-none')
|
||||
.removeClass('btn-primary')
|
||||
.addClass('btn-default');
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@endsection
|
||||
|
||||
Reference in New Issue
Block a user