-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
003ed30
commit 73a96b3
Showing
7 changed files
with
103 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<?php | ||
|
||
namespace App\Http\Livewire; | ||
|
||
use App\Models\Folder; | ||
use Livewire\Component; | ||
|
||
class Breadcrumb extends Component | ||
{ | ||
public $documentId; | ||
public $folderId; | ||
public $elements; | ||
|
||
public function findIterativeFolders() | ||
{ | ||
$this->elements = []; | ||
if ($this->folderId != null) { | ||
$folder = Folder::find($this->folderId); | ||
array_push($this->elements, $folder); | ||
|
||
if (isset($folder->parent_folder_id)) | ||
{ | ||
while($folder->parent_folder_id != null) | ||
{ | ||
$folder = Folder::find($folder->parent_folder_id); | ||
array_unshift($this->elements, $folder); | ||
} | ||
} | ||
} | ||
|
||
return $this->elements; | ||
} | ||
|
||
public function mount($documentId, $folderId) | ||
{ | ||
$this->findIterativeFolders(); | ||
|
||
$this->documentId = $documentId; | ||
$this->folderId = $folderId; | ||
} | ||
|
||
public function render() | ||
{ | ||
return view('livewire.breadcrumb'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<div class="float-left"> | ||
<nav class="text-black font-bold my-3" aria-label="Breadcrumb"> | ||
<ol class="list-none p-0 inline-flex"> | ||
<li class="flex items-center"> | ||
<a href="{{ route('dashboard') }}">Pano</a> | ||
</li> | ||
@foreach ($elements as $key => $element) | ||
@if ($key == array_key_last($elements) && $documentId == null) | ||
@php | ||
break; | ||
@endphp | ||
@endif | ||
<li class="flex items-center"> | ||
<svg class="fill-current w-3 h-3 mx-3" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512"> | ||
<path | ||
d="M285.476 272.971L91.132 467.314c-9.373 9.373-24.569 9.373-33.941 0l-22.667-22.667c-9.357-9.357-9.375-24.522-.04-33.901L188.505 256 34.484 101.255c-9.335-9.379-9.317-24.544.04-33.901l22.667-22.667c9.373-9.373 24.569-9.373 33.941 0L285.475 239.03c9.373 9.372 9.373 24.568.001 33.941z" /> | ||
</svg> | ||
<a href="{{ route('listFolderContents', $element["id"]) }}">{{ $element["name"] }}</a> | ||
|
||
</li> | ||
@endforeach | ||
@if ($documentId == null) | ||
<li class="flex items-center"> | ||
<svg class="fill-current w-3 h-3 mx-3" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512"> | ||
<path | ||
d="M285.476 272.971L91.132 467.314c-9.373 9.373-24.569 9.373-33.941 0l-22.667-22.667c-9.357-9.357-9.375-24.522-.04-33.901L188.505 256 34.484 101.255c-9.335-9.379-9.317-24.544.04-33.901l22.667-22.667c9.373-9.373 24.569-9.373 33.941 0L285.475 239.03c9.373 9.372 9.373 24.568.001 33.941z" /> | ||
</svg> | ||
<a href="javascript:void;" class="text-gray-500" aria-current="page">{{ end($elements)["name"] }}</a> | ||
</li> | ||
@else | ||
<li class="flex items-center"> | ||
<svg class="fill-current w-3 h-3 mx-3" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512"> | ||
<path | ||
d="M285.476 272.971L91.132 467.314c-9.373 9.373-24.569 9.373-33.941 0l-22.667-22.667c-9.357-9.357-9.375-24.522-.04-33.901L188.505 256 34.484 101.255c-9.335-9.379-9.317-24.544.04-33.901l22.667-22.667c9.373-9.373 24.569-9.373 33.941 0L285.475 239.03c9.373 9.372 9.373 24.568.001 33.941z" /> | ||
</svg> | ||
<a href="javascript:void;" class="text-gray-500" aria-current="page">{{ \App\Models\Document::find($documentId)->name }}</a> | ||
</li> | ||
@endif | ||
</ol> | ||
</nav> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters