Added Patreon notification badge for new patreon posts
This commit is contained in:
@@ -51,9 +51,16 @@
|
||||
<iron-icon icon="bug-report" item-icon></iron-icon>
|
||||
Send Feedback
|
||||
</paper-icon-item>
|
||||
<a class="patreon" href="https://www.patreon.com/dicecloud" target="_blank" tabindex="-1">
|
||||
<a class="patreon" href="{{patreonLink}}" target="_blank" tabindex="-1">
|
||||
<paper-icon-item>
|
||||
<iron-icon icon="dicecloud:patreon" item-icon></iron-icon>
|
||||
<iron-icon id="patreon-link-icon" icon="dicecloud:patreon" item-icon></iron-icon>
|
||||
{{#if showPatreonBadge}}
|
||||
<paper-badge
|
||||
icon="av:new-releases"
|
||||
for="patreon-link-icon"
|
||||
label="New post">
|
||||
</paper-badge>
|
||||
{{/if}}
|
||||
Patreon
|
||||
</paper-icon-item>
|
||||
</a>
|
||||
|
||||
@@ -7,6 +7,16 @@ Template.appDrawer.helpers({
|
||||
var user = Meteor.user();
|
||||
return user.profile && user.profile.username || user.username || "My Account";
|
||||
},
|
||||
showPatreonBadge: function(){
|
||||
let post = PatreonPosts.findOne({}, {sort: {date: -1}});
|
||||
let user = Meteor.user();
|
||||
if (!post || !user) return false;
|
||||
return post.link !== user.lastPatreonPostClicked;
|
||||
},
|
||||
patreonLink: function(){
|
||||
let post = PatreonPosts.findOne({}, {sort: {date: -1}});
|
||||
return (post && post.link) || 'https://www.patreon.com/dicecloud';
|
||||
},
|
||||
});
|
||||
|
||||
let drawerLayout;
|
||||
@@ -37,6 +47,9 @@ Template.appDrawer.events({
|
||||
closeDrawer(instance);
|
||||
},
|
||||
"click .patreon": function(event, instance){
|
||||
let post = PatreonPosts.findOne({}, {sort: {date: -1}});
|
||||
let link = (post && post.link) || 'https://www.patreon.com/dicecloud';
|
||||
Meteor.call('clickPatreonPost', link);
|
||||
ga("send", "event", "externalLink", "patreon");
|
||||
},
|
||||
"click .github": function(event, instance){
|
||||
|
||||
Reference in New Issue
Block a user