Setting categorization system

This categorization system aims to prevent mixing different options together.
This commit is contained in:
2021-01-06 01:29:01 +00:00
parent baddf3fc76
commit abace4e85b
5 changed files with 91 additions and 31 deletions

View File

@@ -108,13 +108,17 @@
<form name="settings" id="settings" method="post" action="{{route('saveSettings')}}">
@csrf
@foreach($options as $option)
<div class="form-group form-check">
<!-- Unchecked checkbox hack: This only works for serverside languages that process the last duplicate element, since the browser sends both the hidden and checkbox values. -->
<!-- This "hack" is necessary because browsers don't send, by default, unchecked checkboxes to the server, so we would have no way to know if X checkbox was unchecked. -->
<input type="hidden" name="{{$option->option_name}}" value="0">
<input type="checkbox" name="{{$option->option_name}}" value="1" id="{{$option->option_name}}" class="form-check-input" {{ ($option->option_value == 1) ? 'checked' : '' }}>
<label for="{{$option->option_name}}">{{$option->friendly_name}}</label>
</div>
@if(!in_array($option->option_name, $ignoreOptions))
<div class="form-group form-check">
<input type="hidden" name="{{$option->option_name}}" value="0">
<input type="checkbox" name="{{$option->option_name}}" value="1" id="{{$option->option_name}}" class="form-check-input" {{ ($option->option_value == 1) ? 'checked' : '' }}>
<label for="{{$option->option_name}}">{{$option->friendly_name}}</label>
</div>
@endif
@endforeach
</form>
</div>