diff --git a/css/zoostyle.css b/css/zoostyle.css index 507fcf3f..f39a0b07 100644 --- a/css/zoostyle.css +++ b/css/zoostyle.css @@ -1486,6 +1486,7 @@ a:hover.copy { } .album-info.with-thumb { max-width: calc(100% - 140px); + padding-bottom: 0; } .album-thumb { @@ -1501,6 +1502,39 @@ a:hover.copy { object-position: center 10%; } +.album-hashtag-area { + padding-top: 15px; + max-width: 400px; +} + +.with-thumb .album-hashtag-area { + height: 60px; + vertical-align: bottom; +} + +.album-hashtag { + border-radius: 6px; + border: 1px solid #333; + padding: 2px 8px; + margin-right: 2px; + line-height: 2; +} +.album-hashtag.palette-0 { + background-color: #bdd0c4; +} +.album-hashtag.palette-1 { + background-color: #bad7f3; +} +.album-hashtag.palette-2 { + background-color: #ffd6a5; +} +.album-hashtag.palette-3 { + background-color: #f7e1d3; +} +.album-hashtag.palette-4 { + background-color: #dfccf1; +} + div.toggle-time-entry { position: relative; float: right; diff --git a/engine/impl/Library.php b/engine/impl/Library.php index 77d15f32..a00ae0f3 100644 --- a/engine/impl/Library.php +++ b/engine/impl/Library.php @@ -91,7 +91,7 @@ class LibraryImpl extends DBO implements ILibrary { "FROM reviews r " . "LEFT JOIN albumvol av ON r.tag = av.tag " . "LEFT JOIN airnames an ON r.airname = an.id " . - "WHERE private = 0 AND r.airname IS NOT NULL AND " . + "WHERE private = 0 AND " . "MATCH (review) AGAINST(? IN BOOLEAN MODE) " . "ORDER BY r.created DESC" ], [ "tracks", "albumrec", "tracknames", "track", diff --git a/ui/Search.php b/ui/Search.php index 44601116..303bf3a5 100644 --- a/ui/Search.php +++ b/ui/Search.php @@ -127,6 +127,17 @@ public function searchByAlbumKey($key = null) { $reviews = Engine::api(IReview::class)->getReviews($tag, 1, "", $loggedIn); $this->addVar("reviews", $reviews); + // hashtags + $hashtags = array_reduce($reviews, function($carry, $review) { + return preg_match_all('/#[\pL_]+/', $review['review'], $matches) ? + array_merge($carry, $matches[0]) : $carry; + }, []); + $hashtags = array_unique(array_map('strtolower', $hashtags)); + $index = array_map(function($tag) { + return hexdec(hash('crc32', $tag)) % 5; + }, $hashtags); + $this->addVar("hashtags", array_combine($hashtags, $index)); + // tracks $tracks = $libraryApi->search($albums[0]['iscoll'] ? ILibrary::COLL_KEY : ILibrary::TRACK_KEY, 0, 200, $tag); diff --git a/ui/templates/default/album/info.html b/ui/templates/default/album/info.html index ab8ad5cc..041493bf 100644 --- a/ui/templates/default/album/info.html +++ b/ui/templates/default/album/info.html @@ -67,5 +67,12 @@ Write a review of this album {% endif ~%} +{% if hashtags | length %} +