By default, users can vote on articles. You can also let them vote on article comments.
Note: The voting links are available by default in standard themes and themes that were customized after the release of the new Community on November 30th, 2015.
Applicable template
- Article
Applicable expression
{{#each comments}}...{{/each}}
Recipe
- Insert the following div tag after the
<li id="{{anchor}}">
tag:<div class="comment-vote vote"> {{vote 'up' class="article-vote-up" selected_class="vote-voted"}} {{vote 'sum' class="article-vote-sum"}} {{vote 'down' class="article-vote-down" selected_class="vote-voted"}} </div>
The vote helpers above borrow the CSS classes for articles votes to style the comment vote links. You can define your own classes to style the comment votes.
Example
{{#each comments}}
<li id="{{anchor}}" class="comment">
<div class="comment-vote vote">
{{vote 'up' class="article-vote-up" selected_class="vote-voted"}}
{{vote 'sum' class="article-vote-sum"}}
{{vote 'down' class="article-vote-down" selected_class="vote-voted"}}
</div>
<div class="comment-avatar {{#if author.agent}} comment-avatar-agent {{/if}}">
<img src="{{author.avatar_url}}" alt="Avatar">
</div>
...
Reference
Comments
0 comments
Please sign in to leave a comment.