diff --git a/assets/app.js b/assets/app.js index ca0f83b..b9b938e 100644 --- a/assets/app.js +++ b/assets/app.js @@ -42,6 +42,16 @@ function columnFromTh(th, rowUrl) { const short = s.length > 70 ? s.slice(0, 70) + '…' : s; return `${esc(short)}`; }; + } else if (th.dataset.format === 'pick') { + // a row-select checkbox + quantity, for "add these to the tracker" + col.render = (val, type, row) => { + if (type !== 'display') return ''; + return ` + + + `; + }; } else { col.render = (val, type) => (type === 'display' ? esc(val) : (val ?? '')); } diff --git a/assets/controllers/tracker_picker_controller.js b/assets/controllers/tracker_picker_controller.js new file mode 100644 index 0000000..9c9d879 --- /dev/null +++ b/assets/controllers/tracker_picker_controller.js @@ -0,0 +1,41 @@ +import { Controller } from '@hotwired/stimulus'; + +/* + * Collects the ticked rows (+ their quantity) from a DataTable and POSTs them + * to the combat tracker. + * + *