Skip to content

Commit 0c4509e

Browse files
committed
Enh: Migration to Bootstrap 5 for HumHub 1.18
1 parent c5abb44 commit 0c4509e

6 files changed

Lines changed: 74 additions & 69 deletions

File tree

docs/CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
Changelog
22
=========
33

4-
2.1.9 (Unreleased)
4+
2.2.0 (Unreleased)
55
----------------------
66
- Fix #75: Warning for "FCM Detection - App is using Proxy Firebase Service"
77
- Fix #78: Don't show opener if logout triggered by mobile app
8+
- Enh: Migration to Bootstrap 5 for HumHub 1.18
89

910
2.1.8 (March 21, 2025)
1011
----------------------

models/ConfigureForm.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
use humhub\modules\fcmPush\Module;
66
use humhub\modules\fcmPush\services\WellKnownService;
7-
use humhub\widgets\Link;
7+
use humhub\widgets\bootstrap\Link;
88
use Yii;
99
use yii\base\InvalidArgumentException;
1010
use yii\base\Model;

module.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
],
1010
"homepage": "https://github.com/humhub/fcm-push",
1111
"humhub": {
12-
"minVersion": "1.17.2"
12+
"minVersion": "1.18.0"
1313
},
14-
"version": "2.1.9",
14+
"version": "2.2.0",
1515
"screenshots": [
1616
"resources/screenshot1.PNG",
1717
"resources/screenshot2.PNG"

views/admin/index.php

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
<?php
22

33
use humhub\modules\fcmPush\models\ConfigureForm;
4-
use humhub\modules\ui\form\widgets\ActiveForm;
54
use humhub\modules\ui\icon\widgets\Icon;
6-
use humhub\widgets\Button;
5+
use humhub\widgets\bootstrap\Button;
6+
use humhub\widgets\form\ActiveForm;
77
use yii\helpers\Html;
88

99
/* @var $model ConfigureForm */
1010
?>
1111
<div class="panel panel-default">
12-
<div class="panel-heading"><?= Yii::t('FcmPushModule.base', '<strong>FireBase Messaging</strong> Configuration'); ?></div>
12+
<div
13+
class="panel-heading"><?= Yii::t('FcmPushModule.base', '<strong>FireBase Messaging</strong> Configuration'); ?></div>
1314
<div class="panel-body">
1415
<?php $form = ActiveForm::begin(['id' => 'configure-form', 'enableClientValidation' => false, 'enableClientScript' => false]); ?>
1516

@@ -26,9 +27,8 @@
2627
<?= Yii::t('FcmPushModule.base', 'For HumHub mobile app users, push notifications can be sent via the HumHub push service. If you want to use this service, please enter your access key below.<br/>Please note, this push gateway is only available for the users of the official HumHub mobile app.') ?>
2728
</p>
2829
<?= Button::info('Push Service Registration')->link('https://push.humhub.com')->options(['target' => '_blank'])->loader(false) ?>
29-
<?= $form->field($model, 'humhubInstallId')->textInput(['disabled' => 'disabled']); ?>
30-
31-
<?= $form->field($model, 'humhubApiKey')->textarea(['rows' => 2]); ?>
30+
<?= $form->field($model, 'humhubInstallId')->textInput(['disabled' => 'disabled']) ?>
31+
<?= $form->field($model, 'humhubApiKey')->textarea(['rows' => 2]) ?>
3232
<br/>
3333

3434
<hr>
@@ -51,25 +51,23 @@
5151
->label(Yii::t('FcmPushModule.base', 'Hide third-party login options for app users with iOS.')) ?>
5252

5353
<?php if (!Yii::$app->urlManager->enablePrettyUrl) : ?>
54-
<div class="alert alert-warning">
55-
<?= Icon::get('warning') ?>
56-
<?= Yii::t('FcmPushModule.base', 'Please enable <a href="{url}" target="_blank">Pretty URLs</a> for proper working of the well-known files.', [
57-
'url' => 'https://docs.humhub.org/docs/admin/installation/#pretty-urls',
58-
]) ?>
59-
</div>
54+
<div class="alert alert-warning">
55+
<?= Icon::get('warning') ?>
56+
<?= Yii::t('FcmPushModule.base', 'Please enable <a href="{url}" target="_blank">Pretty URLs</a> for proper working of the well-known files.', [
57+
'url' => 'https://docs.humhub.org/docs/admin/installation/#pretty-urls',
58+
]) ?>
59+
</div>
6060
<?php endif; ?>
6161

6262
<?= $form->field($model, 'fileAssetLinks')->textarea(['rows' => 10]) ?>
6363
<?= $form->field($model, 'fileAppleAssociation')->textarea(['rows' => 10]) ?>
6464
<?= $form->endCollapsibleFields(); ?>
6565
<br/>
6666

67-
<div class="form-group">
68-
<?= Html::submitButton(Yii::t('base', 'Save'), ['class' => 'btn btn-primary', 'data-ui-loader' => '']) ?>
69-
</div>
67+
<?= Button::asLink('Mobile App Debug')->link(['/fcm-push/admin/mobile-app'])->right() ?>
68+
69+
<?= Html::submitButton(Yii::t('base', 'Save'), ['class' => 'btn btn-primary', 'data-ui-loader' => '']) ?>
7070

7171
<?php ActiveForm::end(); ?>
72-
73-
<?= Html::a('Mobile App Debug', ['/fcm-push/admin/mobile-app'], ['class' => 'pull-right']) ?>
7472
</div>
7573
</div>

views/admin/mobile-app.php

Lines changed: 47 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,24 @@
11
<?php
22

3-
/* @var $this \humhub\modules\ui\view\components\View */
4-
3+
use humhub\components\View;
54
use humhub\helpers\DeviceDetectorHelper;
6-
use humhub\libs\Html;
5+
use humhub\helpers\Html;
76
use humhub\modules\fcmPush\models\FcmUser;
7+
use humhub\widgets\bootstrap\Button;
88
use yii\helpers\Json;
99
use yii\helpers\Url;
1010

11-
11+
/* @var $this View */
1212
?>
1313

14-
1514
<div class="row">
16-
<div class="col-md-12">
15+
<div class="col-lg-12">
1716
<div class="panel panel-default">
1817
<div class="panel-heading">
18+
<?= Button::back(['/fcm-push/admin/index'])->sm() ?>
1919
<strong>Mobile App</strong> Debug Page
2020
</div>
21+
2122
<div class="panel-body">
2223

2324
<?php if (DeviceDetectorHelper::isAppRequest()): ?>
@@ -41,22 +42,26 @@
4142
</p>
4243
<?php endif; ?>
4344

44-
<?= Html::a('Show Opener', '#', ['class' => 'btn btn-default postFlutterMsgLink', 'data-message' => Json::encode(['type' => 'showOpener'])]) ?>
45-
<?= Html::a('Hide Opener', '#', ['class' => 'btn btn-default postFlutterMsgLink', 'data-message' => Json::encode(['type' => 'hideOpener'])]) ?>
46-
<?= Html::a('Open this page as POST Request', ['mobile-app'], ['data-method' => 'POST', 'class' => 'btn btn-default']) ?>
47-
<?= Html::a('Open native console', '#', ['class' => 'btn btn-default postFlutterMsgLink', 'data-message' => Json::encode(['type' => 'openNativeConsole'])]) ?>
45+
<?= Html::a('Show Opener', '#', ['class' => 'btn btn-light postFlutterMsgLink', 'data-message' => Json::encode(['type' => 'showOpener'])]) ?>
46+
<?= Html::a('Hide Opener', '#', ['class' => 'btn btn-light postFlutterMsgLink', 'data-message' => Json::encode(['type' => 'hideOpener'])]) ?>
47+
<?= Html::a('Open this page as POST Request', ['mobile-app'], ['data-method' => 'POST', 'class' => 'btn btn-light']) ?>
48+
<?= Html::a('Open native console', '#', ['class' => 'btn btn-light postFlutterMsgLink', 'data-message' => Json::encode(['type' => 'openNativeConsole'])]) ?>
4849
</div>
4950
</div>
5051
<div class="panel panel-default">
5152
<div class="panel-body">
5253
<h4>Test Push Notification</h4>
5354

5455
<p>Make sure the <code>Mobile</code> checkbox is enabled for <a
55-
href="<?= Url::to(['/notification/user']); ?>">
56+
href="<?= Url::to(['/notification/user']); ?>">
5657
Administrative Notifications!</a>. It may take a few minutes.
5758
</p>
5859

59-
<?= Html::a('Trigger "HumHub Update" notification', ['mobile-app', 'triggerNotification' => 1], ['class' => 'btn btn-primary pull-right']) ?>
60+
<div class="clearfix">
61+
<?= Button::primary('Trigger "HumHub Update" notification')
62+
->link(['mobile-app', 'triggerNotification' => 1])
63+
->right() ?>
64+
</div>
6065

6166
</div>
6267
</div>
@@ -68,26 +73,24 @@
6873

6974
<p>Set Notification Count to a number between 100 and 200.</p>
7075

71-
<?php
72-
$message = Json::encode(['type' => 'updateNotificationCount', 'count' => rand(100, 200)]);
73-
?>
76+
<?php $message = Json::encode(['type' => 'updateNotificationCount', 'count' => rand(100, 200)]); ?>
7477

75-
<p><code><?= $message; ?></code></p>
78+
<p><code><?= $message ?></code></p>
7679

77-
<?= Html::a(
78-
'Execute via JS Channel',
79-
'#',
80-
['class' => 'btn btn-primary pull-right postFlutterMsgLink', 'data-message' => $message]
81-
) ?>
80+
<div class="clearfix">
81+
<?= Html::a(
82+
'Execute via JS Channel',
83+
'#',
84+
['class' => 'btn btn-primary float-end postFlutterMsgLink', 'data-message' => $message],
85+
) ?>
86+
</div>
8287
</div>
8388
</div>
8489
<div class="panel panel-default">
8590
<div class="panel-body">
8691
<h4>Registered FireBase Devices (Current User)</h4>
8792

88-
<?php
89-
$tokens = FcmUser::find()->where(['user_id' => Yii::$app->user->id])->orderBy('created_at DESC')->all();
90-
?>
93+
<?php $tokens = FcmUser::find()->where(['user_id' => Yii::$app->user->id])->orderBy('created_at DESC')->all(); ?>
9194

9295
<?php if (count($tokens) === 0): ?>
9396
<p class="alert alert-danger">
@@ -133,12 +136,10 @@
133136

134137
<h4>Send `registerFcmDevice` message </h4>
135138

136-
<?php
137-
$json = ['type' => 'registerFcmDevice', 'url' => Url::to(['/fcm-push/token/update-mobile-app'], true)];
138-
$message = Json::encode($json);
139-
?>
139+
<?php $json = ['type' => 'registerFcmDevice', 'url' => Url::to(['/fcm-push/token/update-mobile-app'], true)]; ?>
140+
<?php $message = Json::encode($json); ?>
140141

141-
<p><code><?= $message; ?></code></p>
142+
<p><code><?= $message ?></code></p>
142143

143144

144145
<p>
@@ -156,24 +157,24 @@
156157
<li>400 - No `token` in payload</li>
157158
</ul>
158159

159-
<?= Html::a(
160-
'Execute via JS Channel',
161-
'#',
162-
['class' => 'btn btn-primary pull-right postFlutterMsgLink', 'data-message' => $message]
163-
) ?>
160+
<div class="clearfix">
161+
<?= Html::a(
162+
'Execute via JS Channel',
163+
'#',
164+
['class' => 'btn btn-primary float-end postFlutterMsgLink', 'data-message' => $message],
165+
) ?>
166+
</div>
164167
</div>
165168
</div>
166169
<div class="panel panel-default">
167170
<div class="panel-body">
168171

169172
<h4>Send `unregisterFcmDevice` message </h4>
170173

171-
<?php
172-
$json = ['type' => 'unregisterFcmDevice', 'url' => Url::to(['/fcm-push/token/delete-mobile-app'], true)];
173-
$message = Json::encode($json);
174-
?>
174+
<?php $json = ['type' => 'unregisterFcmDevice', 'url' => Url::to(['/fcm-push/token/delete-mobile-app'], true)]; ?>
175+
<?php $message = Json::encode($json); ?>
175176

176-
<p><code><?= $message; ?></code></p>
177+
<p><code><?= $message ?></code></p>
177178

178179

179180
<p>
@@ -191,11 +192,13 @@
191192
<li>400 - No `token` in payload</li>
192193
</ul>
193194

194-
<?= Html::a(
195-
'Execute via JS Channel',
196-
'#',
197-
['class' => 'btn btn-primary pull-right postFlutterMsgLink', 'data-message' => $message]
198-
) ?>
195+
<div class="clearfix">
196+
<?= Html::a(
197+
'Execute via JS Channel',
198+
'#',
199+
['class' => 'btn btn-primary float-end postFlutterMsgLink', 'data-message' => $message],
200+
) ?>
201+
</div>
199202
</div>
200203
</div>
201204

@@ -217,5 +220,4 @@
217220
alert("Could not send message! Message: " + JSON.stringify(message));
218221
}
219222
});
220-
221223
</script>
Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1-
<div class="alert alert-danger">
2-
<strong>Push Notifications</strong> not allowed.
3-
</div>
1+
<?php
2+
3+
use humhub\widgets\bootstrap\Alert;
4+
5+
?>
6+
7+
<?= Alert::danger('<strong>Push Notifications</strong> not allowed.') ?>

0 commit comments

Comments
 (0)