Browse Source

Remove dead code (#380)

pull/382/head
baarkerlounger 3 years ago committed by GitHub
parent
commit
55da3b7112
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 35
      app/webpacker/controllers/conditional_question_controller.js

35
app/webpacker/controllers/conditional_question_controller.js

@ -6,25 +6,6 @@ export default class extends Controller {
} }
displayConditional() { displayConditional() {
switch(this.element.type) {
case "number":
this.displayConditionalNumeric()
case "radio":
this.displayConditionalRadio()
default:
break;
}
}
clearTextNumericInput(input) {
input.value = ""
}
clearDateInputs(inputs) {
inputs.forEach((input) => { input.value = "" })
}
displayConditionalRadio() {
if(this.element.checked) { if(this.element.checked) {
let selectedValue = this.element.value let selectedValue = this.element.value
let conditional_for = JSON.parse(this.element.dataset.info) let conditional_for = JSON.parse(this.element.dataset.info)
@ -45,17 +26,11 @@ export default class extends Controller {
} }
} }
displayConditionalNumeric() { clearTextNumericInput(input) {
let enteredValue = this.element.value input.value = ""
let conditional_for = JSON.parse(this.element.dataset.info)
Object.entries(conditional_for).map(([targetQuestion, condition]) => {
let div = document.getElementById(targetQuestion + "_div")
if(eval((enteredValue + condition))) {
div.style.display = "block"
} else {
div.style.display = "none"
} }
})
clearDateInputs(inputs) {
inputs.forEach((input) => { input.value = "" })
} }
} }

Loading…
Cancel
Save