Add "refresh" button when viewing batch

This commit is contained in:
Lance Edgar 2016-09-18 17:15:58 -05:00
parent 679dce4ed8
commit 93fcc72f73

View file

@ -6,7 +6,18 @@
${h.javascript_link(request.static_url('tailbone:static/js/jquery.ui.tailbone.js'))} ${h.javascript_link(request.static_url('tailbone:static/js/jquery.ui.tailbone.js'))}
${h.javascript_link(request.static_url('tailbone:static/js/tailbone.batch.js'))} ${h.javascript_link(request.static_url('tailbone:static/js/tailbone.batch.js'))}
<script type="text/javascript"> <script type="text/javascript">
var has_execution_options = ${'true' if master.has_execution_options else 'false'}; var has_execution_options = ${'true' if master.has_execution_options else 'false'};
$(function() {
$('#refresh-data').click(function() {
$(this)
.button('option', 'disabled', true)
.button('option', 'label', "Working, please wait...");
location.href = '${url('{}.refresh'.format(route_prefix), uuid=batch.uuid)}';
});
});
</script> </script>
<style type="text/css"> <style type="text/css">
@ -25,9 +36,16 @@
</%def> </%def>
<%def name="buttons()"> <%def name="buttons()">
## TODO: the refreshable thing still seems confusing...
<div class="buttons"> <div class="buttons">
% if not form.readonly and batch.refreshable: % if master.refreshable:
${h.submit('save-refresh', "Save & Refresh Data")} % if form.readonly:
% if not batch.executed:
<button type="button" id="refresh-data">Refresh Data</button>
% endif
% elif batch.refreshable:
${h.submit('save-refresh', "Save & Refresh Data")}
% endif
% endif % endif
% if not batch.executed and request.has_perm('{}.execute'.format(permission_prefix)): % if not batch.executed and request.has_perm('{}.execute'.format(permission_prefix)):
<button type="button" id="execute-batch"${'' if execute_enabled else ' disabled="disabled"'}>${execute_title}</button> <button type="button" id="execute-batch"${'' if execute_enabled else ' disabled="disabled"'}>${execute_title}</button>