mirror of
https://github.com/vale981/Vulcan
synced 2025-03-07 02:21:43 -05:00
fix voting icon bug
This commit is contained in:
parent
9f434c399d
commit
30ca584109
3 changed files with 17 additions and 11 deletions
|
@ -1,6 +1,6 @@
|
|||
<template name="postUpvote">
|
||||
<div class="post-rank"><span>{{oneBasedRank}}</span></div>
|
||||
{{#if voted}}
|
||||
{{#if upvoted}}
|
||||
<span class="upvote-link voted"><i class="icon-check"></i><span>{{i18n "Upvote"}}</span></span>
|
||||
{{else}}
|
||||
<a class="upvote-link not-voted" href="#"><i class="icon-up"></i><span>{{i18n "Upvote"}}</span></a>
|
||||
|
|
|
@ -1,4 +1,9 @@
|
|||
Template[getTemplate('postUpvote')].helpers({
|
||||
upvoted: function(){
|
||||
var user = Meteor.user();
|
||||
if(!user) return false;
|
||||
return _.include(this.upvoters, user._id);
|
||||
},
|
||||
oneBasedRank: function(){
|
||||
if(typeof this.rank !== 'undefined')
|
||||
return this.rank + 1;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
var filteredModules = function (positions) {
|
||||
return _.filter(postModules, function(module){return _.contains(positions, module.position)});
|
||||
var filteredModules = function (group) {
|
||||
// return the modules whose positions start with group
|
||||
return _.filter(postModules, function(module){return module.position.indexOf(group) == 0});
|
||||
}
|
||||
|
||||
var post = {};
|
||||
|
@ -10,19 +11,19 @@ Template[getTemplate('post_item')].created = function () {
|
|||
|
||||
Template[getTemplate('post_item')].helpers({
|
||||
leftPostModules: function () {
|
||||
return filteredModules(['left-left', 'left-center', 'left-right']);
|
||||
return filteredModules('left');
|
||||
},
|
||||
centerPostModules: function () {
|
||||
return filteredModules(['center-left', 'center-center', 'center-right']);
|
||||
return filteredModules('center');
|
||||
},
|
||||
rightPostModules: function () {
|
||||
return filteredModules(['right-left', 'right-center', 'right-right']);
|
||||
return filteredModules('right');
|
||||
},
|
||||
moduleContext: function () {
|
||||
var moduleContext = _.extend(this, post);
|
||||
moduleContext.templateClass = camelToDash(moduleContext.template);
|
||||
moduleContext._id = null;
|
||||
return moduleContext;
|
||||
moduleContext: function () { // not used for now
|
||||
var module = this;
|
||||
module.templateClass = camelToDash(this.template) + ' ' + this.position + ' cell';
|
||||
module.post = post;
|
||||
return module;
|
||||
},
|
||||
moduleClass: function () {
|
||||
return camelToDash(this.template) + ' ' + this.position + ' cell';
|
||||
|
|
Loading…
Add table
Reference in a new issue