From 94f027f546aef4f2f043718cbd8cb81f9d2aec9c Mon Sep 17 00:00:00 2001 From: Andreas Nedbal Date: Sun, 10 Mar 2024 15:28:24 +0100 Subject: [PATCH] Add Stimulus tooltip controller --- .../retrospring/controllers/tooltip_controller.ts | 8 ++++++++ app/javascript/retrospring/initializers/stimulus.ts | 2 ++ 2 files changed, 10 insertions(+) create mode 100644 app/javascript/retrospring/controllers/tooltip_controller.ts diff --git a/app/javascript/retrospring/controllers/tooltip_controller.ts b/app/javascript/retrospring/controllers/tooltip_controller.ts new file mode 100644 index 00000000..a6c61fa0 --- /dev/null +++ b/app/javascript/retrospring/controllers/tooltip_controller.ts @@ -0,0 +1,8 @@ +import { Controller } from '@hotwired/stimulus'; +import { Tooltip } from 'bootstrap'; + +export default class extends Controller { + connect(): void { + new Tooltip(this.element); + } +} diff --git a/app/javascript/retrospring/initializers/stimulus.ts b/app/javascript/retrospring/initializers/stimulus.ts index 505d23ad..0c775324 100644 --- a/app/javascript/retrospring/initializers/stimulus.ts +++ b/app/javascript/retrospring/initializers/stimulus.ts @@ -17,6 +17,7 @@ import ShareController from "retrospring/controllers/share_controller"; import ClipboardController from "retrospring/controllers/clipboard_controller"; import QuestionboxFocusController from "retrospring/controllers/questionbox_focus_controller"; import ReactionController from "retrospring/controllers/reaction_controller"; +import TooltipController from "retrospring/controllers/tooltip_controller"; /** * This module sets up Stimulus and our controllers @@ -45,4 +46,5 @@ export default function (): void { window['Stimulus'].register('clipboard', ClipboardController); window['Stimulus'].register('questionbox-focus', QuestionboxFocusController); window['Stimulus'].register('reaction', ReactionController); + window['Stimulus'].register('tooltip', TooltipController); }