mirror of
https://github.com/discourse/discourse.git
synced 2025-03-06 11:19:51 +00: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);
|
return this.urlForPostNumber(1);
|
||||||
}.property('url'),
|
}.property('url'),
|
||||||
|
|
||||||
|
summaryUrl: function () {
|
||||||
|
return this.urlForPostNumber(1) + (this.get('has_summary') ? "?filter=summary" : "");
|
||||||
|
}.property('url'),
|
||||||
|
|
||||||
lastPosterUrl: function() {
|
lastPosterUrl: function() {
|
||||||
return Discourse.getURL("/users/") + this.get("last_poster.username");
|
return Discourse.getURL("/users/") + this.get("last_poster.username");
|
||||||
}.property('last_poster'),
|
}.property('last_poster'),
|
||||||
|
@ -14,5 +14,8 @@
|
|||||||
{{#if showParticipants}}
|
{{#if showParticipants}}
|
||||||
{{raw "components/topic-list-header-column" order='participants' name='users'}}
|
{{raw "components/topic-list-header-column" order='participants' name='users'}}
|
||||||
{{/if}}
|
{{/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='views' name='views'}}
|
||||||
{{raw "components/topic-list-header-column" sortable=sortable number='true' order='activity' name='activity'}}
|
{{raw "components/topic-list-header-column" sortable=sortable number='true' order='activity' name='activity'}}
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
toggleInTitle=toggleInTitle
|
toggleInTitle=toggleInTitle
|
||||||
hideCategory=hideCategory
|
hideCategory=hideCategory
|
||||||
showPosters=showPosters
|
showPosters=showPosters
|
||||||
|
showLikes=showLikes
|
||||||
showParticipants=showParticipants
|
showParticipants=showParticipants
|
||||||
order=order
|
order=order
|
||||||
ascending=ascending
|
ascending=ascending
|
||||||
|
@ -29,6 +29,15 @@
|
|||||||
{{raw "list/posters-column" posters=topic.participants}}
|
{{raw "list/posters-column" posters=topic.participants}}
|
||||||
{{/if}}
|
{{/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>
|
<td class="num views {{topic.viewsHeat}}">{{number topic.views numberKey="views_long"}}</td>
|
||||||
|
|
||||||
{{raw "list/activity-column" topic=topic class="num" tagName="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"),
|
topic: Em.computed.alias("content"),
|
||||||
|
|
||||||
|
hasLikes: function(){
|
||||||
|
return this.get('topic.like_count') > 0;
|
||||||
|
},
|
||||||
|
|
||||||
click: function(e){
|
click: function(e){
|
||||||
var target = $(e.target);
|
var target = $(e.target);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user