A free open source IT asset/license management system
Added breadcrumb to info-panel
snipe4ea527d980fb
diff --git a/resources/views/blade/info-panel/index.blade.php b/resources/views/blade/info-panel/index.blade.phpindex 2a995c4eb8..f635224f10 100644--- a/resources/views/blade/info-panel/index.blade.php+++ b/resources/views/blade/info-panel/index.blade.php@@ -275,8 +275,19 @@<x-info-panel.manufacturer :asset="$infoPanelObj" :manufacturer="($infoPanelObj->manufacturer ?? $infoPanelObj->model?->manufacturer)"/>@if ((isset($infoPanelObj->parent)) && ($infoPanelObj->parent))+ @php+ $locationAncestors = [];+ $ancestorCursor = $infoPanelObj->parent;++ while ($ancestorCursor) {+ array_unshift($locationAncestors, $ancestorCursor);+ $ancestorCursor = $ancestorCursor->parent;+ }+ @endphp<x-info-element icon_type="parent" title="{{ trans('admin/locations/table.parent') }}">- <a href="{{ route('locations.show', $infoPanelObj->parent->id) }}">{{ $infoPanelObj->parent->display_name }}</a>+ @foreach ($locationAncestors as $ancestor)+ <a href="{{ route('locations.show', $ancestor->id) }}">{{ $ancestor->display_name }}</a>@if (! $loop->last) › @endif+ @endforeach</x-info-element>@endifdiff --git a/tests/Feature/Locations/Ui/ShowLocationTest.php b/tests/Feature/Locations/Ui/ShowLocationTest.phpindex 9f6db9ae97..e1bd7ba5ef 100644--- a/tests/Feature/Locations/Ui/ShowLocationTest.php+++ b/tests/Feature/Locations/Ui/ShowLocationTest.php@@ -59,4 +59,33 @@ class ShowLocationTest extends TestCaseroute('locations.show', $child),]);}++ public function test_show_page_info_panel_includes_parent_location_hierarchy_without_current_location()+ {+ $grandparent = Location::factory()->create(['name' => 'Grandparent Info Panel Location']);+ $parent = Location::factory()->create([+ 'name' => 'Parent Info Panel Location',+ 'parent_id' => $grandparent->id,+ ]);+ $child = Location::factory()->create([+ 'name' => 'Child Info Panel Location',+ 'parent_id' => $parent->id,+ ]);++ $response = $this->actingAs(User::factory()->superuser()->create())+ ->get(route('locations.show', $child));++ $response->assertOk()+ ->assertSeeInOrder([+ route('locations.show', $grandparent),+ route('locations.show', $parent),+ ]);++ $responseContent = $response->getContent();++ $this->assertStringNotContainsString(+ '<a href="'.route('locations.show', $child).'">'.$child->display_name.'</a>',+ $responseContent+ );+ }}