diff --git a/tailbone/static/js/tailbone.buefy.grid.js b/tailbone/static/js/tailbone.buefy.grid.js index c2720340..72312e12 100644 --- a/tailbone/static/js/tailbone.buefy.grid.js +++ b/tailbone/static/js/tailbone.buefy.grid.js @@ -147,6 +147,12 @@ let TailboneGrid = { this.applyFilters(params) }, + deleteObject(event) { + // we let parent component/app deal with this, in whatever way makes sense... + // TODO: should we ever provide anything besides the URL for this? + this.$emit('deleteActionClicked', event.target.href) + }, + deleteResults(event) { // submit form if user confirms @@ -166,3 +172,9 @@ let TailboneGrid = { } } } + + +let GridPage = { + template: '#grid-page-template', + methods: {} +} diff --git a/tailbone/templates/grids/buefy.mako b/tailbone/templates/grids/buefy.mako index 1cc12910..f61c51c4 100644 --- a/tailbone/templates/grids/buefy.mako +++ b/tailbone/templates/grids/buefy.mako @@ -145,7 +145,12 @@ % if grid.main_actions or grid.more_actions: % for action in grid.main_actions: - + + ${action.label}   @@ -224,7 +229,3 @@ } - -
- -
diff --git a/tailbone/templates/master/form.mako b/tailbone/templates/master/form.mako index 02984226..ddfd8f73 100644 --- a/tailbone/templates/master/form.mako +++ b/tailbone/templates/master/form.mako @@ -8,7 +8,7 @@ ## note, the `ref` here is for buefy only ${h.form(action_url('delete', instance), ref='deleteObjectForm')} ${h.csrf_token(request)} - @@ -235,6 +250,27 @@ % if use_buefy: ## TODO: stop using |n filter ${grid.render_buefy(tools=capture(self.grid_tools).strip(), context_menu=capture(self.context_menu_items).strip())|n} + + + +
+ +
+ ${self.make_tailbone_grid_app()} % else: diff --git a/tailbone/templates/master/view.mako b/tailbone/templates/master/view.mako index c5473c23..8304417a 100644 --- a/tailbone/templates/master/view.mako +++ b/tailbone/templates/master/view.mako @@ -112,6 +112,11 @@ ${self.render_form_complete()}

## TODO: stop using |n filter ${rows_grid.render_buefy(allow_save_defaults=False, tools=capture(self.render_row_grid_tools))|n} + +
+ +
+ ${self.make_tailbone_grid_app()} % else: ## no buefy, so do the traditional thing diff --git a/tailbone/views/master.py b/tailbone/views/master.py index fd3985d6..5764684e 100644 --- a/tailbone/views/master.py +++ b/tailbone/views/master.py @@ -2395,11 +2395,19 @@ class MasterView(View): actions = [] prefix = self.get_permission_prefix() use_buefy = self.get_use_buefy() + + # Edit if self.editable and self.request.has_perm('{}.edit'.format(prefix)): icon = 'edit' if use_buefy else 'pencil' actions.append(self.make_action('edit', icon=icon, url=self.default_edit_url)) + + # Delete if self.deletable and self.request.has_perm('{}.delete'.format(prefix)): - actions.append(self.make_action('delete', icon='trash', url=self.default_delete_url)) + kwargs = {} + if use_buefy and self.delete_confirm == 'simple': + kwargs['click_handler'] = 'deleteObject' + actions.append(self.make_action('delete', icon='trash', url=self.default_delete_url, **kwargs)) + return actions def default_edit_url(self, row, i=None):