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