nodebb-plugin-poll 2.0.6 → 3.0.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nodebb-plugin-poll",
3
- "version": "2.0.6",
3
+ "version": "3.0.0",
4
4
  "description": "NodeBB Poll Plugin",
5
5
  "main": "library.js",
6
6
  "scripts": {
@@ -26,7 +26,7 @@
26
26
  "cron": "^1.8.2"
27
27
  },
28
28
  "nbbpm": {
29
- "compatibility": "^2.0.0"
29
+ "compatibility": "^3.0.0"
30
30
  },
31
31
  "devDependencies": {
32
32
  "eslint": "^7.31.0",
package/plugin.json CHANGED
@@ -29,8 +29,8 @@
29
29
  "public": "public",
30
30
  "vendor": "vendor"
31
31
  },
32
- "less": [
33
- "public/less/style.less"
32
+ "scss": [
33
+ "public/scss/style.scss"
34
34
  ],
35
35
  "scripts": [
36
36
  "public/js/poll/main.js",
@@ -229,7 +229,7 @@
229
229
  var el = this.dom.resultsPanel.find('[data-poll-option-id=' + option.id + ']');
230
230
  el.find('.poll-result-votecount span').text(option.voteCount);
231
231
  el.find('.poll-result-progressbar').css('width', option.percentage + '%')
232
- .find('span').text(option.percentage);
232
+ .find('span.percent').text(option.percentage);
233
233
  }, this);
234
234
  };
235
235
 
@@ -8,7 +8,7 @@
8
8
  margin-top: 0;
9
9
  }
10
10
 
11
- .panel-title {
11
+ .card-title {
12
12
  display: inline-block;
13
13
  }
14
14
 
@@ -24,14 +24,6 @@
24
24
  min-width: 2em;
25
25
  }
26
26
 
27
- .poll-result-avatar {
28
- width: 50px;
29
- height: 50px;
30
- font-size: 3rem;
31
- vertical-align: middle;
32
- margin-bottom: 3px;
33
- }
34
-
35
27
  .poll-result-details:hover {
36
28
  text-decoration: none;
37
29
  }
@@ -1,24 +1,23 @@
1
1
  <div class="row">
2
2
  <div class="col-lg-9">
3
3
  <form class="form poll-settings">
4
- <div class="panel panel-default">
5
- <div class="panel-heading">[[poll:poll]]</div>
6
- <div class="panel-body">
4
+ <div class="card">
5
+ <div class="card-header">[[poll:poll]]</div>
6
+ <div class="card-body">
7
7
  <div class="row">
8
8
  <div class="col-lg-6">
9
- <strong>[[poll:toggles]]</strong>
10
- <div class="form-group">
11
- <div class="checkbox">
12
- <label>
13
- <input type="checkbox" data-key="toggles.allowAnon" data-trim="false"> [[poll:allow_guests]]
14
- </label>
9
+ <h6>[[poll:toggles]]</h6>
10
+ <div class="mb-3">
11
+ <div class="form-check">
12
+ <label class="form-check-label">[[poll:allow_guests]]</label>
13
+ <input class="form-check-input" type="checkbox" data-key="toggles.allowAnon" data-trim="false">
15
14
  </div>
16
15
  </div>
17
16
  </div>
18
17
  <div class="col-lg-6">
19
- <strong>[[poll:limits]]</strong>
20
- <div class="form-group">
21
- <label for="maxPollOptions">[[poll:max_options]]</label>
18
+ <h6>[[poll:limits]]</h6>
19
+ <div>
20
+ <label class="form-label" for="maxPollOptions">[[poll:max_options]]</label>
22
21
  <input type="number" class="form-control" id="maxPollOptions" placeholder="10" min="1" max="100" data-key="limits.maxOptions">
23
22
  </div>
24
23
  </div>
@@ -26,19 +25,19 @@
26
25
  </div>
27
26
  </div>
28
27
 
29
- <div class="panel panel-default">
30
- <div class="panel-heading">[[poll:defaults]]</div>
31
- <div class="panel-body">
28
+ <div class="card">
29
+ <div class="card-header">[[poll:defaults]]</div>
30
+ <div class="card-body">
32
31
  <div class="row">
