Skip to content

Commit

Permalink
BUGFIX 🐛 Make boolean component more robust (when disabled state used)
Browse files Browse the repository at this point in the history
  • Loading branch information
ndeblauw committed Feb 5, 2025
1 parent bc28262 commit 2f964e2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion resources/views/components/formelements/boolean.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
@include('BlueAdminFormelements::_label')
<div class="mt-1 sm:mt-0 sm:col-span-5">
<label>
<input type="hidden" name="{{$name}}" value="0">
<input type="hidden" name="{{$name}}" value="{{ $disabled ? ($value ? 1 : 0) : 0 }}">
<input {{ ($disabled) ? 'disabled' : '' }}
type="checkbox" id="{{$id}}" name="{{$name}}" value="1"
class="focus:ring-indigo-500 h-4 w-4 text-blue-600 border-gray-300 rounded {{ ($disabled) ? '!text-blue-200' : '' }}"
Expand Down
2 changes: 1 addition & 1 deletion src/View/Layouts/FluxAdmin/Header.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function findActiveTopLevelMenuItem()
$fake_index_routename = str($routename)->replace(['show', 'create', 'edit'], 'index')->toString();
$current_route = Route::has($fake_index_routename)
? str(route($fake_index_routename))->replace(config('app.url').'/','')->toString()
: Route::current()->uri;
: Route::current()?->uri;

// Check if it was one of the top level routes
$top_routes = collect(config('blue-admin.fluxmenu.top'))->map( fn($item) => $item['link'])->filter(fn($item) => $current_route == $item);
Expand Down

0 comments on commit 2f964e2

Please sign in to comment.