Refactor batch execution options to use colander/deform
This commit is contained in:
parent
2cbacd6187
commit
dd04459748
12 changed files with 87 additions and 99 deletions
|
@ -6,8 +6,6 @@
|
|||
${h.javascript_link(request.static_url('tailbone:static/js/tailbone.batch.js'))}
|
||||
<script type="text/javascript">
|
||||
|
||||
var has_execution_options = ${'true' if master.has_execution_options(batch) else 'false'};
|
||||
|
||||
$(function() {
|
||||
|
||||
$('#save-refresh').click(function() {
|
||||
|
@ -55,13 +53,3 @@
|
|||
<div class="form-wrapper">
|
||||
${form.render()|n}
|
||||
</div>
|
||||
|
||||
<div id="execution-options-dialog" style="display: none;">
|
||||
|
||||
${h.form(url('{}.execute'.format(route_prefix), uuid=batch.uuid), name='batch-execution')}
|
||||
% if master.has_execution_options(batch):
|
||||
${rendered_execution_options|n}
|
||||
% endif
|
||||
${h.end_form()}
|
||||
|
||||
</div>
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
## -*- coding: utf-8 -*-
|
||||
|
||||
${form.field_div('action', form.select('action', options=ACTION_OPTIONS), label="Action to Perform")}
|
|
@ -12,6 +12,11 @@
|
|||
$(function() {
|
||||
|
||||
$('#execute-results-button').click(function() {
|
||||
var count = $('.grid-wrapper').gridwrapper('results_count');
|
||||
if (!count) {
|
||||
alert("There are no batch results to execute.");
|
||||
return;
|
||||
}
|
||||
var form = $('form[name="execute-results"]');
|
||||
if (has_execution_options) {
|
||||
$('#execution-options-dialog').dialog({
|
||||
|
@ -66,16 +71,11 @@ ${parent.body()}
|
|||
|
||||
% if master.results_executable and request.has_perm('{}.execute_multiple'.format(permission_prefix)):
|
||||
<div id="execution-options-dialog" style="display: none;">
|
||||
${h.form(url('{}.execute_results'.format(route_prefix)), name='execute-results')}
|
||||
${h.csrf_token(request)}
|
||||
<br />
|
||||
<p>
|
||||
Please be advised, you are about to execute multiple batches!
|
||||
</p>
|
||||
<br />
|
||||
% if master.has_execution_options(batch):
|
||||
${rendered_execution_options|n}
|
||||
% endif
|
||||
${h.end_form()}
|
||||
${execute_form.render_deform(form_kwargs={'name': 'execute-results'}, buttons=False)|n}
|
||||
</div>
|
||||
% endif
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
<%def name="extra_javascript()">
|
||||
${parent.extra_javascript()}
|
||||
${h.javascript_link(request.static_url('tailbone:static/js/tailbone.batch.js'))}
|
||||
${h.javascript_link(request.static_url('tailbone:static/js/tailbone.batch.js') + '?ver={}'.format(tailbone.__version__))}
|
||||
<script type="text/javascript">
|
||||
|
||||
var has_execution_options = ${'true' if master.has_execution_options(batch) else 'false'};
|
||||
|
@ -84,13 +84,6 @@ ${rows_grid|n}
|
|||
|
||||
% if not batch.executed:
|
||||
<div id="execution-options-dialog" style="display: none;">
|
||||
|
||||
${h.form(url('{}.execute'.format(route_prefix), uuid=batch.uuid), name='batch-execution')}
|
||||
${h.csrf_token(request)}
|
||||
% if master.has_execution_options(batch):
|
||||
${rendered_execution_options|n}
|
||||
% endif
|
||||
${h.end_form()}
|
||||
|
||||
${execute_form.render_deform(form_kwargs={'name': 'batch-execution'}, buttons=False)|n}
|
||||
</div>
|
||||
% endif
|
||||
|
|
|
@ -43,11 +43,8 @@
|
|||
% if master.bulk_deletable and request.has_perm('{}.bulk_delete'.format(permission_prefix)):
|
||||
|
||||
$('form[name="bulk-delete"] button').click(function() {
|
||||
var count = 0;
|
||||
var match = /showing \d+ thru \d+ of (\S+)/.exec($('.pager .showing').text());
|
||||
if (match) {
|
||||
count = match[1];
|
||||
} else {
|
||||
var count = $('.grid-wrapper').gridwrapper('results_count', true);
|
||||
if (count === null) {
|
||||
alert("There don't seem to be any results to delete!");
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue