Fix "toggle batch complete" for Chrome browser

This commit is contained in:
Lance Edgar 2023-01-13 16:49:16 -06:00
parent cac005f993
commit 83f9a3faa7
3 changed files with 26 additions and 17 deletions

View file

@ -431,11 +431,10 @@ class BatchMasterView(MasterView):
return dict(batch.params or {})
def render_complete(self, batch, field):
permission_prefix = self.get_permission_prefix()
use_buefy = self.get_use_buefy()
text = "Yes" if batch.complete else "No"
if batch.executed or not self.request.has_perm('{}.edit'.format(permission_prefix)):
if batch.executed or not self.has_perm('edit'):
return text
if batch.complete:
@ -445,16 +444,18 @@ class BatchMasterView(MasterView):
label = "Mark Complete"
value = 'true'
kwargs = {}
url = self.get_action_url('toggle_complete', batch)
kwargs = {'@submit': 'togglingBatchComplete = true'}
if not use_buefy:
kwargs['class_'] = 'autodisable'
begin_form = tags.form(self.get_action_url('toggle_complete', batch), **kwargs)
begin_form = tags.form(url, **kwargs)
if use_buefy:
submit = HTML.tag('once-button',
type='is-primary',
native_type='submit',
text=label)
label = HTML.literal(
'{{{{ togglingBatchComplete ? "Working, please wait..." : "{}" }}}}'.format(label))
submit = self.make_buefy_button(label, is_primary=True,
native_type='submit',
**{':disabled': 'togglingBatchComplete'})
else:
submit = tags.submit('submit', label)