Add basic Buefy support for batch refresh, execute buttons
still doesn't yet handle the "execution options" use case though
This commit is contained in:
parent
93d0cfcfeb
commit
a125e381a9
|
@ -3,6 +3,7 @@
|
|||
|
||||
<%def name="extra_javascript()">
|
||||
${parent.extra_javascript()}
|
||||
% if not use_buefy:
|
||||
${h.javascript_link(request.static_url('tailbone:static/js/tailbone.batch.js') + '?ver={}'.format(tailbone.__version__))}
|
||||
<script type="text/javascript">
|
||||
|
||||
|
@ -26,6 +27,7 @@
|
|||
});
|
||||
|
||||
</script>
|
||||
% endif
|
||||
</%def>
|
||||
|
||||
<%def name="extra_styles()">
|
||||
|
@ -58,21 +60,61 @@
|
|||
</%def>
|
||||
|
||||
<%def name="refresh_button()">
|
||||
% if master.viewing and master.batch_refreshable(batch) and request.has_perm('{}.refresh'.format(permission_prefix)):
|
||||
<button type="button" id="refresh-data">Refresh Data</button>
|
||||
% if master.batch_refreshable(batch) and request.has_perm('{}.refresh'.format(permission_prefix)):
|
||||
% if use_buefy:
|
||||
## TODO: this should surely use a POST request?
|
||||
<a class="button"
|
||||
href="${url('{}.refresh'.format(route_prefix), uuid=batch.uuid)}">
|
||||
Refresh Data
|
||||
</a>
|
||||
% else:
|
||||
<button type="button" class="button" id="refresh-data">Refresh Data</button>
|
||||
% endif
|
||||
% endif
|
||||
</%def>
|
||||
|
||||
<%def name="execute_submit_button()">
|
||||
<button type="submit"
|
||||
class="button is-primary"
|
||||
% if not execute_enabled:
|
||||
disabled="disabled"
|
||||
% endif
|
||||
% if why_not_execute:
|
||||
title="${why_not_execute}"
|
||||
% endif
|
||||
>
|
||||
${execute_title}
|
||||
</button>
|
||||
</%def>
|
||||
|
||||
<%def name="execute_button()">
|
||||
% if not batch.executed and request.has_perm('{}.execute'.format(permission_prefix)):
|
||||
% if execute_enabled:
|
||||
<button type="button" id="execute-batch">${execute_title}</button>
|
||||
% elif why_not_execute:
|
||||
<button type="button" id="execute-batch" disabled="disabled" title="${why_not_execute}">${execute_title}</button>
|
||||
|
||||
% if use_buefy:
|
||||
% if master.has_execution_options(batch):
|
||||
## TODO: this doesn't work yet
|
||||
${execute_submit_button()}
|
||||
% else:
|
||||
<button type="button" id="execute-batch" disabled="disabled">${execute_title}</button>
|
||||
${execute_form.render_deform(buttons=capture(execute_submit_button))|n}
|
||||
% endif
|
||||
|
||||
% else:
|
||||
## no buefy, do legacy thing
|
||||
<button type="button"
|
||||
class="button is-primary"
|
||||
id="execute-batch"
|
||||
% if not execute_enabled:
|
||||
disabled="disabled"
|
||||
% endif
|
||||
% if why_not_execute:
|
||||
title="${why_not_execute}"
|
||||
% endif
|
||||
>
|
||||
${execute_title}
|
||||
</button>
|
||||
% endif
|
||||
% endif
|
||||
|
||||
</%def>
|
||||
|
||||
<%def name="object_helpers()">
|
||||
|
@ -132,7 +174,7 @@
|
|||
${rows_grid|n}
|
||||
% endif
|
||||
|
||||
% if master.handler.executable(batch) and not batch.executed:
|
||||
% if not use_buefy and master.handler.executable(batch) and not batch.executed:
|
||||
<div id="execution-options-dialog" style="display: none;">
|
||||
${execute_form.render_deform(form_kwargs={'name': 'batch-execution'}, buttons=False)|n}
|
||||
</div>
|
||||
|
|
Loading…
Reference in a new issue