From dc8613885b972c3ed25d114978fc03108927db47 Mon Sep 17 00:00:00 2001 From: Alexis Gousseau Date: Thu, 21 Dec 2023 10:48:01 +0100 Subject: [PATCH 1/7] add disable and close methods for bootstrap tooltips modules --- .../ts/bo/components/PasswordVisibility.vue | 35 +++---------------- resources/ts/modules/bsTooltips.ts | 29 ++++++++++++--- 2 files changed, 29 insertions(+), 35 deletions(-) diff --git a/resources/ts/bo/components/PasswordVisibility.vue b/resources/ts/bo/components/PasswordVisibility.vue index 2a43515..a4ac298 100644 --- a/resources/ts/bo/components/PasswordVisibility.vue +++ b/resources/ts/bo/components/PasswordVisibility.vue @@ -10,7 +10,7 @@ type="button" :title="visible ? __('vue.PasswordVisibility.hide') : __('vue.PasswordVisibility.show')" - data-bs="tooltip" + data-bs-toggle="tooltip" > import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome"; -import { Tooltip } from "bootstrap"; import { defineComponent } from "vue"; +import bsTooltips from "./../../modules/bsTooltips"; import trans from "./../../modules/trans"; export default defineComponent({ name: "PasswordVisibility", - mixins: [trans], + mixins: [bsTooltips, trans], components: { FontAwesomeIcon }, data(): { inputId: string; @@ -68,7 +68,7 @@ export default defineComponent({ } this.input = this.input as HTMLInputElement; this.$nextTick(() => { - this.updateBootstrapTooltip(); + this.initTooltips(); }); }, methods: { @@ -97,32 +97,7 @@ export default defineComponent({ this.visible = false; } this.$nextTick(() => { - this.updateBootstrapTooltip(); - }); - }, - /** - * Update Bootstrap tooltips. - */ - updateBootstrapTooltip() { - let newTooltipList = [].slice.call( - document.querySelectorAll( - ".password-visibility-" + this.inputId + " [data-bs=\"tooltip\"]" - ) - ) as HTMLButtonElement[]; - let tmp = newTooltipList.filter((x) => !this.tooltipList.includes(x)); - tmp.map((tooltip) => { - return new Tooltip(tooltip); - }); - this.closeBootstrapTooltip(); - this.tooltipList = newTooltipList; - }, - /** - * Close all Bootstrap tooltips. - */ - closeBootstrapTooltip() { - this.tooltipList.forEach((tooltip) => { - tooltip.blur(); - Tooltip.getInstance(tooltip)?.hide(); + this.initTooltips(); }); }, }, diff --git a/resources/ts/modules/bsTooltips.ts b/resources/ts/modules/bsTooltips.ts index 6467bcd..8b81cf8 100644 --- a/resources/ts/modules/bsTooltips.ts +++ b/resources/ts/modules/bsTooltips.ts @@ -4,12 +4,11 @@ let tooltips: Array = []; export default { methods: { + /** + * Initialize all Bootstrap tooltips. + */ initTooltips() { - // Disable tooltips on reboot. - tooltips.forEach((tooltip) => { - tooltip.disable(); - tooltip.hide(); - }); + this.disableBootstrapTooltip(); tooltips = [].slice .call(document.querySelectorAll("[data-bs-toggle=\"tooltip\"]")) .map(function (tooltipTriggerEl) { @@ -22,5 +21,25 @@ export default { }); }); }, + /** + * Disable all Bootstrap tooltips. + */ + disableBootstrapTooltip() { + tooltips.forEach((tooltip) => { + tooltip.disable(); + tooltip.hide(); + }); + }, + /** + * Close all Bootstrap tooltips. + */ + closeBootstrapTooltip() { + [].slice + .call(document.querySelectorAll("[data-bs-toggle=\"tooltip\"]")) + .forEach((tooltip: HTMLElement) => { + tooltip.blur(); + window.bootstrap.Tooltip.getInstance(tooltip)?.hide(); + }); + }, }, }; From 5fed08e8f0af8bfdf2a330f7b84a09f4fa4c3bd9 Mon Sep 17 00:00:00 2001 From: Alexis Gousseau Date: Tue, 16 Jan 2024 15:38:07 +0100 Subject: [PATCH 2/7] fix user:create command wording --- app/Console/Commands/UserCreate.php | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/app/Console/Commands/UserCreate.php b/app/Console/Commands/UserCreate.php index df4417b..2bf8d40 100644 --- a/app/Console/Commands/UserCreate.php +++ b/app/Console/Commands/UserCreate.php @@ -8,6 +8,7 @@ use Carbon\Carbon; use Illuminate\Console\Command; use Illuminate\Support\Facades\Validator; use Illuminate\Validation\ValidationException; +use Illuminate\Support\Str; class UserCreate extends Command { @@ -200,18 +201,22 @@ class UserCreate extends Command try { $tmp = $this->choice( 'Select his role', - [RoleEnum::conceptor->label(), RoleEnum::admin->label(), RoleEnum::visitor->label()], - RoleEnum::visitor->label(), + [ + Str::ucFirst(RoleEnum::conceptor->label()), + Str::ucFirst(RoleEnum::admin->label()), + Str::ucFirst(RoleEnum::visitor->label()) + ], + Str::ucFirst(RoleEnum::visitor->label()), $maxAttempts = null, $allowMultipleSelections = false ); - if ($tmp === RoleEnum::conceptor->label()) { + if ($tmp === Str::ucFirst(RoleEnum::conceptor->label())) { $tmp = RoleEnum::conceptor; } - if ($tmp === RoleEnum::admin->label()) { + if ($tmp === Str::ucFirst(RoleEnum::admin->label())) { $tmp = RoleEnum::admin; } - if ($tmp === RoleEnum::visitor->label()) { + if ($tmp === Str::ucFirst(RoleEnum::visitor->label())) { $tmp = RoleEnum::visitor; } $validator = Validator::make(['role' => $tmp], [ From 88febd9773853cdef54ba703ece09ffa0bb388c9 Mon Sep 17 00:00:00 2001 From: Alexis Gousseau Date: Fri, 19 Jan 2024 12:11:23 +0100 Subject: [PATCH 3/7] update bo navigation --- resources/sass/bo/base/_common.scss | 10 ++++++++++ resources/ts/bo/utilities/fontawesome.ts | 4 +++- resources/views/bo/layouts/header.blade.php | 14 ++++++++------ resources/views/bo/layouts/nav-list.blade.php | 11 ++++++----- 4 files changed, 27 insertions(+), 12 deletions(-) diff --git a/resources/sass/bo/base/_common.scss b/resources/sass/bo/base/_common.scss index 45080eb..56971d2 100644 --- a/resources/sass/bo/base/_common.scss +++ b/resources/sass/bo/base/_common.scss @@ -1,6 +1,16 @@ // * LAYOUT body { + > nav { + .navbar-toggler.collapsed .navbar-toggler-icon-close { + display: none; + } + + .navbar-toggler:not(.collapsed) .navbar-toggler-icon { + display: inline; + } + } + > main { min-height: calc(100vh - #{$bo-header-height} - #{$bo-footer-height}); margin-top: $bo-header-height; diff --git a/resources/ts/bo/utilities/fontawesome.ts b/resources/ts/bo/utilities/fontawesome.ts index d4b9149..f020f92 100644 --- a/resources/ts/bo/utilities/fontawesome.ts +++ b/resources/ts/bo/utilities/fontawesome.ts @@ -40,7 +40,8 @@ import { faTimes, faTrash, faUndoAlt, - faWandMagic + faWandMagic, + faXmark } from "@fortawesome/free-solid-svg-icons"; config.autoReplaceSvg = false; @@ -81,6 +82,7 @@ library.add(faBan); library.add(faCircleExclamation); library.add(faCircleInfo); library.add(faPaintRoller); +library.add(faXmark); // Front library.add(faChevronLeft); diff --git a/resources/views/bo/layouts/header.blade.php b/resources/views/bo/layouts/header.blade.php index a56df95..5ffc950 100644 --- a/resources/views/bo/layouts/header.blade.php +++ b/resources/views/bo/layouts/header.blade.php @@ -5,9 +5,10 @@ {{ config('app.name', 'Laravel') }} @auth - @endauth @@ -18,10 +19,11 @@