mirror of
https://github.com/redmine/redmine.git
synced 2026-01-13 19:13:05 +01:00
Patch by Katsuya HIDAKA (user:hidakatsuya). git-svn-id: https://svn.redmine.org/redmine/trunk@24085 e93f8b46-1217-0410-a6f0-8f06a7374b81
64 lines
1.5 KiB
JavaScript
64 lines
1.5 KiB
JavaScript
import { Controller } from "@hotwired/stimulus"
|
|
|
|
export default class extends Controller {
|
|
static targets = ["display", "relations", "progress"]
|
|
|
|
static values = {
|
|
unavailableColumns: Array
|
|
}
|
|
|
|
initialize() {
|
|
this.$ = window.jQuery
|
|
}
|
|
|
|
connect() {
|
|
this.#dispatchInitialStates()
|
|
this.#disableUnavailableColumns()
|
|
}
|
|
|
|
toggleDisplay(event) {
|
|
this.dispatch("toggle-display", {
|
|
detail: { enabled: event.currentTarget.checked }
|
|
})
|
|
}
|
|
|
|
toggleRelations(event) {
|
|
this.dispatch("toggle-relations", {
|
|
detail: { enabled: event.currentTarget.checked }
|
|
})
|
|
}
|
|
|
|
toggleProgress(event) {
|
|
this.dispatch("toggle-progress", {
|
|
detail: { enabled: event.currentTarget.checked }
|
|
})
|
|
}
|
|
|
|
#dispatchInitialStates() {
|
|
if (this.hasDisplayTarget) {
|
|
this.dispatch("toggle-display", {
|
|
detail: { enabled: this.displayTarget.checked }
|
|
})
|
|
}
|
|
if (this.hasRelationsTarget) {
|
|
this.dispatch("toggle-relations", {
|
|
detail: { enabled: this.relationsTarget.checked }
|
|
})
|
|
}
|
|
if (this.hasProgressTarget) {
|
|
this.dispatch("toggle-progress", {
|
|
detail: { enabled: this.progressTarget.checked }
|
|
})
|
|
}
|
|
}
|
|
|
|
#disableUnavailableColumns() {
|
|
if (!Array.isArray(this.unavailableColumnsValue)) {
|
|
return
|
|
}
|
|
this.unavailableColumnsValue.forEach((column) => {
|
|
this.$("#available_c, #selected_c").children(`[value='${column}']`).prop("disabled", true)
|
|
})
|
|
}
|
|
}
|