1
0
Fork 0

fix: show CRUD buttons in header only if relevant and user has access

This commit is contained in:
Lance Edgar 2024-08-20 17:02:38 -05:00
parent f502bf1ba3
commit bdc57abd5a

View file

@ -482,38 +482,46 @@
<%def name="render_crud_header_buttons()"> <%def name="render_crud_header_buttons()">
% if master: % if master:
% if master.viewing: % if master.viewing:
% if instance_editable and master.has_perm('edit'):
<wutta-button once <wutta-button once
tag="a" href="${master.get_action_url('edit', instance)}" tag="a" href="${master.get_action_url('edit', instance)}"
icon-left="edit" icon-left="edit"
label="Edit This" /> label="Edit This" />
% if instance_deletable: % endif
% if instance_deletable and master.has_perm('delete'):
<wutta-button once type="is-danger" <wutta-button once type="is-danger"
tag="a" href="${master.get_action_url('delete', instance)}" tag="a" href="${master.get_action_url('delete', instance)}"
icon-left="trash" icon-left="trash"
label="Delete This" /> label="Delete This" />
% endif % endif
% elif master.editing: % elif master.editing:
% if instance_viewable and master.has_perm('view'):
<wutta-button once <wutta-button once
tag="a" href="${master.get_action_url('view', instance)}" tag="a" href="${master.get_action_url('view', instance)}"
icon-left="eye" icon-left="eye"
label="View This" /> label="View This" />
% if instance_deletable: % endif
% if instance_deletable and master.has_perm('delete'):
<wutta-button once type="is-danger" <wutta-button once type="is-danger"
tag="a" href="${master.get_action_url('delete', instance)}" tag="a" href="${master.get_action_url('delete', instance)}"
icon-left="trash" icon-left="trash"
label="Delete This" /> label="Delete This" />
% endif % endif
% elif master.deleting: % elif master.deleting:
% if instance_viewable and master.has_perm('view'):
<wutta-button once <wutta-button once
tag="a" href="${master.get_action_url('view', instance)}" tag="a" href="${master.get_action_url('view', instance)}"
icon-left="eye" icon-left="eye"
label="View This" /> label="View This" />
% endif
% if instance_editable and master.has_perm('edit'):
<wutta-button once <wutta-button once
tag="a" href="${master.get_action_url('edit', instance)}" tag="a" href="${master.get_action_url('edit', instance)}"
icon-left="edit" icon-left="edit"
label="Edit This" /> label="Edit This" />
% endif % endif
% endif % endif
% endif
</%def> </%def>
<%def name="render_prevnext_header_buttons()"></%def> <%def name="render_prevnext_header_buttons()"></%def>