Skip to content

Commit

Permalink
Merge pull request #500 from TonisOrmisson/bootstrap-5-new
Browse files Browse the repository at this point in the history
Bootstrap 5 initialization
  • Loading branch information
maxxer authored Jan 12, 2023
2 parents e370af6 + d67baff commit b8e34e0
Show file tree
Hide file tree
Showing 38 changed files with 241 additions and 250 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
fail-fast: false
matrix:
operating-system: ['ubuntu-latest']
php-versions: ['8.1', '8.0','7.4']
php-versions: ['8.2','8.1', '8.0','7.4']

services:
mariadb:
Expand Down
7 changes: 5 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,22 @@
"prefer-stable": true,
"require": {
"php": ">=5.5",
"2amigos/yii2-selectize-widget": "^1.1",
"yiisoft/yii2-authclient": "^2.1",
"yiisoft/yii2-httpclient": "^2.0",
"yiisoft/yii2-bootstrap": "^2.0",
"yetopen/yii2-sms-sender-interface": "^0.1.1"
},
"suggest": {
"yiisoft/yii2-bootstrap5": "Front-end framework needed for the default views",
"kartik-v/yii2-widget-select2": "needed for default Botstrap-5 views",
"twbs/bootstrap-icons": "Icons for Bootstrap 5 views",
"yiisoft/yii2-symfonymailer": "A mailer driver is needed to send e-mails. Older versions use abandoned Swiftmailer which can be replaced with symfonymailer",
"2amigos/2fa-library": "Needed if you want to enable 2 Factor Authentication. Require version ^1.0",
"2amigos/qrcode-library": "Needed if you want to enable 2FA with QR Code generation. Require version ^1.1"
},
"require-dev": {
"php": ">=7.4",
"kartik-v/yii2-widget-select2": "^2.2",
"yiisoft/yii2-bootstrap5": "^2.0",
"2amigos/2fa-library": "^2.0",
"2amigos/qrcode-library": "^2.0",
"friendsofphp/php-cs-fixer": "^3",
Expand Down
8 changes: 4 additions & 4 deletions docs/guides/how-to-add-captcha-widget.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,11 @@ $this->params['breadcrumbs'][] = $this->title;
?>
<div class="row">
<div class="col-md-4 col-md-offset-4 col-sm-6 col-sm-offset-3">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title"><?= Html::encode($this->title) ?></h3>
<div class="card ">
<div class="card-header">
<h3 class="m-0"><?= Html::encode($this->title) ?></h3>
</div>
<div class="panel-body">
<div class="card-body">
<?php $form = ActiveForm::begin(
[
'id' => $model->formName(),
Expand Down
8 changes: 4 additions & 4 deletions docs/guides/how-to-use-recaptcha-widget.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,11 @@ $this->params['breadcrumbs'][] = $this->title;
?>
<div class="row">
<div class="col-md-4 col-md-offset-4 col-sm-6 col-sm-offset-3">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title"><?= Html::encode($this->title) ?></h3>
<div class="card ">
<div class="card-header">
<h3 class="m-0"><?= Html::encode($this->title) ?></h3>
</div>
<div class="panel-body">
<div class="card-body">
<?php $form = ActiveForm::begin(
[
'id' => $model->formName(),
Expand Down
2 changes: 0 additions & 2 deletions src/User/Service/TwoFactorSmsCodeGeneratorService.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@

namespace Da\User\Service;

use Da\TwoFA\Manager;
use Da\User\Contracts\ServiceInterface;
use Da\User\Factory\MailFactory;
use Da\User\Model\User;
use yetopen\smssender\SmsSenderInterface;
use Yii;
Expand Down
2 changes: 1 addition & 1 deletion src/User/Validator/AjaxRequestModelValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
use Da\User\Contracts\ValidatorInterface;
use Yii;
use yii\base\Model;
use yii\bootstrap\ActiveForm;
use yii\widgets\ActiveForm;
use yii\web\Response;

class AjaxRequestModelValidator implements ValidatorInterface
Expand Down
16 changes: 8 additions & 8 deletions src/User/resources/views/admin/_account.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* the LICENSE file that was distributed with this source code.
*/

use yii\bootstrap\ActiveForm;
use yii\bootstrap5\ActiveForm;
use yii\helpers\Html;

/** @var yii\web\View $this */
Expand All @@ -25,19 +25,19 @@
'layout' => 'horizontal',
'enableAjaxValidation' => true,
'enableClientValidation' => false,
'fieldConfig' => [
'horizontalCssClasses' => [
'wrapper' => 'col-sm-9',
],
],
]
); ?>

<?= $this->render('/admin/_user', ['form' => $form, 'user' => $user]) ?>

<div class="form-group">
<div class="col-lg-offset-3 col-lg-9">
<?= Html::submitButton(Yii::t('usuario', 'Update'), ['class' => 'btn btn-block btn-success']) ?>
<div class="offset-sm-2 col-lg-10">
<div class="d-grid">
<?= Html::submitButton(
Yii::t('usuario', 'Update'),
['class' => 'btn btn-success']
) ?>
</div>
</div>
</div>

Expand Down
2 changes: 1 addition & 1 deletion src/User/resources/views/admin/_assignments.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

<?php $this->beginContent($module->viewPath. '/admin/update.php', ['user' => $user]) ?>

<?= yii\bootstrap\Alert::widget(
<?= yii\bootstrap5\Alert::widget(
[
'options' => [
'class' => 'alert-info alert-dismissible',
Expand Down
16 changes: 8 additions & 8 deletions src/User/resources/views/admin/_profile.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* the LICENSE file that was distributed with this source code.
*/

use yii\bootstrap\ActiveForm;
use yii\bootstrap5\ActiveForm;
use yii\helpers\Html;

/**
Expand All @@ -28,11 +28,6 @@
'layout' => 'horizontal',
'enableAjaxValidation' => true,
'enableClientValidation' => false,
'fieldConfig' => [
'horizontalCssClasses' => [
'wrapper' => 'col-sm-9',
],
],
]
); ?>

Expand All @@ -45,8 +40,13 @@


<div class="form-group">
<div class="col-lg-offset-3 col-lg-9">
<?= Html::submitButton(Yii::t('usuario', 'Update'), ['class' => 'btn btn-block btn-success']) ?>
<div class="offset-sm-2 col-lg-10">
<div class="d-grid">
<?= Html::submitButton(
Yii::t('usuario', 'Update'),
['class' => 'btn btn-success']
) ?>
</div>
</div>
</div>

Expand Down
2 changes: 1 addition & 1 deletion src/User/resources/views/admin/_session-history.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
Yii::t('usuario', 'Terminate all sessions'),
['/user/admin/terminate-sessions', 'id' => $user->id],
[
'class' => 'btn btn-danger btn-xs pull-right',
'class' => 'btn btn-danger btn-sm float-end',
'data-method' => 'post'
]
) ?>
Expand Down
39 changes: 18 additions & 21 deletions src/User/resources/views/admin/create.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
* the LICENSE file that was distributed with this source code.
*/

use yii\bootstrap\ActiveForm;
use yii\bootstrap\Nav;
use yii\bootstrap5\ActiveForm;
use yii\bootstrap5\Nav;
use yii\helpers\Html;

/**
Expand All @@ -33,20 +33,20 @@

<div class="row">
<div class="col-md-12">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title"><?= Html::encode($this->title) ?></h3>
<div class="card">
<div class="card-header">
<h3 class="m-0"><?= Html::encode($this->title) ?></h3>
</div>
<div class="panel-body">
<div class="card-body">
<?= $this->render('/shared/_menu') ?>
<div class="row">
<div class="col-md-3">
<div class="panel panel-default">
<div class="panel-body">
<div class="card">
<div class="card-body">
<?= Nav::widget(
[
'options' => [
'class' => 'nav-pills nav-stacked',
'class' => 'nav-pills nav-stacked flex-column',
],
'items' => [
[
Expand Down Expand Up @@ -74,8 +74,8 @@
</div>
</div>
<div class="col-md-9">
<div class="panel panel-default">
<div class="panel-body">
<div class="card">
<div class="card-body">
<div class="alert alert-info">
<?= Yii::t('usuario', 'Credentials will be sent to the user by email') ?>.
<?= Yii::t(
Expand All @@ -88,22 +88,19 @@
'layout' => 'horizontal',
'enableAjaxValidation' => true,
'enableClientValidation' => false,
'fieldConfig' => [
'horizontalCssClasses' => [
'wrapper' => 'col-sm-9',
],
],
]
); ?>

<?= $this->render('/admin/_user', ['form' => $form, 'user' => $user]) ?>

<div class="form-group">
<div class="col-lg-offset-3 col-lg-9">
<?= Html::submitButton(
Yii::t('usuario', 'Save'),
['class' => 'btn btn-block btn-success']
) ?>
<div class="offset-sm-2 col-lg-10">
<div class="d-grid">
<?= Html::submitButton(
Yii::t('usuario', 'Save'),
['class' => 'btn btn-success']
) ?>
</div>
</div>
</div>

Expand Down
8 changes: 4 additions & 4 deletions src/User/resources/views/admin/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

$this->title = Yii::t('usuario', 'Manage users');
$this->params['breadcrumbs'][] = $this->title;

\yii\bootstrap5\BootstrapIconAsset::register($this);
?>

<?php $this->beginContent($module->viewPath . '/shared/admin_layout.php') ?>
Expand Down Expand Up @@ -137,7 +137,7 @@
'switch' => function ($url, $model) use ($module) {
if ($model->id != Yii::$app->user->id && $module->enableSwitchIdentities) {
return Html::a(
'<span class="glyphicon glyphicon-user"></span>',
'<i class="bi-person-fill"></i>',
['/user/admin/switch-identity', 'id' => $model->id],
[
'title' => Yii::t('usuario', 'Impersonate this user'),
Expand All @@ -155,7 +155,7 @@
'reset' => function ($url, $model) use ($module) {
if($module->allowAdminPasswordRecovery) {
return Html::a(
'<span class="glyphicon glyphicon-flash"></span>',
'<i class="bi-lightning-charge-fill"></i>',
['/user/admin/password-reset', 'id' => $model->id],
[
'title' => Yii::t('usuario', 'Send password recovery email'),
Expand All @@ -175,7 +175,7 @@
return null;
}
return Html::a(
'<span class="glyphicon glyphicon-time"></span>',
'<i class="fas fa-stopwatch"></i>',
['/user/admin/force-password-change', 'id' => $model->id],
[
'title' => Yii::t('usuario', 'Force password change at next login'),
Expand Down
20 changes: 10 additions & 10 deletions src/User/resources/views/admin/update.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*/

use Da\User\Model\User;
use yii\bootstrap\Nav;
use yii\bootstrap5\Nav;
use yii\helpers\Html;
use yii\web\View;
use Da\User\Module as UserModule;
Expand Down Expand Up @@ -38,20 +38,20 @@

<div class="row">
<div class="col-md-12">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title"><?= Html::encode($this->title) ?></h3>
<div class="card">
<div class="card-header">
<h3 class="m-0"><?= Html::encode($this->title) ?></h3>
</div>
<div class="panel-body">
<div class="card-body">
<?= $this->render('/shared/_menu') ?>
<div class="row">
<div class="col-md-3">
<div class="panel panel-default">
<div class="panel-body">
<div class="card">
<div class="card-body">
<?= Nav::widget(
[
'options' => [
'class' => 'nav-pills nav-stacked',
'class' => 'nav-pills nav-stacked flex-column',
],
'items' => [
[
Expand Down Expand Up @@ -134,8 +134,8 @@
</div>
</div>
<div class="col-md-9">
<div class="panel panel-default">
<div class="panel-body">
<div class="card">
<div class="card-body">
<?= $content ?>
</div>
</div>
Expand Down
12 changes: 6 additions & 6 deletions src/User/resources/views/permission/_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
* the LICENSE file that was distributed with this source code.
*/

use dosamigos\selectize\SelectizeDropDownList;
use yii\helpers\ArrayHelper;
use yii\helpers\Html;
use yii\widgets\ActiveForm;
use yii\bootstrap5\ActiveForm;
use kartik\select2\Select2;

/**
* @var yii\web\View $this
Expand All @@ -33,18 +33,18 @@

<?= $form->field($model, 'description') ?>

<?= $form->field($model, 'rule')->widget(SelectizeDropDownList::class, [
'items' => ArrayHelper::map(Yii::$app->getAuthManager()->getRules(), 'name', 'name'),
<?= $form->field($model, 'rule')->widget(Select2::class, [
'data' => ArrayHelper::map(Yii::$app->getAuthManager()->getRules(), 'name', 'name'),
'options' => [
'prompt' => Yii::t('usuario', 'Select rule...'),
]
]) ?>


<?= $form->field($model, 'children')->widget(
SelectizeDropDownList::class,
Select2::class,
[
'items' => $unassignedItems,
'data' => $unassignedItems,
'options' => [
'id' => 'children',
'multiple' => true,
Expand Down
Loading

0 comments on commit b8e34e0

Please sign in to comment.