From 0589066ed172af58df1b67016599c02e31eecf0a Mon Sep 17 00:00:00 2001 From: Yassine Guedidi Date: Sat, 1 Mar 2025 00:10:16 +0100 Subject: [PATCH] Extract Materialize Tabs controller --- assets/controllers/materialize/tabs_controller.js | 12 ++++++++++++ assets/index.js | 1 - templates/Config/index.html.twig | 2 +- templates/Static/about.html.twig | 2 +- templates/Static/howto.html.twig | 2 +- .../CraueConfigBundle/Settings/modify.html.twig | 2 +- 6 files changed, 16 insertions(+), 5 deletions(-) create mode 100644 assets/controllers/materialize/tabs_controller.js diff --git a/assets/controllers/materialize/tabs_controller.js b/assets/controllers/materialize/tabs_controller.js new file mode 100644 index 000000000..312b486d4 --- /dev/null +++ b/assets/controllers/materialize/tabs_controller.js @@ -0,0 +1,12 @@ +import { Controller } from '@hotwired/stimulus'; +import M from '@materializecss/materialize'; + +export default class extends Controller { + connect() { + this.instance = M.Tabs.init(this.element); + } + + disconnect() { + this.instance.destroy(); + } +} diff --git a/assets/index.js b/assets/index.js index a5351033a..a40231542 100755 --- a/assets/index.js +++ b/assets/index.js @@ -285,7 +285,6 @@ $(document).ready(() => { constrainWidth: false, }); - $('.tabs').tabs(); $('.tooltipped').tooltip(); $('.fixed-action-btn').floatingActionButton(); diff --git a/templates/Config/index.html.twig b/templates/Config/index.html.twig index add3d3577..1b4a6a055 100644 --- a/templates/Config/index.html.twig +++ b/templates/Config/index.html.twig @@ -10,7 +10,7 @@
-