Add creates_multiple flag for master view

This commit is contained in:
Lance Edgar 2018-01-18 11:46:10 -06:00
parent a542cd70da
commit 80e9a9cf1c
4 changed files with 12 additions and 3 deletions

View file

@ -1,7 +1,7 @@
## -*- coding: utf-8; -*-
<%inherit file="/base.mako" />
<%def name="title()">New ${model_title}</%def>
<%def name="title()">New ${model_title_plural if master.creates_multiple else model_title}</%def>
<%def name="extra_javascript()">
${parent.extra_javascript()}

View file

@ -73,7 +73,11 @@
<li>${h.link_to("Download results as CSV", url('{}.results_csv'.format(route_prefix)))}</li>
% endif
% if master.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>
% if master.creates_multiple:
<li>${h.link_to("Create new {}".format(model_title_plural), url('{}.create'.format(route_prefix)))}</li>
% else:
<li>${h.link_to("Create a new {}".format(model_title), url('{}.create'.format(route_prefix)))}</li>
% endif
% endif
</%def>

View file

@ -56,7 +56,11 @@
<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)):
<li>${h.link_to("Create a new {}".format(model_title), url('{}.create'.format(route_prefix)))}</li>
% if master.creates_multiple:
<li>${h.link_to("Create new {}".format(model_title_plural), url('{}.create'.format(route_prefix)))}</li>
% else:
<li>${h.link_to("Create a new {}".format(model_title), url('{}.create'.format(route_prefix)))}</li>
% endif
% endif
% if master.cloneable and request.has_perm('{}.clone'.format(permission_prefix)):
<li>${h.link_to("Clone this as new {}".format(model_title), url('{}.clone'.format(route_prefix), uuid=instance.uuid))}</li>

View file

@ -86,6 +86,7 @@ class MasterView(View):
listing = False
creating = False
creates_multiple = False
viewing = False
editing = False
deleting = False