Make stimulus controller failure tolerant
This commit is contained in:
+7
-3
@@ -17,8 +17,12 @@ export default class extends Controller {
|
|||||||
}
|
}
|
||||||
|
|
||||||
disabledValueChanged() {
|
disabledValueChanged() {
|
||||||
this.containerTarget.classList.toggle(this.gridClass, this.disabledValue === false)
|
if (this.hasContainerTarget) {
|
||||||
let icon = this.disabledValue ? '#icon-grid' : '#icon-block'
|
this.containerTarget.classList.toggle(this.gridClass, this.disabledValue === false)
|
||||||
this.iconTarget.setAttribute('href', icon)
|
}
|
||||||
|
if (this.hasIconTarget) {
|
||||||
|
let icon = this.disabledValue ? '#icon-grid' : '#icon-block'
|
||||||
|
this.iconTarget.setAttribute('href', icon)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user