mirror of
https://github.com/discourse/discourse.git
synced 2025-02-20 11:48:26 -06:00
Support likes column via site extension
This commit is contained in:
parent
69771562d7
commit
d0d2a15180
@ -95,6 +95,10 @@ Discourse.Topic = Discourse.Model.extend({
|
||||
return this.urlForPostNumber(1);
|
||||
}.property('url'),
|
||||
|
||||
summaryUrl: function () {
|
||||
return this.urlForPostNumber(1) + (this.get('has_summary') ? "?filter=summary" : "");
|
||||
}.property('url'),
|
||||
|
||||
lastPosterUrl: function() {
|
||||
return Discourse.getURL("/users/") + this.get("last_poster.username");
|
||||
}.property('last_poster'),
|
||||
|
@ -14,5 +14,8 @@
|
||||
{{#if showParticipants}}
|
||||
{{raw "components/topic-list-header-column" order='participants' name='users'}}
|
||||
{{/if}}
|
||||
{{#if showLikes}}
|
||||
{{raw "components/topic-list-header-column" sortable=sortable number='true' order='likes' name='likes'}}
|
||||
{{/if}}
|
||||
{{raw "components/topic-list-header-column" sortable=sortable number='true' order='views' name='views'}}
|
||||
{{raw "components/topic-list-header-column" sortable=sortable number='true' order='activity' name='activity'}}
|
||||
|
@ -6,6 +6,7 @@
|
||||
toggleInTitle=toggleInTitle
|
||||
hideCategory=hideCategory
|
||||
showPosters=showPosters
|
||||
showLikes=showLikes
|
||||
showParticipants=showParticipants
|
||||
order=order
|
||||
ascending=ascending
|
||||
|
@ -29,6 +29,15 @@
|
||||
{{raw "list/posters-column" posters=topic.participants}}
|
||||
{{/if}}
|
||||
|
||||
{{#if controller.showLikes}}
|
||||
<td class="num likes">
|
||||
{{#if hasLikes}}
|
||||
<a href='{{topic.summaryUrl}}'>
|
||||
{{number topic.like_count}} <i class='fa fa-heart'></i></td>
|
||||
</a>
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
|
||||
<td class="num views {{topic.viewsHeat}}">{{number topic.views numberKey="views_long"}}</td>
|
||||
|
||||
{{raw "list/activity-column" topic=topic class="num" tagName="td"}}
|
||||
|
@ -14,6 +14,10 @@ export default Discourse.View.extend(StringBuffer, {
|
||||
|
||||
topic: Em.computed.alias("content"),
|
||||
|
||||
hasLikes: function(){
|
||||
return this.get('topic.like_count') > 0;
|
||||
},
|
||||
|
||||
click: function(e){
|
||||
var target = $(e.target);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user