Skip to content

Commit

Permalink
update for bs5
Browse files Browse the repository at this point in the history
  • Loading branch information
barisusakli committed Sep 20, 2022
1 parent 27a9cfc commit ec72151
Show file tree
Hide file tree
Showing 9 changed files with 53 additions and 67 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"cron": "^1.8.2"
},
"nbbpm": {
"compatibility": "^2.0.0"
"compatibility": "^3.0.0"
},
"devDependencies": {
"eslint": "^7.31.0",
Expand Down
4 changes: 2 additions & 2 deletions plugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
"public": "public",
"vendor": "vendor"
},
"less": [
"public/less/style.less"
"scss": [
"public/scss/style.scss"
],
"scripts": [
"public/js/poll/main.js",
Expand Down
2 changes: 1 addition & 1 deletion public/js/poll/view.js
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@
var el = this.dom.resultsPanel.find('[data-poll-option-id=' + option.id + ']');
el.find('.poll-result-votecount span').text(option.voteCount);
el.find('.poll-result-progressbar').css('width', option.percentage + '%')
.find('span').text(option.percentage);
.find('span.percent').text(option.percentage);
}, this);
};

Expand Down
10 changes: 1 addition & 9 deletions public/less/style.less → public/scss/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
margin-top: 0;
}

.panel-title {
.card-title {
display: inline-block;
}

Expand All @@ -24,14 +24,6 @@
min-width: 2em;
}

.poll-result-avatar {
width: 50px;
height: 50px;
font-size: 3rem;
vertical-align: middle;
margin-bottom: 3px;
}

.poll-result-details:hover {
text-decoration: none;
}
Expand Down
45 changes: 22 additions & 23 deletions templates/admin/plugins/poll.tpl
Original file line number Diff line number Diff line change
@@ -1,44 +1,43 @@
<div class="row">
<div class="col-lg-9">
<form class="form poll-settings">
<div class="panel panel-default">
<div class="panel-heading">[[poll:poll]]</div>
<div class="panel-body">
<div class="card">
<div class="card-header">[[poll:poll]]</div>
<div class="card-body">
<div class="row">
<div class="col-lg-6">
<strong>[[poll:toggles]]</strong>
<div class="form-group">
<div class="checkbox">
<label>
<input type="checkbox" data-key="toggles.allowAnon" data-trim="false"> [[poll:allow_guests]]
</label>
<h6>[[poll:toggles]]</h6>
<div class="mb-3">
<div class="form-check">
<label class="form-check-label">[[poll:allow_guests]]</label>
<input class="form-check-input" type="checkbox" data-key="toggles.allowAnon" data-trim="false">
</div>
</div>
</div>
<div class="col-lg-6">
<strong>[[poll:limits]]</strong>
<div class="form-group">
<label for="maxPollOptions">[[poll:max_options]]</label>
<h6>[[poll:limits]]</h6>
<div>
<label class="form-label" for="maxPollOptions">[[poll:max_options]]</label>
<input type="number" class="form-control" id="maxPollOptions" placeholder="10" min="1" max="100" data-key="limits.maxOptions">
</div>
</div>
</div>
</div>
</div>

<div class="panel panel-default">
<div class="panel-heading">[[poll:defaults]]</div>
<div class="panel-body">
<div class="card">
<div class="card-header">[[poll:defaults]]</div>
<div class="card-body">
<div class="row">
<div class="col-lg-6">
<div class="form-group">
<label for="defaultsTitle">[[poll:default_title]]</label>
<div class="mb-3">
<label class="form-label" for="defaultsTitle">[[poll:default_title]]</label>
<input type="text" class="form-control" id="defaultsTitle" placeholder="Poll" data-key="defaults.title">
</div>
<div class="form-group">
<label for="defaultsMaxVotes">[[poll:max_votes]]</label>
<div>
<label class="form-label" for="defaultsMaxVotes">[[poll:max_votes]]</label>
<input type="number" class="form-control" id="defaultsMaxVotes" placeholder="1" min="1" max="100" data-key="defaults.maxvotes">
<p class="help-block">[[poll:info_choices]]</p>
<p class="form-text">[[poll:info_choices]]</p>
</div>
</div>
</div>
Expand All @@ -48,9 +47,9 @@
</div>

<div class="col-lg-3">
<div class="panel panel-default">
<div class="panel-heading">[[poll:settings]]</div>
<div class="panel-body">
<div class="card">
<div class="card-header">[[poll:settings]]</div>
<div class="card-body">
<button id="save" class="btn btn-primary btn-block">[[poll:save]]</button>
<button id="reset" class="btn btn-warning btn-block">[[poll:reset]]</button>
</div>
Expand Down
39 changes: 19 additions & 20 deletions templates/poll/creator.tpl
Original file line number Diff line number Diff line change
@@ -1,51 +1,50 @@
<form class="form" id="pollCreator">
<div id="pollErrorBox" class="alert alert-danger hidden"></div>

