nodebb-plugin-poll 3.2.8 → 3.2.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +31 -32
- package/lib/hooks.js +1 -0
- package/package.json +1 -1
- package/public/js/poll/creator.js +0 -7
- package/templates/poll/view/voting.tpl +4 -4
package/README.md
CHANGED
|
@@ -1,32 +1,31 @@
|
|
|
1
|
-
# NodeBB Poll plugin
|
|
2
|
-
|
|
3
|
-
This NodeBB plugin will allow you to add polls to the first post of a topic with the following markup:
|
|
4
|
-
|
|
5
|
-
[poll <settings>]
|
|
6
|
-
- Poll option
|
|
7
|
-
- Another option
|
|
8
|
-
[/poll]
|
|
9
|
-
|
|
10
|
-
Currently supported settings:
|
|
11
|
-
|
|
12
|
-
maxvotes="1" //Max number of votes per user. If larger than 1, a multiple choice poll will be created
|
|
13
|
-
disallowVoteUpdate="0" //if set, users won't be able to update/remove their vote
|
|
14
|
-
allowAnonVoting="0" // if set to 1, users will be able to vote anonymously
|
|
15
|
-
title="Poll title" //Poll title
|
|
16
|
-
|
|
17
|
-
There's also a helpful modal available that will allow you to easily create a poll:
|
|
18
|
-

|
|
19
|
-
|
|
20
|
-
## Todo
|
|
21
|
-
|
|
22
|
-
- Add the ability to edit a poll
|
|
23
|
-
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
npm install nodebb-plugin-poll
|
|
1
|
+
# NodeBB Poll plugin
|
|
2
|
+
|
|
3
|
+
This NodeBB plugin will allow you to add polls to the first post of a topic with the following markup:
|
|
4
|
+
|
|
5
|
+
[poll <settings>]
|
|
6
|
+
- Poll option
|
|
7
|
+
- Another option
|
|
8
|
+
[/poll]
|
|
9
|
+
|
|
10
|
+
Currently supported settings:
|
|
11
|
+
|
|
12
|
+
maxvotes="1" //Max number of votes per user. If larger than 1, a multiple choice poll will be created
|
|
13
|
+
disallowVoteUpdate="0" //if set, users won't be able to update/remove their vote
|
|
14
|
+
allowAnonVoting="0" // if set to 1, users will be able to vote anonymously
|
|
15
|
+
title="Poll title" //Poll title
|
|
16
|
+
|
|
17
|
+
There's also a helpful modal available that will allow you to easily create a poll:
|
|
18
|
+

|
|
19
|
+
|
|
20
|
+
## Todo
|
|
21
|
+
|
|
22
|
+
- Add the ability to edit a poll
|
|
23
|
+
- A lot more...
|
|
24
|
+
|
|
25
|
+
If you're willing to help, please make any improvements you want and submit a PR.
|
|
26
|
+
|
|
27
|
+
## Installation
|
|
28
|
+
|
|
29
|
+
Either through the NodeBB ACP or:
|
|
30
|
+
|
|
31
|
+
npm install nodebb-plugin-poll
|
package/lib/hooks.js
CHANGED
|
@@ -98,6 +98,7 @@ async function canCreate(cid, uid) {
|
|
|
98
98
|
}
|
|
99
99
|
}
|
|
100
100
|
|
|
101
|
+
// called from filter:post.edit and filter:post.create
|
|
101
102
|
async function savePoll(obj) {
|
|
102
103
|
const postobj = obj.post ? obj.post : obj;
|
|
103
104
|
const pollData = Serializer.serialize(postobj.content, Config.settings.get());
|
package/package.json
CHANGED
|
@@ -136,14 +136,12 @@
|
|
|
136
136
|
buttons: {
|
|
137
137
|
cancel: {
|
|
138
138
|
label: '[[modules:bootbox.cancel]]',
|
|
139
|
-
className: 'btn-default',
|
|
140
139
|
callback: function () {
|
|
141
140
|
return true;
|
|
142
141
|
},
|
|
143
142
|
},
|
|
144
143
|
save: {
|
|
145
144
|
label: '[[modules:bootbox.confirm]]',
|
|
146
|
-
className: 'btn-primary',
|
|
147
145
|
callback: function (e) {
|
|
148
146
|
clearErrors();
|
|
149
147
|
var form = $(e.currentTarget).parents('.bootbox').find('#pollCreator');
|
|
@@ -189,11 +187,6 @@
|
|
|
189
187
|
prevOption.clone().val('').insertBefore(el).focus();
|
|
190
188
|
}
|
|
191
189
|
});
|
|
192
|
-
|
|
193
|
-
if (poll.settings && poll.settings.end) {
|
|
194
|
-
|
|
195
|
-
// flatpickrInstance.setDate(poll.settings.end);
|
|
196
|
-
}
|
|
197
190
|
});
|
|
198
191
|
});
|
|
199
192
|
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
<form role="form" class="poll-voting-form mb-3 d-flex flex-column gap-3">
|
|
2
2
|
<!-- BEGIN poll.options -->
|
|
3
3
|
<div class="poll-view-option {poll.optionType}" data-poll-option-id="{poll.options.id}">
|
|
4
|
-
<
|
|
5
|
-
<input type="{poll.optionType}" name="pollVoteSelection" value="{poll.options.id}">
|
|
6
|
-
{poll.options.title}
|
|
7
|
-
</
|
|
4
|
+
<div class="form-check">
|
|
5
|
+
<input class="form-check-input" type="{poll.optionType}" name="pollVoteSelection" value="{poll.options.id}" id="poll-{poll.info.pollId}-option-id-{poll.options.id}">
|
|
6
|
+
<label class="form-check-label" for="poll-{poll.info.pollId}-option-id-{poll.options.id}">{poll.options.title}</label>
|
|
7
|
+
</div>
|
|
8
8
|
</div>
|
|
9
9
|
<!-- END poll.options -->
|
|
10
10
|
</form>
|