Add MasterView.has_rows concept and related logic

Now the `BatchMasterView` no longer provides most of these goodies.

Also tweak some custom batch views to reflect changes etc.
This commit is contained in:
Lance Edgar 2016-08-23 13:11:13 -05:00
parent 8a19b90efa
commit 901c2fc573
9 changed files with 410 additions and 226 deletions

View file

@ -0,0 +1,17 @@
## -*- coding: utf-8 -*-
<%inherit file="/master/edit.mako" />
<%def name="context_menu_items()">
<li>${h.link_to("Back to {}".format(model_title), index_url)}</li>
% if master.rows_viewable and request.has_perm('{}.view'.format(row_permission_prefix)):
<li>${h.link_to("View this {}".format(row_model_title), row_action_url('view', instance))}</li>
% endif
% if master.rows_deletable and instance_deletable and request.has_perm('{}.delete'.format(row_permission_prefix)):
<li>${h.link_to("Delete this {}".format(row_model_title), row_action_url('delete', instance))}</li>
% endif
% if master.rows_creatable and request.has_perm('{}.create'.format(row_permission_prefix)):
<li>${h.link_to("Create a new {}".format(row_model_title), url('{}.create'.format(row_route_prefix)))}</li>
% endif
</%def>
${parent.body()}

View file

@ -4,7 +4,7 @@
<%def name="title()">${model_title}</%def>
<%def name="context_menu_items()">
<li>${h.link_to("Back to {}".format(batch_model_title), index_url)}</li>
<li>${h.link_to("Back to {}".format(parent_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
@ -16,4 +16,10 @@
% endif
</%def>
${parent.body()}
<ul id="context-menu">
${self.context_menu_items()}
</ul>
<div class="form-wrapper">
${form.render()|n}
</div><!-- form-wrapper -->

View file

@ -42,7 +42,7 @@
% if master.listing:
<span class="global">${model_title_plural}</span>
% else:
${h.link_to(model_title_plural, index_url, class_='global')}
${h.link_to(index_title, index_url, class_='global')}
% if master.viewing and grid_index:
${grid_index_nav()}
% endif