<div class="form-group">
<label for="pollInputTitle">[[poll:poll_title]]</label>
<div class="mb-3">
<label class="form-label" for="pollInputTitle">[[poll:poll_title]]</label>
<input type="text" name="settings.title" id="pollInputTitle" value="{poll.settings.title}" placeholder="[[poll:poll_title_placeholder]]" class="form-control">
</div>

<div class="form-group">
<label for="pollInputOptions">[[poll:options_title]]</label>
<div class="mb-3">
<label class="form-label" for="pollInputOptions">[[poll:options_title]]</label>
<!-- IF poll.options.length -->
<!-- BEGIN poll.options -->
<input type="text" name="options" id="pollInputOptions" value="{@value}" class="form-control"/>
<input type="text" name="options" id="pollInputOptions" value="{@value}" class="form-control mb-2"/>
<!-- END poll.options -->
<!-- ELSE -->
<input type="text" name="options" id="pollInputOptions" class="form-control"/>
<input type="text" name="options" id="pollInputOptions" class="form-control mb-2"/>
<!-- ENDIF poll.options.length -->
<button type="button" id="pollAddOption" class="btn btn-primary btn-sm btn-block">[[poll:options_add]]</button>
</div>

<hr>

<div class="form-group">
<label for="pollInputAmount">[[poll:max_votes]]</label>
<div class="mb-3">
<label class="form-label" for="pollInputAmount">[[poll:max_votes]]</label>
<input type="number" name="settings.maxvotes" id="pollInputAmount" value="{poll.settings.maxvotes}"
min="1" max="10" step="1" placeholder="[[poll:max_votes_placeholder]]" class="form-control">
</div>

<div class="form-group">
<label for="pollDisallowVoteUpdate">
<input type="checkbox" name="settings.disallowVoteUpdate" id="pollDisallowVoteUpdate" {{{if poll.settings.disallowVoteUpdate}}}checked{{{end}}}>
[[poll:disallow_vote_update]]
</label>
<div class="mb-3">
<div class="form-check">
<label class="form-check-label" for="pollDisallowVoteUpdate">[[poll:disallow_vote_update]]</label>
<input class="form-check-input" type="checkbox" name="settings.disallowVoteUpdate" id="pollDisallowVoteUpdate" {{{if poll.settings.disallowVoteUpdate}}}checked{{{end}}}>
</div>
</div>

<div class="form-group">
<label for="pollInputEnd">[[poll:auto_end_title]]</label>

<div class="mb-3">
<label class="form-label" for="pollInputEnd">[[poll:auto_end_title]]</label>
<div class="input-group date flatpickr">
<input id="pollInputEnd" placeholder="[[poll:auto_end_placeholder]]" name="settings.end" class="form-control" value="{poll.settings.end}" data-input>
<a class="input-group-addon" data-toggle><i class="fa fa-calendar"></i></a>
<a class="input-group-text" data-toggle><i class="fa fa-calendar"></i></a>
</div>
<p class="help-block">[[poll:auto_end_help]]</p>
<p class="form-text">[[poll:auto_end_help]]</p>
</div>

<!-- IF isRedactor -->
{{{ if isRedactor }}}
<div class="alert alert-warning" role="alert">
[[poll:warning.redactor]]
</div>
<!-- ENDIF isRedactor -->
{{{ end }}}
</form>
10 changes: 5 additions & 5 deletions templates/poll/view.tpl
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<div class="poll-view" data-poll-id="{poll.info.pollId}">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">{poll.settings.title}</h3>
<div class="btn-group pull-right hidden">
<div class="card">
<div class="card-header">
<h3 class="card-title">{poll.settings.title}</h3>
<div class="btn-group float-end hidden">
<a href="#" class="poll-button-edit">
<span class="fa fa-pencil"></span>
</a>
</div>
</div>
<div class="panel-body">
<div class="card-body">
<div class="poll-view-messages hidden"></div>
<div class="poll-view-voting <!-- IF poll.hasVoted -->hidden<!-- ENDIF poll.hasVoted -->">
<!-- IMPORT poll/view/voting.tpl -->
Expand Down
6 changes: 1 addition & 5 deletions templates/poll/view/details.tpl
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
<h2>{voteCount} [[poll:vote_count]]</h2>
<!-- BEGIN votes -->
<a href="{config.relative_path}/user/{votes.userslug}" class="poll-result-details">
<!-- IF votes.picture -->
<img class="poll-result-avatar" title="{votes.username}" src="{votes.picture}">
<!-- ELSE -->
<div class="poll-result-avatar user-icon" title="{votes.username}" style="background-color: {votes.icon:bgColor};">{votes.icon:text}</div>
<!-- ENDIF votes.picture -->
{buildAvatar(votes, "24px", true)}
</a>
<!-- END votes -->
2 changes: 1 addition & 1 deletion templates/poll/view/results.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</small>
<div class="progress">
<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}%;">
<span>{poll.options.percentage}</span>%
<span><span class="percent">{poll.options.percentage}</span>%</span>
</div>
</div>
</div>
Expand Down

0 comments on commit ec72151

Please sign in to comment.