Sha256: c4977b57f4a20a26480315fd38a279c00c4526165c02f934fdf7c242cdc51c9d

Contents?: true

Size: 570 Bytes

Versions: 2

Compression:

Stored size: 570 Bytes

Contents

import {Controller} from "stimulus"

export default class extends Controller {
    static get targets() {
        return ["form", "select", "method"]
    }

    connect() {
        this.wrapperClass = "table-actions"
    }

    update(event) {
        event.preventDefault()
        const option = this.selectTarget.options[this.selectTarget.selectedIndex]
        const action = this.selectTarget.value
        const method = option.dataset.method

        // Replace form action
        this.formTarget.action = action
        this.methodTarget.value = method
    }
}

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
headmin-0.1.2 src/js/headmin/controllers/table_actions_controller.js
headmin-0.1.1 src/js/headmin/controllers/table_actions_controller.js