Skip to content

Commit 434e709

Browse files
committed
Updated to use nodebb-plugin-emoji
1 parent 03de3a2 commit 434e709

5 files changed

Lines changed: 24 additions & 20 deletions

File tree

less/reactions.less

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,16 @@
1313
margin: 0 1px;
1414
cursor: pointer;
1515

16+
.emoji {
17+
height: 18px;
18+
}
19+
1620
&.reacted {
1721
border: 1px solid @primary-color;
1822
}
1923

2024
.reaction-emoji-count {
21-
font-size: 12px;
22-
padding: 0 2px;
23-
color: #777;
25+
margin-left: 5px;
2426

2527
&:before {
2628
content: attr(data-count);

lib/client.js

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
"use strict";
22

3-
/*globals $, app, utils, socket, templates, config*/
3+
/*globals $, app, utils, socket, config*/
44

55
$(document).ready(function () {
66

7-
var env = utils.findBootstrapEnvironment();
87
setupPostReactions();
98

109
function setupPostReactions() {
@@ -87,21 +86,24 @@ $(document).ready(function () {
8786
}
8887

8988
if (reactionEl.length === 0) {
90-
templates.parse('partials/topic/reaction', {
91-
"posts": {
92-
"pid": data.pid,
93-
"reactions": {
89+
require(['benchpress'], function (Benchpress) {
90+
Benchpress.parse('partials/topic/reaction', {
91+
"posts": {
9492
"pid": data.pid,
95-
"reaction": data.reaction,
96-
"memberCount": data.reactionCount,
97-
"usernames": data.usernames,
98-
"reacted": (parseInt(data.uid, 10) === app.user.uid),
99-
"reactionImage": data.reactionImage
93+
"reactions": {
94+
"pid": data.pid,
95+
"reaction": data.reaction,
96+
"memberCount": data.reactionCount,
97+
"usernames": data.usernames,
98+
"reacted": (parseInt(data.uid, 10) === app.user.uid),
99+
"reactionImage": data.reactionImage
100+
}
100101
}
101-
}
102-
}, function (html) {
103-
$('[component="post/reactions"][data-pid="' + data.pid + '"]').append(html);
102+
}, function (html) {
103+
$('[component="post/reactions"][data-pid="' + data.pid + '"]').append(html);
104+
});
104105
});
106+
window.templates
105107
} else {
106108
reactionEl.find(".reaction-emoji-count").attr("data-count", data.reactionCount);
107109
reactionEl.attr("data-original-title", data.usernames);

library.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ reactions.getReactions = function (data, callback) {
199199

200200
var reactionImage = parse(reaction.reaction);
201201
var reacted = reaction.reacted ? 'reacted' : '';
202-
reactionInfo = reactionInfo + '<span class="reaction ' + reacted + '" component="post/reaction" data-pid="' + post.pid + '" data-reaction="' + reaction.reaction + '" title="' + usernames + '">' + reactionImage + '<span class="reaction-emoji-count" data-count="' + reaction.memberCount + '"></span></span>';
202+
reactionInfo = reactionInfo + '<span class="reaction ' + reacted + '" component="post/reaction" data-pid="' + post.pid + '" data-reaction="' + reaction.reaction + '" title="' + usernames + '">' + reactionImage + '<small class="reaction-emoji-count" data-count="' + reaction.memberCount + '"></small></span>';
203203
});
204204

205205
post.reactions = reactionInfo + '</span>';

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "nodebb-plugin-reactions",
33
"version": "0.0.3",
44
"nbbpm": {
5-
"compatibility": "^1.4.0"
5+
"compatibility": "^1.10.0"
66
},
77
"description": "Reactions plugin for NodeBB",
88
"main": "library.js",
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
<span class="reaction <!-- IF posts.reactions.reacted -->reacted<!-- ENDIF posts.reactions.reacted -->" component="post/reaction" data-pid="{posts.pid}" data-reaction="{posts.reactions.reaction}" title="{posts.reactions.usernames}">
22
{posts.reactions.reactionImage}
3-
<span class="reaction-emoji-count" data-count="{posts.reactions.memberCount}"></span>
3+
<small class="reaction-emoji-count" data-count="{posts.reactions.memberCount}"></small>
44
</span>

0 commit comments

Comments
 (0)