Vehicle page: Edit and Delete in the contextual area instead of buttons

Moves Edit and Delete from buttons under the vehicle details to
Redmine's standard top-right contextual area (pencil and trash icons,
"e" access key, Redmine's delete confirmation). Same permissions; Delete
still only shows for vehicles without issues.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BiwYMjhoQvL7XsKKfRz4pM
This commit is contained in:
Claude committed 2026-10-29 23:11:03 -04:00
1 parent 0b1d13ba37
commit d7368388b6
2 files changed
+11 -10

No files matched your search

-10
View File
@@ -52,13 +52,3 @@
at <%= mileage %> <%= t(:label_miles) %>
</p>
<% end %>
<div style="float: right;">
<% if User.current.allowed_to?(:edit_vehicles, nil, global: true) %>
<%= button_to t(:label_edit), edit_vehicle_path(vehicle), method: :get %>
<% end %>
<%# Vehicles with issues can't be deleted, to keep their service history %>
<% if User.current.allowed_to?(:delete_vehicles, nil, global: true) && !vehicle.issues.exists? %>
<%= button_to t(:label_delete), vehicle, method: :delete, data: { confirm: t(:warn_ru_sure) } %>
<% end %>
</div>
+11
View File
@@ -1,3 +1,14 @@
<div class="contextual">
<% if User.current.allowed_to?(:edit_vehicles, nil, global: true) %>
<%= link_to sprite_icon('edit', l(:button_edit)), edit_vehicle_path(@vehicle),
class: 'icon icon-edit', accesskey: accesskey(:edit) %>
<% end %>
<%# Vehicles with issues can't be deleted, to keep their service history %>
<% if User.current.allowed_to?(:delete_vehicles, nil, global: true) && !@vehicle.issues.exists? %>
<%= delete_link vehicle_path(@vehicle) %>
<% end %>
</div>
<h2><%=t(:field_vehicle)%> #<%=@vehicle.id%></h2>
<% unless @vehicle.vin_decoded? %>