Disable links instead of hiding

Closes #49
This commit is contained in:
2025-01-03 14:41:18 +01:00
parent 80f05ba45f
commit af152c5e8b
4 changed files with 50 additions and 33 deletions

View File

@@ -7,17 +7,17 @@
<td class="actions">
<% unless unit.portable.nil? %>
<% if unit.default? %>
<%= image_button_to t('.import'), 'download-outline', import_default_unit_path(unit),
disabled_attributes(!unit.portable?) %>
<%= image_button_to_if unit.portable?, t('.import'), 'download-outline',
import_default_unit_path(unit) %>
<% 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?) %>
<%= image_button_to_if unit.movable?, t('.delete'), 'delete-outline',
default_unit_path(unit), method: :delete %>
<% else %>
<%= image_button_to t('.export'), 'upload-outline', export_default_unit_path(unit),
disabled_attributes(!unit.portable?) %>
<%= image_button_to_if unit.portable?, t('.export'), 'upload-outline',
export_default_unit_path(unit) %>
<% end %>
<% end %>
<% end %>

View File

@@ -29,7 +29,7 @@
class: "extendedright" %>
<% if user_signed_in? %>
<%= image_link_to_unless_current(current_user, "account-wrench-outline",
edit_user_registration_path) {} %>
edit_user_registration_path) %>
<% if current_user_disguised? %>
<%= image_link_to t(".revert"), "incognito-off", revert_users_path %>
<% else %>
@@ -37,9 +37,9 @@
method: :delete, data: {turbo: false} %>
<% end %>
<% else %>
<%= image_link_to_unless_current(t(:sign_in), "login", new_user_session_path) {} %>
<%= image_link_to_unless_current(t(:sign_in), "login", new_user_session_path) %>
<%= image_link_to_unless_current(t(:register), "account-plus-outline",
new_user_registration_path) {} %>
new_user_registration_path) %>
<% end %>
</header>

View File

@@ -17,8 +17,8 @@
id: dom_id(unit, :new, :link), onclick: 'this.blur();', data: {turbo_stream: true} %>
<% end %>
<%= image_button_to t('.destroy'), 'delete-outline', unit_path(unit),
method: :delete, **disabled_attributes(!unit.movable?) %>
<%= image_button_to_if unit.movable?, t('.destroy'), 'delete-outline', unit_path(unit),
method: :delete %>
</td>
<% if unit.movable? %>
<td class="handle" draggable="true">&#x283F</td>