From aa4051a7cd1189cc3c8da4ce1887166ce7bf93b3 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Sat, 6 Jan 2018 19:26:31 -0600 Subject: [PATCH] Exclude JS for refreshing batch unless it's relevant --- tailbone/templates/batch/view.mako | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/tailbone/templates/batch/view.mako b/tailbone/templates/batch/view.mako index 13ba7ecb..c2cfd609 100644 --- a/tailbone/templates/batch/view.mako +++ b/tailbone/templates/batch/view.mako @@ -16,12 +16,14 @@ location.href = '${url('{}.worksheet'.format(route_prefix), uuid=batch.uuid)}'; }); % endif - $('#refresh-data').click(function() { - $(this) - .button('option', 'disabled', true) - .button('option', 'label', "Working, please wait..."); - location.href = '${url('{}.refresh'.format(route_prefix), uuid=batch.uuid)}'; - }); + % if master.batch_refreshable(batch) and request.has_perm('{}.refresh'.format(permission_prefix)): + $('#refresh-data').click(function() { + $(this) + .button('option', 'disabled', true) + .button('option', 'label', "Working, please wait..."); + location.href = '${url('{}.refresh'.format(route_prefix), uuid=batch.uuid)}'; + }); + % endif });