1// Hides mailbox/owner fields on admin space create when the selected label 2// has create_admin_only_user. Nested inputs are disabled while hidden so 3// leftover values are not submitted. 4import { Controller } from "@hotwired/stimulus" 5 6export default class extends Controller { 7 static targets = ["labelSelect", "ownerFields"] 8 static values = { 9 adminOnlyByLabel: Object, 10 defaultAdminOnly: Boolean 11 } 12 13 connect() { 14 this.refresh() 15 } 16 17 refresh() { 18 const adminOnly = this.adminOnlyForSelection() 19 20 this.ownerFieldsTargets.forEach((section) => { 21 section.classList.toggle("hidden", adminOnly) 22 section.querySelectorAll("input, select, textarea").forEach((input) => { 23 input.disabled = adminOnly 24 }) 25 }) 26 } 27 28 adminOnlyForSelection() { 29 if (this.hasLabelSelectTarget) { 30 const labelId = this.labelSelectTarget.value 31 return Boolean(this.adminOnlyByLabelValue[labelId]) 32 } 33 34 return this.defaultAdminOnlyValue 35 } 36};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.