Hide actions for restricted users

Closes #43
This commit is contained in:
cryptogopher 2024-12-30 00:44:21 +01:00
parent b9d979ad0c
commit c8c8d8cd70
2 changed files with 17 additions and 14 deletions

View File

@ -355,7 +355,7 @@ table.items td:last-child {
}
table.items td {
border-top: solid 1px var(--color-border-gray);
min-height: 2.4em;
height: 2.4em;
padding-block: 0.1em;
}
/* For <a> to fill <td> completely, we use an ::after pseudoelement. */

View File

@ -3,21 +3,24 @@
<%= unit %>
</td>
<td class="actions">
<% unless unit.portable.nil? %>
<% if current_user.at_least(:active) && unit.default? %>
<%= image_button_to t('.import'), 'download-outline', import_default_unit_path(unit),
disabled_attributes(!unit.portable?) %>
<% end %>
<% if current_user.at_least(:admin) %>
<% if current_user.at_least(:active) %>
<td class="actions">
<% unless unit.portable.nil? %>
<% if unit.default? %>
<%= image_button_to t('.delete'), 'delete-outline', default_unit_path(unit),
method: :delete, **disabled_attributes(!unit.movable?) %>
<% else %>
<%= image_button_to t('.export'), 'upload-outline', export_default_unit_path(unit),
<%= image_button_to t('.import'), 'download-outline', import_default_unit_path(unit),
disabled_attributes(!unit.portable?) %>
<% end %>
<% if current_user.at_least(:admin) %>
<% if unit.default? %>
<%= image_button_to t('.delete'), 'delete-outline', default_unit_path(unit),
method: :delete, **disabled_attributes(!unit.movable?) %>
<% else %>
<%= image_button_to t('.export'), 'upload-outline', export_default_unit_path(unit),
disabled_attributes(!unit.portable?) %>
<% end %>
<% end %>
<% end %>
<% end %>
</td>
</td>
<% end %>
<% end %>