Sha256: 593004c507358963ed92a9b7fe1c96f691d633408785efd01768b7be09728067
Contents?: true
Size: 791 Bytes
Versions: 3
Compression:
Stored size: 791 Bytes
Contents
import $ from 'jquery' import visit from '../core/visit' // Allow clicking on any part of a table row to follow either the table's data-url // or the first link within the row (that is not in the actions column). $(document).on('click', 'tr[data-url]:not([data-behavior="dialog"])', function (e) { let row = $(e.currentTarget) let url if (row.data('url') === 'auto') { url = row.find('td:not(.actions) a:first').attr('href') } else { url = row.data('url') } if (url) { if (e.metaKey || e.ctrlKey) { window.open(url, '_blank') } else { visit(url) } } }) // Ignore the above event handler when clicking directly on a link or input element $(document).on('click', 'tr[data-url] a, tr[data-url] input', function (e) { e.stopPropagation() })
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
trestle-0.9.2 | frontend/js/components/table.js |
trestle-0.9.1 | frontend/js/components/table.js |
trestle-0.9.0 | frontend/js/components/table.js |