Sha256: 55a1b9d15226adde72fb9cae4dd986b6997bdaeda7ca5d7b588be3206c9576d8
Contents?: true
Size: 615 Bytes
Versions: 19
Compression:
Stored size: 615 Bytes
Contents
import { Controller } from '@hotwired/stimulus' export default class extends Controller { visitRecord(event) { if (event.type === 'click') { const isLinkOrButton = event.target.closest('a, button') const isCheckbox = event.target.closest('input[type="checkbox"]') if (isLinkOrButton || isCheckbox) { return // Don't navigate if a link or button is clicked } this.#executeTheVisit(event) } } #executeTheVisit(event) { const row = event.target.closest('tr') if (row && row.dataset.visitPath) { window.Turbo.visit(row.dataset.visitPath) } } }
Version data entries
19 entries across 19 versions & 1 rubygems