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 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
- ![](https://i.imgur.com/2fPnWLb.png)
19
-
20
- ## Todo
21
-
22
- - Add the ability to edit a poll
23
- - Anonymous voting
24
- - A lot more...
25
-
26
- If you're willing to help, please make any improvements you want and submit a PR.
27
-
28
- ## Installation
29
-
30
- Either through the NodeBB ACP or:
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
+ ![](https://i.imgur.com/2fPnWLb.png)
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nodebb-plugin-poll",
3
- "version": "3.2.8",
3
+ "version": "3.2.9",
4
4
  "description": "NodeBB Poll Plugin",
5
5
  "main": "library.js",
6
6
  "scripts": {
@@ -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
- <label>
5
- <input type="{poll.optionType}" name="pollVoteSelection" value="{poll.options.id}">
6
- {poll.options.title}
7
- </label>
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>