Skip to content

Commit

Permalink
feat: Add tags as classes to items (linuxserver#1079)
Browse files Browse the repository at this point in the history
  • Loading branch information
keriati authored Dec 19, 2022
1 parent 9e6321e commit df70dcc
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
17 changes: 17 additions & 0 deletions app/Item.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,23 @@ public function tags()
return $tagdetails;
}

/**
* @return string
*/
public function getTagClass(): string
{
$tags = $this->tags();
$slugs = [];

foreach ($tags as $tag) {
if ($tag->url) {
$slugs[] = 'tag-'.$tag->url;
}
}

return implode(' ', $slugs);
}

/**
* @return BelongsToMany
*/
Expand Down
2 changes: 1 addition & 1 deletion resources/views/item.blade.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<section class="item-container{{ $app->droppable }}" data-name="{{ $app->title }}" data-id="{{ $app->id }}">
<section class="item-container{{ $app->droppable . ' ' . $app->getTagClass()}}" data-name="{{ $app->title }}" data-id="{{ $app->id }}">
<div class="item" style="background-color: {{ $app->colour }}">
<div class="app-icon-container">
@if($app->icon)
Expand Down

0 comments on commit df70dcc

Please sign in to comment.