diff --git a/tailbone/static/js/tailbone.buefy.grid.js b/tailbone/static/js/tailbone.buefy.grid.js index 8af8b5b0..2c9a66ba 100644 --- a/tailbone/static/js/tailbone.buefy.grid.js +++ b/tailbone/static/js/tailbone.buefy.grid.js @@ -93,6 +93,13 @@ Vue.component('grid-filter', GridFilter) let TailboneGrid = { template: '#tailbone-grid-template', + computed: { + // note, can use this with v-model for hidden 'uuids' fields + selected_uuids: function() { + return this.checkedRowUUIDs().join(',') + }, + }, + methods: { getRowClass(row, index) { @@ -232,8 +239,8 @@ let TailboneGrid = { }, checkedRowUUIDs() { - var uuids = []; - for (var row of this.$data.checkedRows) { + let uuids = [] + for (let row of this.$data.checkedRows) { uuids.push(row.uuid) } return uuids diff --git a/tailbone/templates/master/index.mako b/tailbone/templates/master/index.mako index e8ea6e17..dd0015eb 100644 --- a/tailbone/templates/master/index.mako +++ b/tailbone/templates/master/index.mako @@ -171,18 +171,41 @@ % endif ## enable / disable selected objects - % if master.supports_set_enabled_toggle and request.has_perm('{}.enable_disable_set'.format(permission_prefix)): - ${h.form(url('{}.enable_set'.format(route_prefix)), name='enable-set', class_='control')} - ${h.csrf_token(request)} - ${h.hidden('uuids')} - - ${h.end_form()} + % if master.supports_set_enabled_toggle and master.has_perm('enable_disable_set'): - ${h.form(url('{}.disable_set'.format(route_prefix)), name='disable-set', class_='control')} - ${h.csrf_token(request)} - ${h.hidden('uuids')} - - ${h.end_form()} + % if use_buefy: + ${h.form(url('{}.enable_set'.format(route_prefix)), class_='control', ref='enable_selected_form')} + ${h.csrf_token(request)} + ${h.hidden('uuids', v_model='selected_uuids')} + + {{ enableSelectedText }} + + ${h.end_form()} + % else: + ${h.form(url('{}.enable_set'.format(route_prefix)), name='enable-set', class_='control')} + ${h.csrf_token(request)} + ${h.hidden('uuids')} + + ${h.end_form()} + % endif + + % if use_buefy: + ${h.form(url('{}.disable_set'.format(route_prefix)), class_='control', ref='disable_selected_form')} + ${h.csrf_token(request)} + ${h.hidden('uuids', v_model='selected_uuids')} + + {{ disableSelectedText }} + + ${h.end_form()} + % else: + ${h.form(url('{}.disable_set'.format(route_prefix)), name='disable-set', class_='control')} + ${h.csrf_token(request)} + ${h.hidden('uuids')} + + ${h.end_form()} + % endif % endif ## delete selected objects @@ -274,6 +297,72 @@ ${grid.render_buefy(tools=capture(self.grid_tools).strip(), context_menu=capture(self.context_menu_items).strip())|n} +<%def name="modify_this_page_vars()"> + ${parent.modify_this_page_vars()} + + + % if use_buefy: ${parent.body()}