From 637c249c3647ff2b40528bf73263a9012cac0b24 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Fri, 26 Feb 2021 21:49:58 -0600 Subject: [PATCH] Handle row click as if checkbox was clicked, for checkable grid should be more convenient since the checkbox is a rather small target as compared to the row itself. this also brings in newer Buefy 0.8.6 b/c it includes "shift+click" behavior for the checkbox: - https://github.com/buefy/buefy/issues/535 - https://github.com/buefy/buefy/pull/1894 --- tailbone/templates/grids/buefy.mako | 15 +++++++++++++++ tailbone/templates/themes/falafel/base.mako | 4 +--- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/tailbone/templates/grids/buefy.mako b/tailbone/templates/grids/buefy.mako index 5bd0e619..00b9ce9e 100644 --- a/tailbone/templates/grids/buefy.mako +++ b/tailbone/templates/grids/buefy.mako @@ -143,6 +143,7 @@ :checkable="checkable" % if grid.checkboxes: :checked-rows.sync="checkedRows" + @click="rowClick" % endif % if grid.check_handler: @check="${grid.check_handler}" @@ -446,6 +447,20 @@ } return uuids }, + + // when a user clicks a row, handle as if they clicked checkbox. + // note that this method is only used if table is "checkable" + rowClick(row) { + let i = this.checkedRows.indexOf(row) + if (i >= 0) { + this.checkedRows.splice(i, 1) + } else { + this.checkedRows.push(row) + } + % if grid.check_handler: + this.${grid.check_handler}(this.checkedRows, row) + % endif + }, } } diff --git a/tailbone/templates/themes/falafel/base.mako b/tailbone/templates/themes/falafel/base.mako index 099fca16..28ff4f6e 100644 --- a/tailbone/templates/themes/falafel/base.mako +++ b/tailbone/templates/themes/falafel/base.mako @@ -114,9 +114,7 @@ <%def name="buefy()"> - ## Buefy (last known good @ 0.8.2) - ## ${h.javascript_link('https://unpkg.com/buefy/dist/buefy.min.js')} - ${h.javascript_link('https://unpkg.com/buefy@0.8.2/dist/buefy.min.js')} + ${h.javascript_link('https://unpkg.com/buefy@0.8.6/dist/buefy.min.js')} <%def name="fontawesome()">