33
32
  <div class="col-lg-6">
34
- <div class="form-group">
35
- <label for="defaultsTitle">[[poll:default_title]]</label>
33
+ <div class="mb-3">
34
+ <label class="form-label" for="defaultsTitle">[[poll:default_title]]</label>
36
35
  <input type="text" class="form-control" id="defaultsTitle" placeholder="Poll" data-key="defaults.title">
37
36
  </div>
38
- <div class="form-group">
39
- <label for="defaultsMaxVotes">[[poll:max_votes]]</label>
37
+ <div>
38
+ <label class="form-label" for="defaultsMaxVotes">[[poll:max_votes]]</label>
40
39
  <input type="number" class="form-control" id="defaultsMaxVotes" placeholder="1" min="1" max="100" data-key="defaults.maxvotes">
41
- <p class="help-block">[[poll:info_choices]]</p>
40
+ <p class="form-text">[[poll:info_choices]]</p>
42
41
  </div>
43
42
  </div>
44
43
  </div>
@@ -48,9 +47,9 @@
48
47
  </div>
49
48
 
50
49
  <div class="col-lg-3">
51
- <div class="panel panel-default">
52
- <div class="panel-heading">[[poll:settings]]</div>
53
- <div class="panel-body">
50
+ <div class="card">
51
+ <div class="card-header">[[poll:settings]]</div>
52
+ <div class="card-body">
54
53
  <button id="save" class="btn btn-primary btn-block">[[poll:save]]</button>
55
54
  <button id="reset" class="btn btn-warning btn-block">[[poll:reset]]</button>
56
55
  </div>
@@ -1,51 +1,50 @@
1
1
  <form class="form" id="pollCreator">
2
2
  <div id="pollErrorBox" class="alert alert-danger hidden"></div>
3
3
 
4
- <div class="form-group">
5
- <label for="pollInputTitle">[[poll:poll_title]]</label>
4
+ <div class="mb-3">
5
+ <label class="form-label" for="pollInputTitle">[[poll:poll_title]]</label>
6
6
  <input type="text" name="settings.title" id="pollInputTitle" value="{poll.settings.title}" placeholder="[[poll:poll_title_placeholder]]" class="form-control">
7
7
  </div>
8
8
 
9
- <div class="form-group">
10
- <label for="pollInputOptions">[[poll:options_title]]</label>
9
+ <div class="mb-3">
10
+ <label class="form-label" for="pollInputOptions">[[poll:options_title]]</label>
11
11
  <!-- IF poll.options.length -->
12
12
  <!-- BEGIN poll.options -->
13
- <input type="text" name="options" id="pollInputOptions" value="{@value}" class="form-control"/>
13
+ <input type="text" name="options" id="pollInputOptions" value="{@value}" class="form-control mb-2"/>
14
14
  <!-- END poll.options -->
15
15
  <!-- ELSE -->
16
- <input type="text" name="options" id="pollInputOptions" class="form-control"/>
16
+ <input type="text" name="options" id="pollInputOptions" class="form-control mb-2"/>
17
17
  <!-- ENDIF poll.options.length -->
18
18
  <button type="button" id="pollAddOption" class="btn btn-primary btn-sm btn-block">[[poll:options_add]]</button>
19
19
  </div>
20
20
 
21
21
  <hr>
22
22
 
23
- <div class="form-group">
24
- <label for="pollInputAmount">[[poll:max_votes]]</label>
23
+ <div class="mb-3">
24
+ <label class="form-label" for="pollInputAmount">[[poll:max_votes]]</label>
25
25
  <input type="number" name="settings.maxvotes" id="pollInputAmount" value="{poll.settings.maxvotes}"
26
26
  min="1" max="10" step="1" placeholder="[[poll:max_votes_placeholder]]" class="form-control">
27
27
  </div>
28
28
 
