Add new BatchMasterView
for new-style batches.
This commit is contained in:
parent
7338560fc3
commit
62221a1a25
14 changed files with 1112 additions and 93 deletions
|
@ -8,7 +8,7 @@
|
|||
% if master.viewable and request.has_perm('{}.view'.format(permission_prefix)):
|
||||
<li>${h.link_to("View this {}".format(model_title), action_url('view', instance))}</li>
|
||||
% endif
|
||||
% if master.deletable and master.deletable_instance(instance) and request.has_perm('{}.delete'.format(permission_prefix)):
|
||||
% if master.deletable and instance_deletable and request.has_perm('{}.delete'.format(permission_prefix)):
|
||||
<li>${h.link_to("Delete this {}".format(model_title), action_url('delete', instance))}</li>
|
||||
% endif
|
||||
% if master.creatable and request.has_perm('{}.create'.format(permission_prefix)):
|
||||
|
|
|
@ -5,10 +5,10 @@
|
|||
|
||||
<%def name="context_menu_items()">
|
||||
<li>${h.link_to("Back to {}".format(model_title_plural), index_url)}</li>
|
||||
% if master.editable and request.has_perm('{}.edit'.format(permission_prefix)):
|
||||
% if master.editable and instance_editable and request.has_perm('{}.edit'.format(permission_prefix)):
|
||||
<li>${h.link_to("Edit this {}".format(model_title), action_url('edit', instance))}</li>
|
||||
% endif
|
||||
% if master.deletable and master.deletable_instance(instance) and request.has_perm('{}.delete'.format(permission_prefix)):
|
||||
% if master.deletable and instance_deletable and request.has_perm('{}.delete'.format(permission_prefix)):
|
||||
<li>${h.link_to("Delete this {}".format(model_title), action_url('delete', instance))}</li>
|
||||
% endif
|
||||
% if master.creatable and request.has_perm('{}.create'.format(permission_prefix)):
|
||||
|
|
3
tailbone/templates/newbatch/create.mako
Normal file
3
tailbone/templates/newbatch/create.mako
Normal file
|
@ -0,0 +1,3 @@
|
|||
## -*- coding: utf-8 -*-
|
||||
<%inherit file="/master/create.mako" />
|
||||
${parent.body()}
|
59
tailbone/templates/newbatch/edit.mako
Normal file
59
tailbone/templates/newbatch/edit.mako
Normal file
|
@ -0,0 +1,59 @@
|
|||
## -*- coding: utf-8 -*-
|
||||
<%inherit file="/master/edit.mako" />
|
||||
|
||||
<%def name="head_tags()">
|
||||
${parent.head_tags()}
|
||||
${h.javascript_link(request.static_url('tailbone:static/js/jquery.ui.tailbone.js'))}
|
||||
<script type="text/javascript">
|
||||
$(function() {
|
||||
|
||||
$('.newgrid-wrapper').gridwrapper();
|
||||
|
||||
$('#save-refresh').click(function() {
|
||||
var form = $(this).parents('form');
|
||||
form.append($('<input type="hidden" name="refresh" value="true" />'));
|
||||
form.submit();
|
||||
});
|
||||
|
||||
$('#execute-batch').click(function() {
|
||||
$(this).button('option', 'label', "Executing, please wait...").button('disable');
|
||||
location.href = '${url('{}.execute'.format(route_prefix), uuid=batch.uuid)}';
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
<style type="text/css">
|
||||
|
||||
.newgrid-wrapper {
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
</style>
|
||||
</%def>
|
||||
|
||||
<%def name="buttons()">
|
||||
<div class="buttons">
|
||||
% if master.refreshable:
|
||||
${h.submit('save-refresh', "Save & Refresh Data")}
|
||||
% endif
|
||||
% 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>
|
||||
% endif
|
||||
</div>
|
||||
</%def>
|
||||
|
||||
<%def name="grid_tools()">
|
||||
% if not batch.executed:
|
||||
<p>${h.link_to("Delete all rows matching current search", url('{}.rows.bulk_delete'.format(route_prefix), uuid=batch.uuid))}</p>
|
||||
% endif
|
||||
</%def>
|
||||
|
||||
<ul id="context-menu">
|
||||
${self.context_menu_items()}
|
||||
</ul>
|
||||
|
||||
<div class="form-wrapper">
|
||||
${form.render(buttons=capture(buttons))|n}
|
||||
</div><!-- form-wrapper -->
|
||||
|
||||
${rows_grid.render_complete(allow_save_defaults=False, tools=capture(self.grid_tools))|n}
|
3
tailbone/templates/newbatch/index.mako
Normal file
3
tailbone/templates/newbatch/index.mako
Normal file
|
@ -0,0 +1,3 @@
|
|||
## -*- coding: utf-8 -*-
|
||||
<%inherit file="/master/index.mako" />
|
||||
${parent.body()}
|
54
tailbone/templates/newbatch/view.mako
Normal file
54
tailbone/templates/newbatch/view.mako
Normal file
|
@ -0,0 +1,54 @@
|
|||
## -*- coding: utf-8 -*-
|
||||
<%inherit file="/master/view.mako" />
|
||||
|
||||
<%def name="head_tags()">
|
||||
${parent.head_tags()}
|
||||
${h.javascript_link(request.static_url('tailbone:static/js/jquery.ui.tailbone.js'))}
|
||||
<script type="text/javascript">
|
||||
$(function() {
|
||||
|
||||
$('.newgrid-wrapper').gridwrapper();
|
||||
|
||||
$('#execute-batch').click(function() {
|
||||
$(this).button('option', 'label', "Executing, please wait...").button('disable');
|
||||
location.href = '${url('{}.execute'.format(route_prefix), uuid=batch.uuid)}';
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
<style type="text/css">
|
||||
|
||||
.newgrid-wrapper {
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
</style>
|
||||
</%def>
|
||||
|
||||
<%def name="context_menu_items()">
|
||||
${parent.context_menu_items()}
|
||||
% if request.has_perm('{}.csv'.format(permission_prefix)):
|
||||
<li>${h.link_to("Download row data as CSV", url('{}.csv'.format(route_prefix), uuid=batch.uuid))}</li>
|
||||
% endif
|
||||
</%def>
|
||||
|
||||
<%def name="buttons()">
|
||||
<div class="buttons">
|
||||
% if not form.readonly and batch.refreshable:
|
||||
${h.submit('save-refresh', "Save & Refresh Data")}
|
||||
% endif
|
||||
% 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>
|
||||
% endif
|
||||
</div>
|
||||
</%def>
|
||||
|
||||
<ul id="context-menu">
|
||||
${self.context_menu_items()}
|
||||
</ul>
|
||||
|
||||
<div class="form-wrapper">
|
||||
${form.render(form_id='batch-form', buttons=capture(buttons))|n}
|
||||
</div><!-- form-wrapper -->
|
||||
|
||||
${rows_grid|n}
|
19
tailbone/templates/newbatch/view_row.mako
Normal file
19
tailbone/templates/newbatch/view_row.mako
Normal file
|
@ -0,0 +1,19 @@
|
|||
## -*- coding: utf-8 -*-
|
||||
<%inherit file="/master/view.mako" />
|
||||
|
||||
<%def name="title()">${model_title}</%def>
|
||||
|
||||
<%def name="context_menu_items()">
|
||||
<li>${h.link_to("Back to {}".format(batch_model_title), index_url)}</li>
|
||||
% if master.rows_editable and instance_editable and request.has_perm('{}.edit'.format(permission_prefix)):
|
||||
<li>${h.link_to("Edit this {}".format(model_title), action_url('edit', instance))}</li>
|
||||
% endif
|
||||
% if master.rows_deletable and instance_deletable and request.has_perm('{}.delete'.format(permission_prefix)):
|
||||
<li>${h.link_to("Delete this {}".format(model_title), action_url('delete', instance))}</li>
|
||||
% endif
|
||||
% if master.rows_creatable and request.has_perm('{}.create'.format(permission_prefix)):
|
||||
<li>${h.link_to("Create a new {}".format(model_title), url('{}.create'.format(route_prefix)))}</li>
|
||||
% endif
|
||||
</%def>
|
||||
|
||||
${parent.body()}
|
|
@ -1,7 +1,7 @@
|
|||
## -*- coding: utf-8 -*-
|
||||
<div class="newgrid-wrapper">
|
||||
% if grid.filterable:
|
||||
${grid.render_filters()|n}
|
||||
${grid.render_filters(allow_save_defaults=allow_save_defaults)|n}
|
||||
% endif
|
||||
% if tools:
|
||||
<div class="grid-tools">
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
</select>
|
||||
${form.tag('button', type='button', id='default-filters', c="Default View")}
|
||||
${form.tag('button', type='button', id='clear-filters', c="No Filters")}
|
||||
% if request.user:
|
||||
% if allow_save_defaults and request.user:
|
||||
${form.tag('button', type='button', id='save-defaults', c="Save Defaults")}
|
||||
% endif
|
||||
</div>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue