Refactor all Buefy form submit buttons, per Chrome behavior

ugh, what a pain.  and turns out i'd previously ran into this same issue for
jQuery, per commit e945ebe325
This commit is contained in:
Lance Edgar 2019-06-25 20:32:49 -05:00
parent 43a210cac4
commit a4b27115ac
17 changed files with 517 additions and 319 deletions

View file

@ -75,16 +75,27 @@
</%def>
<%def name="execute_submit_button()">
<once-button type="is-primary"
native-type="submit"
% if not execute_enabled:
disabled
% endif
% if why_not_execute:
title="${why_not_execute}"
% endif
text="${execute_title}">
</once-button>
<b-button type="is-primary"
% if master.has_execution_options(batch):
@click="executeBatch"
% else:
native-type="submit"
% endif
% if not execute_enabled:
disabled
% elif not master.has_execution_options(batch):
:disabled="executeFormSubmitting"
% endif
% if why_not_execute:
title="${why_not_execute}"
% endif
>
% if master.has_execution_options(batch):
${execute_title}
% else:
{{ executeFormButtonText }}
% endif
</b-button>
</%def>
<%def name="object_helpers()">
@ -131,8 +142,7 @@
<p>Batch has not yet been executed.</p>
% if use_buefy:
% if master.has_execution_options(batch):
## TODO: this doesn't work yet
${self.execute_submit_button()}
<p>TODO: must implement execution with options</p>
% else:
<execute-form></execute-form>
% endif
@ -180,19 +190,26 @@
<%def name="render_this_page_buefy()">
% if use_buefy and master.handler.executable(batch) and request.has_perm('{}.execute'.format(permission_prefix)):
## TODO: stop using |n filter
${execute_form.render_deform(buttons=capture(execute_submit_button))|n}
${execute_form.render_deform(buttons=capture(execute_submit_button), form_kwargs={'@submit': 'submitExecuteForm'})|n}
% endif
${parent.render_this_page_buefy()}
</%def>
<%def name="declare_page_vars()">
${parent.declare_page_vars()}
<%def name="modify_this_page()">
${parent.modify_this_page()}
% if not batch.executed and request.has_perm('{}.execute'.format(permission_prefix)):
<script type="text/javascript">
let ${execute_form.component_studly} = {
template: '#${execute_form.component}-template',
methods: {}
${execute_form.component_studly}Data.executeFormButtonText = "${execute_title}"
${execute_form.component_studly}Data.executeFormSubmitting = false
${execute_form.component_studly}.methods.executeBatch = function() {
alert("TODO: implement options dialog for batch execution")
}
${execute_form.component_studly}.methods.submitExecuteForm = function() {
this.executeFormSubmitting = true
this.executeFormButtonText = "Executing, please wait..."
}
</script>