29
- <div class="form-group">
30
- <label for="pollDisallowVoteUpdate">
31
- <input type="checkbox" name="settings.disallowVoteUpdate" id="pollDisallowVoteUpdate" {{{if poll.settings.disallowVoteUpdate}}}checked{{{end}}}>
32
- [[poll:disallow_vote_update]]
33
- </label>
29
+ <div class="mb-3">
30
+ <div class="form-check">
31
+ <label class="form-check-label" for="pollDisallowVoteUpdate">[[poll:disallow_vote_update]]</label>
32
+ <input class="form-check-input" type="checkbox" name="settings.disallowVoteUpdate" id="pollDisallowVoteUpdate" {{{if poll.settings.disallowVoteUpdate}}}checked{{{end}}}>
33
+ </div>
34
34
  </div>
35
35
 
36
- <div class="form-group">
37
- <label for="pollInputEnd">[[poll:auto_end_title]]</label>
38
-
36
+ <div class="mb-3">
37
+ <label class="form-label" for="pollInputEnd">[[poll:auto_end_title]]</label>
39
38
  <div class="input-group date flatpickr">
40
39
  <input id="pollInputEnd" placeholder="[[poll:auto_end_placeholder]]" name="settings.end" class="form-control" value="{poll.settings.end}" data-input>
41
- <a class="input-group-addon" data-toggle><i class="fa fa-calendar"></i></a>
40
+ <a class="input-group-text" data-toggle><i class="fa fa-calendar"></i></a>
42
41
  </div>
43
- <p class="help-block">[[poll:auto_end_help]]</p>
42
+ <p class="form-text">[[poll:auto_end_help]]</p>
44
43
  </div>
45
44
 
46
- <!-- IF isRedactor -->
45
+ {{{ if isRedactor }}}
47
46
  <div class="alert alert-warning" role="alert">
48
47
  [[poll:warning.redactor]]
49
48
  </div>
50
- <!-- ENDIF isRedactor -->
49
+ {{{ end }}}
51
50
  </form>
@@ -1,10 +1,6 @@
1
1
  <h2>{voteCount} [[poll:vote_count]]</h2>
2
2
  <!-- BEGIN votes -->
3
3
  <a href="{config.relative_path}/user/{votes.userslug}" class="poll-result-details">
4
- <!-- IF votes.picture -->
5
- <img class="poll-result-avatar" title="{votes.username}" src="{votes.picture}">
6
- <!-- ELSE -->
7
- <div class="poll-result-avatar user-icon" title="{votes.username}" style="background-color: {votes.icon:bgColor};">{votes.icon:text}</div>
8
- <!-- ENDIF votes.picture -->
4
+ {buildAvatar(votes, "24px", true)}
9
5
  </a>
10
6
  <!-- END votes -->
@@ -8,7 +8,7 @@
8
8
  </small>
9
9
  <div class="progress">
10
10
  <div class="progress-bar poll-result-progressbar" role="progressbar" aria-valuenow="{poll.options.percentage}" aria-valuemin="0" aria-valuemax="100" style="width: {poll.options.percentage}%;">
11
- <span>{poll.options.percentage}</span>%
11
+ <span><span class="percent">{poll.options.percentage}</span>%</span>
12
12
  </div>
13
13
  </div>
14
14
  </div>
@@ -1,14 +1,14 @@
1
1
  <div class="poll-view" data-poll-id="{poll.info.pollId}">
2
- <div class="panel panel-default">
3
- <div class="panel-heading">
4
- <h3 class="panel-title">{poll.settings.title}</h3>
5
- <div class="btn-group pull-right hidden">
2
+ <div class="card">
3
+ <div class="card-header">
4
+ <h3 class="card-title">{poll.settings.title}</h3>
5
+ <div class="btn-group float-end hidden">
6
6
  <a href="#" class="poll-button-edit">
7
7
  <span class="fa fa-pencil"></span>
8
8
  </a>
9
9
  </div>
10
10
  </div>
11
- <div class="panel-body">
11
+ <div class="card-body">
12
12
  <div class="poll-view-messages hidden"></div>
13
13
  <div class="poll-view-voting <!-- IF poll.hasVoted -->hidden<!-- ENDIF poll.hasVoted -->">
14
14
  <!-- IMPORT poll/view/voting.tpl -->