lib/generators/css_zero/add/templates/app/javascript/controllers/combobox_controller.js in css-zero-0.0.51 vs lib/generators/css_zero/add/templates/app/javascript/controllers/combobox_controller.js in css-zero-0.0.52
- old
+ new
@@ -1,11 +1,11 @@
import { Controller } from "@hotwired/stimulus"
import { get } from "@rails/request.js"
import TomSelect from "tom-select"
export default class extends Controller {
- static values = { url: String, create: { type: String, default: "Add" }, noResults: { type: String, default: "No results found" } }
+ static values = { url: String, optionCreate: { type: String, default: "Add" }, noResults: { type: String, default: "No results found" } }
initialize() {
this.load = this.load.bind(this)
}
@@ -26,20 +26,20 @@
const jsonResponse = await response.json
callback(jsonResponse)
}
get #inputSettings() {
- return { render: this.#render, load: (this.hasUrlValue && this.load), persist: false, createOnBlur: true, create: true }
+ return { render: this.#render, load: this.hasUrlValue && this.load, persist: false, createOnBlur: true, create: true }
}
get #selectSettings() {
- return { render: this.#render, load: (this.hasUrlValue && this.load) }
+ return { render: this.#render, load: this.hasUrlValue && this.load }
}
get #render() {
return {
option_create: (data, escape) => {
- return `<div class="create">${this.createValue} <b>${escape(data.input)}</b>...</div>`
+ return `<div class="create">${this.optionCreateValue} <b>${escape(data.input)}</b>...</div>`
},
no_results: () => {
return `<div class="no-results">${this.noResultsValue}</div>`
}
}