Use header button instead of link for "touch" instance

This commit is contained in:
Lance Edgar 2023-09-24 08:37:50 -05:00
parent 91ac1a9031
commit bda05aed86

View file

@ -7,6 +7,18 @@
${instance_title}
</%def>
<%def name="render_instance_header_title_extras()">
<span style="width: 2rem;"></span>
% if master.touchable and master.has_perm('touch'):
<b-button title="&quot;Touch&quot; this record to trigger sync"
icon-pack="fas"
icon-left="hand-pointer"
@click="touchRecord()"
:disabled="touchSubmitting">
</b-button>
% endif
</%def>
<%def name="object_helpers()">
${parent.object_helpers()}
${self.render_xref_helper()}
@ -37,9 +49,6 @@
% 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.touchable and request.has_perm('{}.touch'.format(permission_prefix)):
<li>${h.link_to("\"Touch\" this {}".format(model_title), master.get_action_url('touch', instance))}</li>
% endif
</%def>
<%def name="render_row_grid_tools()">
@ -83,6 +92,22 @@
${parent.render_this_page_template()}
</%def>
<%def name="modify_whole_page_vars()">
${parent.modify_whole_page_vars()}
% if master.touchable and master.has_perm('touch'):
<script type="text/javascript">
WholePageData.touchSubmitting = false
WholePage.methods.touchRecord = function() {
this.touchSubmitting = true
location.href = '${master.get_action_url('touch', instance)}'
}
</script>
% endif
</%def>
<%def name="finalize_this_page_vars()">
${parent.finalize_this_page_vars()}
% if master.has_rows: