diff --git a/assets/controllers/materialize/collapsible_controller.js b/assets/controllers/materialize/collapsible_controller.js new file mode 100644 index 000000000..b9e60f38c --- /dev/null +++ b/assets/controllers/materialize/collapsible_controller.js @@ -0,0 +1,16 @@ +import { Controller } from '@hotwired/stimulus'; +import M from '@materializecss/materialize'; + +export default class extends Controller { + static values = { + accordion: { type: Boolean, default: true }, + }; + + connect() { + this.instance = M.Collapsible.init(this.element, { accordion: this.accordionValue }); + } + + disconnect() { + this.instance.destroy(); + } +} diff --git a/assets/index.js b/assets/index.js index 675db5dab..7d53241c3 100755 --- a/assets/index.js +++ b/assets/index.js @@ -273,10 +273,6 @@ const articleScroll = () => { $(document).ready(() => { $('select').formSelect(); - $('.collapsible[data-collapsible="accordion"]').collapsible(); - $('.collapsible[data-collapsible="expandable"]').collapsible({ - accordion: false, - }); $('.dropdown-trigger').dropdown({ hover: false }); $('.dropdown-trigger[data-covertrigger="false"][data-constrainwidth="false"]').dropdown({ diff --git a/templates/Developer/index.html.twig b/templates/Developer/index.html.twig index fa437d0ae..69cb0498d 100644 --- a/templates/Developer/index.html.twig +++ b/templates/Developer/index.html.twig @@ -25,7 +25,7 @@