mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-27 17:46:05 -05:00
Use heat map on views column in topic lists
This commit is contained in:
parent
631ed3df58
commit
72508d459b
4 changed files with 18 additions and 1 deletions
|
@ -117,6 +117,14 @@ Discourse.Topic = Discourse.Model.extend({
|
|||
return null;
|
||||
}).property('age', 'created_at'),
|
||||
|
||||
viewsHeat: function() {
|
||||
var v = this.get('views');
|
||||
if( v >= Discourse.SiteSettings.topic_views_heat_high ) return 'heatmap-high';
|
||||
if( v >= Discourse.SiteSettings.topic_views_heat_medium ) return 'heatmap-med';
|
||||
if( v >= Discourse.SiteSettings.topic_views_heat_low ) return 'heatmap-low';
|
||||
return null;
|
||||
}.property('views'),
|
||||
|
||||
archetypeObject: (function() {
|
||||
return Discourse.get('site.archetypes').findProperty('id', this.get('archetype'));
|
||||
}).property('archetype'),
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
{{/if}}
|
||||
</td>
|
||||
|
||||
<td class='num'>{{number views numberKey="views_long"}}</td>
|
||||
<td {{bindAttr class=":num viewsHeat"}}>{{number views numberKey="views_long"}}</td>
|
||||
|
||||
{{#if bumped}}
|
||||
<td class='num activity'>
|
||||
|
|
|
@ -180,6 +180,11 @@ class SiteSetting < ActiveRecord::Base
|
|||
|
||||
setting(:max_similar_results, 7)
|
||||
|
||||
# Settings for topic heat
|
||||
client_setting(:topic_views_heat_low, 1000)
|
||||
client_setting(:topic_views_heat_medium, 2000)
|
||||
client_setting(:topic_views_heat_high, 5000)
|
||||
|
||||
def self.generate_api_key!
|
||||
self.api_key = SecureRandom.hex(32)
|
||||
end
|
||||
|
|
|
@ -533,6 +533,10 @@ en:
|
|||
|
||||
title_prettify: "Prevent common title typos and errors, including all caps, lowercase first character, multiple ! and ?, extra . at end, etc."
|
||||
|
||||
topic_views_heat_low: "The number of views after which a topic's heat level is low."
|
||||
topic_views_heat_medium: "The number of views after which a topic's heat level is medium."
|
||||
topic_views_heat_high: "The number of views after which a topic's heat level is high."
|
||||
|
||||
notification_types:
|
||||
mentioned: "%{display_username} mentioned you in %{link}"
|
||||
liked: "%{display_username} liked your post in %{link}"
|
||||
|
|
Loading…
Reference in a new issue