diff --git a/app/Actions/Tag.php b/app/Actions/Tag.php
index 5968ffe6d..f73b2ed2d 100644
--- a/app/Actions/Tag.php
+++ b/app/Actions/Tag.php
@@ -1,6 +1,7 @@
morphTo('entity');
}
+
+ /**
+ * Get a full URL to start a tag name search for this tag name.
+ */
+ public function nameUrl(): string
+ {
+ return url('/search?term=%5B' . urlencode($this->name) .'%5D');
+ }
+
+ /**
+ * Get a full URL to start a tag name and value search for this tag's values.
+ */
+ public function valueUrl(): string
+ {
+ return url('/search?term=%5B' . urlencode($this->name) .'%3D' . urlencode($this->value) . '%5D');
+ }
}
diff --git a/resources/icons/tag.svg b/resources/icons/tag.svg
index 73e328cee..1d92d2b18 100644
--- a/resources/icons/tag.svg
+++ b/resources/icons/tag.svg
@@ -1,4 +1 @@
-
-
-
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/resources/sass/_blocks.scss b/resources/sass/_blocks.scss
index a17d74443..1ee4e0709 100644
--- a/resources/sass/_blocks.scss
+++ b/resources/sass/_blocks.scss
@@ -224,12 +224,13 @@
margin-bottom: $-xs;
margin-inline-end: $-xs;
border-radius: 4px;
- border: 1px solid #CCC;
+ border: 1px solid;
overflow: hidden;
font-size: 0.85em;
+ @include lightDark(border-color, #CCC, #666);
a, span, a:hover, a:active {
padding: 4px 8px;
- @include lightDark(color, #777, #999);
+ @include lightDark(color, rgba(0, 0, 0, 0.6), rgba(255, 255, 255, 0.8));
transition: background-color ease-in-out 80ms;
text-decoration: none;
}
@@ -237,10 +238,11 @@
@include lightDark(background-color, rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0.3));
}
svg {
- fill: #888;
+ @include lightDark(fill, rgba(0, 0, 0, 0.5), rgba(255, 255, 255, 0.5));
}
.tag-value {
- border-inline-start: 1px solid #DDD;
+ border-inline-start: 1px solid;
+ @include lightDark(border-color, #DDD, #666);
@include lightDark(background-color, rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0.2))
}
}
diff --git a/resources/sass/_lists.scss b/resources/sass/_lists.scss
index d6ea66350..0bef608a7 100644
--- a/resources/sass/_lists.scss
+++ b/resources/sass/_lists.scss
@@ -550,6 +550,17 @@ ul.pagination {
}
}
+.entity-item-tags {
+ font-size: .75rem;
+ opacity: 1;
+ .primary-background-light {
+ background: transparent;
+ }
+ .tag-name {
+ background-color: rgba(0, 0, 0, 0.05);
+ }
+}
+
.dropdown-container {
display: inline-block;
vertical-align: top;
diff --git a/resources/views/components/tag-list.blade.php b/resources/views/components/tag-list.blade.php
index f12433ca3..ffbd5c330 100644
--- a/resources/views/components/tag-list.blade.php
+++ b/resources/views/components/tag-list.blade.php
@@ -1,11 +1,11 @@
@foreach($entity->tags as $tag)
- @if($disableLinks ?? false)
+ @if($linked ?? true)
+
+ @if($tag->value)
@endif
+ @else
@icon('tag'){{ $tag->name }}
@if($tag->value)
{{$tag->value}}
@endif
- @else
-
- @if($tag->value)
@endif
@endif
@endforeach
\ No newline at end of file
diff --git a/resources/views/partials/entity-list-item-basic.blade.php b/resources/views/partials/entity-list-item-basic.blade.php
index 8bc14bfb8..2ec4bee5c 100644
--- a/resources/views/partials/entity-list-item-basic.blade.php
+++ b/resources/views/partials/entity-list-item-basic.blade.php
@@ -2,9 +2,6 @@
@icon($type)
- @if($entity->tags->count() > 0 and $showTags ?? false)
- @include('components.tag-list', ['entity' => $entity, 'disableLinks' => True ])
- @endif
{{ $entity->name }}
{{ $slot ?? '' }}
diff --git a/resources/views/partials/entity-list-item.blade.php b/resources/views/partials/entity-list-item.blade.php
index 7a84c2263..d605953c7 100644
--- a/resources/views/partials/entity-list-item.blade.php
+++ b/resources/views/partials/entity-list-item.blade.php
@@ -1,4 +1,5 @@
-@component('partials.entity-list-item-basic', ['entity' => $entity, 'showTags' => $showTags])
+@component('partials.entity-list-item-basic', ['entity' => $entity])
+
@if($showPath ?? false)
@@ -12,4 +13,11 @@
{{ $entity->getExcerpt() }}
+
+@if(($showTags ?? false) && $entity->tags->count() > 0)
+
+ @include('components.tag-list', ['entity' => $entity, 'linked' => false ])
+
+@endif
+
@endcomponent
\ No newline at end of file
diff --git a/tests/Entity/TagTest.php b/tests/Entity/TagTest.php
index 3ad10641e..b1217f959 100644
--- a/tests/Entity/TagTest.php
+++ b/tests/Entity/TagTest.php
@@ -1,28 +1,23 @@
defaultTagCount)->make();
}
@@ -68,8 +63,6 @@ class TagTest extends BrowserKitTest
public function test_entity_permissions_effect_tag_suggestions()
{
- $permissionService = $this->app->make(PermissionService::class);
-
// Create some tags with similar names to test with and save to a page
$attrs = collect();
$attrs = $attrs->merge(factory(Tag::class, 5)->make(['name' => 'country']));
@@ -88,4 +81,20 @@ class TagTest extends BrowserKitTest
$this->asEditor()->get('/ajax/tags/suggest/names?search=co')->seeJsonEquals([]);
}
+ public function test_tags_shown_on_search_listing()
+ {
+ $tags = [
+ factory(Tag::class)->make(['name' => 'category', 'value' => 'buckets']),
+ factory(Tag::class)->make(['name' => 'color', 'value' => 'red']),
+ ];
+
+ $page = $this->getEntityWithTags(Page::class, $tags);
+ $resp = $this->asEditor()->get("/search?term=[category]");
+ $resp->assertSee($page->name);
+ $resp->assertElementContains('[href="' . $page->getUrl() . '"]', 'category');
+ $resp->assertElementContains('[href="' . $page->getUrl() . '"]', 'buckets');
+ $resp->assertElementContains('[href="' . $page->getUrl() . '"]', 'color');
+ $resp->assertElementContains('[href="' . $page->getUrl() . '"]', 'red');
+ }
+
}