From 32108379ac530c4ee944b3d887ff4f19e621e2a2 Mon Sep 17 00:00:00 2001 From: Bilel Kihal <61744974+Bilelkihal@users.noreply.github.com> Date: Tue, 1 Aug 2023 10:49:03 +0000 Subject: [PATCH] use stimulus values in select input component controller --- .../select_input_component_controller.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/components/select_input_component/select_input_component_controller.js b/app/components/select_input_component/select_input_component_controller.js index 45c50a4d4..5002e90ea 100644 --- a/app/components/select_input_component/select_input_component_controller.js +++ b/app/components/select_input_component/select_input_component_controller.js @@ -2,12 +2,16 @@ import { Controller } from "@hotwired/stimulus" import TomSelect from "tom-select" export default class extends Controller { + static values = { + multiple: Boolean, + openAdd : Boolean + } connect() { let myOptions = {} - if (this.data.get("multipleValue")) { + if (this.multipleValue) { myOptions['plugins'] = ['remove_button']; } - if (this.data.get("openAddValue")) { + if (this.openAddValue) { myOptions['create'] = true; } new TomSelect(this.element, myOptions);