This commit is contained in:
Marley Rae 2022-04-23 19:53:35 -07:00
parent 12e4a700a7
commit c1996a415f
5 changed files with 46 additions and 4 deletions

View file

@ -6,8 +6,26 @@
trait Categorizable trait Categorizable
{ {
/* ---------------------------------------------------------------------------- relationship ---- */
public function categories() public function categories()
{ {
return $this->morphToMany(Category::class, 'categorizable'); return $this->morphToMany(Category::class, 'categorizable');
} }
/* -------------------------------------------------------------------------- listCategories ---- */
public function listCategories() : string
{
$cats = $this->categories;
$str = '';
if ($cats->isNotEmpty()) {
foreach ($cats as $cat) {
$str .= "$cat->name, ";
}
}
return rtrim($str, ', ');
}
} }

View file

@ -232,7 +232,7 @@ .table__thead th {
.table__tbody td { .table__tbody td {
text-align: center; text-align: center;
padding: 5px; padding: 5px 10px;
} }
.table__tbody img { .table__tbody img {
@ -350,3 +350,15 @@ .pagination__item, .pagination__item--disabled, .pagination__item--active {
.pagination__item:not(:last-child), .pagination__item--disabled:not(:last-child), .pagination__item--active:not(:last-child) { .pagination__item:not(:last-child), .pagination__item--disabled:not(:last-child), .pagination__item--active:not(:last-child) {
border-right: none; border-right: none;
} }
.text--error {
color: #e20000;
}
.text--warning {
color: #ebb000;
}
.text--success {
color: #30be00;
}

View file

@ -153,7 +153,7 @@ h1 {
.table__tbody td { .table__tbody td {
text-align: center; text-align: center;
padding: 5px; padding: 5px 10px;
} }
.table__tbody img { .table__tbody img {

View file

@ -1,2 +1,5 @@
@use 'vars' as *; @use 'vars' as *;
.text--error { color: $c-red; }
.text--warning { color: $c-yellow; }
.text--success { color: $c-green; }

View file

@ -7,6 +7,8 @@
@section('pg-title', 'Joined') @section('pg-title', 'Joined')
@section('content') @section('content')
@inject('Category', 'App\Models\Category')
<table class="table"> <table class="table">
<thead class="table__thead"> <thead class="table__thead">
<tr> <tr>
@ -21,10 +23,17 @@
<tbody class="table__tbody"> <tbody class="table__tbody">
@foreach ($joined as $fl) @foreach ($joined as $fl)
<tr> <tr>
<td></td> <td>
@if (!$fl->approved)
<span class="text--error">&times;</span>
@endif
</td>
<td><a href="{{ $fl->url }}" target="_blank">{{ $fl->subject }}</a></td> <td><a href="{{ $fl->url }}" target="_blank">{{ $fl->subject }}</a></td>
<td></td> <td>{{ $fl->listCategories() }}</td>
<td><img src="{{ $fl->image }}"></td> <td><img src="{{ $fl->image }}"></td>
<td></td>
<td></td>
<td></td>
</tr> </tr>
@endforeach @endforeach
</tbody> </tbody>