From c1996a415f2786a16ff710a8b663e2749c69ad1e Mon Sep 17 00:00:00 2001 From: Marley Rae Date: Sat, 23 Apr 2022 19:53:35 -0700 Subject: [PATCH] no --- app/Traits/Categorizable.php | 18 ++++++++++++++++++ public/css/admin/style.css | 14 +++++++++++++- resources/sass/admin/_base.scss | 2 +- resources/sass/admin/_states.scss | 3 +++ resources/views/admin/joined/index.blade.php | 13 +++++++++++-- 5 files changed, 46 insertions(+), 4 deletions(-) diff --git a/app/Traits/Categorizable.php b/app/Traits/Categorizable.php index f978bcf..6fd0fc7 100644 --- a/app/Traits/Categorizable.php +++ b/app/Traits/Categorizable.php @@ -6,8 +6,26 @@ trait Categorizable { +/* ---------------------------------------------------------------------------- relationship ---- */ + public function categories() { 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, ', '); + } } diff --git a/public/css/admin/style.css b/public/css/admin/style.css index 2ec23b7..fa7daa2 100644 --- a/public/css/admin/style.css +++ b/public/css/admin/style.css @@ -232,7 +232,7 @@ .table__thead th { .table__tbody td { text-align: center; - padding: 5px; + padding: 5px 10px; } .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) { border-right: none; } + +.text--error { + color: #e20000; +} + +.text--warning { + color: #ebb000; +} + +.text--success { + color: #30be00; +} diff --git a/resources/sass/admin/_base.scss b/resources/sass/admin/_base.scss index 76b06ad..27e8ac2 100644 --- a/resources/sass/admin/_base.scss +++ b/resources/sass/admin/_base.scss @@ -153,7 +153,7 @@ h1 { .table__tbody td { text-align: center; - padding: 5px; + padding: 5px 10px; } .table__tbody img { diff --git a/resources/sass/admin/_states.scss b/resources/sass/admin/_states.scss index 6aedf29..35df9d7 100644 --- a/resources/sass/admin/_states.scss +++ b/resources/sass/admin/_states.scss @@ -1,2 +1,5 @@ @use 'vars' as *; +.text--error { color: $c-red; } +.text--warning { color: $c-yellow; } +.text--success { color: $c-green; } \ No newline at end of file diff --git a/resources/views/admin/joined/index.blade.php b/resources/views/admin/joined/index.blade.php index ffb4d49..d79c098 100644 --- a/resources/views/admin/joined/index.blade.php +++ b/resources/views/admin/joined/index.blade.php @@ -7,6 +7,8 @@ @section('pg-title', 'Joined') @section('content') +@inject('Category', 'App\Models\Category') + @@ -21,10 +23,17 @@ @foreach ($joined as $fl) - + - + + + + @endforeach
+ @if (!$fl->approved) + × + @endif + {{ $fl->subject }}{{ $fl->listCategories() }}