1
0
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:
Toby Zerner
2017-12-27 07:09:40 +10:30
4 changed files with 22 additions and 3 deletions

View File

@@ -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) {

View File

@@ -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) {

View File

@@ -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);
}
}

View File

@@ -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();
}
}