FEATURE: Show number of accepted answers on user card (#154)
This commit is contained in:
parent
184d2e6137
commit
fafa1c22b0
|
@ -0,0 +1,6 @@
|
||||||
|
{{#if user.accepted_answers}}
|
||||||
|
<h3>
|
||||||
|
<span class="desc">{{i18n "solutions"}}</span>
|
||||||
|
{{user.accepted_answers}}
|
||||||
|
</h3>
|
||||||
|
{{/if}}
|
|
@ -70,3 +70,7 @@ $solved-color: green;
|
||||||
aside.quote .title.title-only {
|
aside.quote .title.title-only {
|
||||||
padding: 12px;
|
padding: 12px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.user-card-metadata-outlet.accepted-answers {
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
|
|
@ -687,6 +687,14 @@ SQL
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
add_to_serializer(:user_card, :accepted_answers) do
|
||||||
|
Post
|
||||||
|
.where(user: User.find_by_username('bar3'))
|
||||||
|
.joins(:_custom_fields)
|
||||||
|
.where(_custom_fields: { name: 'is_accepted_answer', value: 'true' })
|
||||||
|
.count
|
||||||
|
end
|
||||||
|
|
||||||
class ::Topic
|
class ::Topic
|
||||||
attr_accessor :accepted_answer_user_id
|
attr_accessor :accepted_answer_user_id
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue