Skip to content

Commit 097cdf7

Browse files
replace .show, .hide, .fadeIn, use Badge widget
1 parent 9f9bce7 commit 097cdf7

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

resources/js/humhub.polls.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ humhub.module('polls', function (module, require, $) {
4040
var that = this;
4141
var $errorMessage = that.$.find('.errorMessage');
4242
this.loader();
43-
$errorMessage.parent().hide();
43+
$errorMessage.parent().addClass('d-none');
4444
client.submit(evt).then(function (response) {
4545
if (!response.errors) {
4646
that.handleUpdateSuccess(response);
@@ -49,7 +49,7 @@ humhub.module('polls', function (module, require, $) {
4949
$.each(response.errors, function (key, value) {
5050
errors += value + '<br />';
5151
});
52-
$errorMessage.html(errors).parent().show();
52+
$errorMessage.html(errors).parent().removeClass('d-none');
5353
}
5454
}).catch(Poll.handleUpdateError)
5555
.finally($.proxy(this.loader, this, false));
@@ -78,14 +78,14 @@ humhub.module('polls', function (module, require, $) {
7878
var $input = $newInputGroup.find('input');
7979

8080
$input.val('');
81-
$newInputGroup.hide();
81+
$newInputGroup.addClass('d-none');
8282
$this.closest('.mb-3').after($newInputGroup);
8383
$this.children('span').removeClass('glyphicon-plus').addClass('glyphicon-trash');
8484
$this.off('click.humhub-action').on('click', function () {
8585
$this.closest('.mb-3').remove();
8686
});
8787
$this.removeAttr('data-action-click');
88-
$newInputGroup.fadeIn('fast');
88+
$newInputGroup.removeClass('d-none');
8989
};
9090

9191
Poll.prototype.loader = function ($loader) {

widgets/views/entry.php

+3-2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
use humhub\modules\content\widgets\richtext\RichText;
44
use humhub\modules\polls\models\Poll;
55
use humhub\helpers\Html;
6+
use humhub\widgets\bootstrap\Badge;
67

78
humhub\modules\polls\assets\PollsAsset::register($this);
89

@@ -12,11 +13,11 @@
1213
<div data-poll="<?= $poll->id ?>" data-content-component="polls.Poll" data-content-key="<?= $poll->content->id ?>">
1314

1415
<?php if ($poll->closed) : ?>
15-
&nbsp;<span style="margin-left:3px;" class="label label-danger float-end"><?= Yii::t('PollsModule.base', 'Closed') ?></span>
16+
&nbsp;<?= Badge::danger(Yii::t('PollsModule.base', 'Closed'))->style(['margin-left' => '3px'])->right() ?>
1617
<?php endif; ?>
1718

1819
<?php if ($poll->anonymous) : ?>
19-
&nbsp;<span class="label label-success float-end"><?= Yii::t('PollsModule.base', 'Anonymous') ?></span>
20+
&nbsp;<?= Badge::success(Yii::t('PollsModule.base', 'Anonymous'))->right() ?>
2021
<?php endif; ?>
2122

2223
<?= Html::beginForm($contentContainer->createUrl('/polls/poll/answer', ['pollId' => $poll->id])) ?>

0 commit comments

Comments
 (0)