Merge pull request #2969 from cpradio/pr-add-category-to-group-posts
FEATURE: Add category to Group Post Listing
This commit is contained in:
commit
0b0cee4e07
|
@ -7,6 +7,7 @@
|
|||
<span class="title">
|
||||
<a href="{{unbound url}}">{{unbound title}}</a>
|
||||
</span>
|
||||
<span class="category">{{category-link category}}</span>
|
||||
{{#if byName}}
|
||||
<span class="name">
|
||||
{{unbound byName}}
|
||||
|
|
|
@ -452,12 +452,13 @@
|
|||
text-overflow: ellipsis;
|
||||
}
|
||||
.name {
|
||||
display: block;
|
||||
display: inline-block;
|
||||
font-size: 14px;
|
||||
max-width: 400px;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
vertical-align: middle;
|
||||
}
|
||||
.edit-reason {
|
||||
background-color: scale-color($highlight, $lightness: 25%);
|
||||
|
|
|
@ -459,12 +459,13 @@
|
|||
text-overflow: ellipsis;
|
||||
}
|
||||
.name {
|
||||
display: block;
|
||||
display: inline-block;
|
||||
font-size: 14px;
|
||||
max-width: 400px;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
vertical-align: middle;
|
||||
}
|
||||
.edit-reason {
|
||||
background-color: scale-color($highlight, $lightness: 25%);
|
||||
|
|
|
@ -38,7 +38,7 @@ class Group < ActiveRecord::Base
|
|||
|
||||
def posts_for(guardian, before_post_id=nil)
|
||||
user_ids = group_users.map {|gu| gu.user_id}
|
||||
result = Post.where(user_id: user_ids).includes(:user, :topic).references(:posts, :topics)
|
||||
result = Post.where(user_id: user_ids).includes(:user, :topic, :topic => :category).references(:posts, :topics, :category)
|
||||
.where('topics.archetype <> ?', Archetype.private_message)
|
||||
.where(post_type: Post.types[:regular])
|
||||
|
||||
|
|
|
@ -5,7 +5,8 @@ class GroupPostSerializer < ApplicationSerializer
|
|||
:title,
|
||||
:url,
|
||||
:user_title,
|
||||
:user_long_name
|
||||
:user_long_name,
|
||||
:category
|
||||
|
||||
has_one :user, serializer: BasicUserSerializer, embed: :objects
|
||||
|
||||
|
@ -24,5 +25,9 @@ class GroupPostSerializer < ApplicationSerializer
|
|||
def include_user_long_name?
|
||||
SiteSetting.enable_names?
|
||||
end
|
||||
|
||||
def category
|
||||
object.topic.category
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue