Display Defaults hierarchy including same base Units

This commit is contained in:
2024-11-22 03:10:08 +01:00
parent 6c678b6560
commit 279f9bd6ac
3 changed files with 23 additions and 18 deletions

View File

@@ -1,20 +1,22 @@
<%= tag.tr do %>
<td class="<%= class_names({subunit: unit.base, grayed: unit.default?}) %>">
<td class="<%= class_names({subunit: unit.base,
grayed: unit.default? && !unit.portable.nil? }) %>">
<%= unit.symbol %>
</td>
<td class="actions">
<% if current_user.at_least(:active) && unit.default? %>
<%= image_button_to t('.import'), 'download-outline', import_default_unit_path(unit),
!unit.portable? ? {disabled: true, aria: {disabled: true}, tabindex: -1} : {} %>
<% end %>
<% if current_user.at_least(:admin) %>
<% if !unit.default? %>
<%= image_button_to t('.export'), 'upload-outline', export_default_unit_path(unit),
!unit.portable? ? {disabled: true, aria: {disabled: true}, tabindex: -1} : {} %>
<% else %>
<%= image_button_to t('.delete'), 'delete-outline', unit_path(unit),
method: :delete %>
<% 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 unit.default? %>
<%= image_button_to t('.delete'), 'delete-outline', unit_path(unit), method: :delete %>
<% else %>
<%= image_button_to t('.export'), 'upload-outline', export_default_unit_path(unit),
disabled_attributes(!unit.portable?) %>
<% end %>
<% end %>
<% end %>
</td>