Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions src/resources/views/crud/chips/general.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
@php
// the main text showing in the chip
$text = $text ?? null;
$title = $title ?? null;

// the URL for the main text and image (if any)
$url = $url ?? null;
$target = $target ?? "_self";

// the image (if any)
$image = $image ?? null;
$showImage = isset($showImage) ? $showImage : !empty($image);

// the details that show up on the second row (if any)
$details = $details ?? [];
@endphp

<div class="row align-items-center bp-chip">
@if ($showImage)
<div class="col-auto">
<div class="d-block">
@if ($url)
<a href="{{ $url }}" title="{{ $title }}" target="{{ $target }}" class="d-inline-block">
@endif
@if ($image)
<span class="avatar avatar-2 rounded" style="background-image: url({{ $image }})"> </span>
@else
<span class="avatar avatar-2 rounded bg-secondary text-white">
{{ $title ? mb_substr($title, 0, 1, 'UTF-8') : 'A' }}
</span>
@endif
@if ($url)
</a>
@endif
</div>
</div>
@endif
<div class="col text-truncate">
<div class="d-block">
<a @if ($url) href="{{ $url }}" @endif class="mb-1 d-inline-block @if (!$url) text-dark @endif" title="{{ $title }}" target="{{ $target }}">
{{ $text }}
</a>
</div>
<div class="d-block text-secondary text-truncate mt-n1">
@foreach ($details as $key => $detail)
<small class="d-inline-block me-1">
<i class="{{ $detail['icon'] }}" title="{{ $detail['title'] ?? '' }}"></i>
<a @if (isset($detail['url']) && $detail['url'] != null) href="{{ $detail['url'] }}" @endif
class="text-reset"
title="{{ $detail['title'] ?? '' }}">{{ $detail['text'] }}</a>
</small>
@endforeach
</div>
</div>
</div>
17 changes: 17 additions & 0 deletions src/resources/views/crud/widgets/chip.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
@php
// preserve backwards compatibility with Widgets in Backpack 4.0
$widget['wrapper']['class'] = $widget['wrapper']['class'] ?? $widget['wrapperClass'] ?? 'col';
@endphp

@includeWhen(!empty($widget['wrapper']), backpack_view('widgets.inc.wrapper_start'))

@if(!empty($widget['title']))
<h4 class="mt-4 mb-2">{{ $widget['title'] }}</h4>
@endif

<div class="{{ $widget['class'] ?? 'card' }}">
<div class="card-body">
@include($widget['view'], ['entry' => $widget['entry']])
</div>
</div>
@includeWhen(!empty($widget['wrapper']), backpack_view('widgets.inc.wrapper_end'))