21 lines
582 B
JavaScript
21 lines
582 B
JavaScript
// assets/controllers/modpack_download_controller.js
|
|
import { Controller } from "@hotwired/stimulus"
|
|
|
|
export default class extends Controller {
|
|
static values = { url: String }
|
|
|
|
submit(event) {
|
|
event.preventDefault()
|
|
|
|
const checked = [...this.element.querySelectorAll('input[type=checkbox]:checked')]
|
|
.map(el => el.value)
|
|
|
|
const url = this.urlValue + (checked.length ? '?opt=' + checked.join('+') : '')
|
|
|
|
window.location.href = url
|
|
}
|
|
|
|
changeVersion(event) {
|
|
window.location.href = '?v=' + event.target.value
|
|
}
|
|
}
|