Add support for cloning an upgrade record

until this is all ironed out, seems like it will often be helpful
This commit is contained in:
Lance Edgar 2017-08-08 21:26:06 -05:00
parent 77880abb87
commit d7f5211fc4
6 changed files with 81 additions and 17 deletions

View file

@ -0,0 +1,24 @@
## -*- coding: utf-8; -*-
<%inherit file="/base.mako" />
<%def name="title()">Clone ${model_title}: ${instance_title}</%def>
<br />
<p>You are about to clone the following ${model_title} as a new record:</p>
<div class="form-wrapper">
${form.render()|n}
</div><!-- form-wrapper -->
<br />
<p>Are you sure about this?</p>
<br />
${h.form(request.current_route_url())}
${h.csrf_token(request)}
${h.hidden('clone', value='clone')}
<div class="buttons">
${h.link_to("Whoops, nevermind...", form.cancel_url, class_='button autodisable')}
${h.submit('submit', "Yes, please clone away", class_='autodisable')}
</div>
${h.end_form()}

View file

@ -27,8 +27,10 @@
</%def>
<%def name="context_menu_items()">
<li>${h.link_to("Back to {}".format(model_title_plural), index_url)}</li>
<li>${h.link_to("Permalink for this {}".format(model_title), action_url('view', instance))}</li>
% if master.has_versions and request.rattail_config.versioning_enabled() and request.has_perm('{}.versions'.format(permission_prefix)):
<li>${h.link_to("Version History", action_url('versions', instance))}</li>
% endif
% 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
@ -38,6 +40,9 @@
% 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>
% 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>
% endif
</%def>
<ul id="context-menu">