mirror of
https://github.com/flarum/core.git
synced 2025-08-21 07:41:49 +02:00
Merge branch 'master' into next-back
This commit is contained in:
8
extensions/tags/js/forum/dist/extension.js
vendored
8
extensions/tags/js/forum/dist/extension.js
vendored
@@ -150,6 +150,14 @@ System.register('flarum/tags/addTagFilter', ['flarum/extend', 'flarum/components
|
||||
return original();
|
||||
});
|
||||
|
||||
extend(IndexPage.prototype, 'view', function (vdom) {
|
||||
var tag = this.currentTag();
|
||||
|
||||
if (tag) {
|
||||
vdom.attrs.className += ' IndexPage--tag' + tag.id();
|
||||
}
|
||||
});
|
||||
|
||||
// If currently viewing a tag, restyle the 'new discussion' button to use
|
||||
// the tag's color.
|
||||
extend(IndexPage.prototype, 'sidebarItems', function (items) {
|
||||
|
@@ -20,6 +20,14 @@ export default function() {
|
||||
return original();
|
||||
});
|
||||
|
||||
extend(IndexPage.prototype, 'view', function(vdom) {
|
||||
const tag = this.currentTag();
|
||||
|
||||
if (tag) {
|
||||
vdom.attrs.className += ' IndexPage--tag'+tag.id();
|
||||
}
|
||||
});
|
||||
|
||||
// If currently viewing a tag, restyle the 'new discussion' button to use
|
||||
// the tag's color.
|
||||
extend(IndexPage.prototype, 'sidebarItems', function(items) {
|
||||
|
@@ -12,7 +12,7 @@
|
||||
namespace Flarum\Tags\Api\Serializer;
|
||||
|
||||
use Flarum\Api\Serializer\AbstractSerializer;
|
||||
use Flarum\Api\Serializer\DiscussionSerializer;
|
||||
use Flarum\Api\Serializer\DiscussionBasicSerializer;
|
||||
|
||||
class TagSerializer extends AbstractSerializer
|
||||
{
|
||||
@@ -64,6 +64,6 @@ class TagSerializer extends AbstractSerializer
|
||||
*/
|
||||
protected function lastDiscussion($tag)
|
||||
{
|
||||
return $this->hasOne($tag, DiscussionSerializer::class);
|
||||
return $this->hasOne($tag, DiscussionBasicSerializer::class);
|
||||
}
|
||||
}
|
||||
|
@@ -68,7 +68,10 @@ class AddForumTagsRelationship
|
||||
// doesn't actually have a tags relationship, we will manually load and
|
||||
// assign the tags data to it using an event listener.
|
||||
if ($event->isController(ShowForumController::class)) {
|
||||
$event->data['tags'] = Tag::whereVisibleTo($event->actor)->withStateFor($event->actor)->with('lastDiscussion')->get();
|
||||
$event->data['tags'] = Tag::whereVisibleTo($event->actor)
|
||||
->withStateFor($event->actor)
|
||||
->with(['parent', 'lastDiscussion'])
|
||||
->get();
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user