From d7368388b6426c9de10767af3fa4cbc47e8a323a Mon Sep 17 00:00:00 2001
From: Claude
Date: Thu, 29 Oct 2026 23:11:03 -0400
Subject: [PATCH] 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
Claude-Session: https://claude.ai/code/session_01BiwYMjhoQvL7XsKKfRz4pM
---
app/views/vehicles/_details.html.erb | 10 ----------
app/views/vehicles/show.html.erb | 11 +++++++++++
2 files changed, 11 insertions(+), 10 deletions(-)
diff --git a/app/views/vehicles/_details.html.erb b/app/views/vehicles/_details.html.erb
index dde39a9..a577254 100644
--- a/app/views/vehicles/_details.html.erb
+++ b/app/views/vehicles/_details.html.erb
@@ -52,13 +52,3 @@
at <%= mileage %> <%= t(:label_miles) %>
<% end %>
-
-
- <% 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 %>
-
\ No newline at end of file
diff --git a/app/views/vehicles/show.html.erb b/app/views/vehicles/show.html.erb
index 3102005..268d64b 100644
--- a/app/views/vehicles/show.html.erb
+++ b/app/views/vehicles/show.html.erb
@@ -1,3 +1,14 @@
+
+ <% 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 %>
+
+
<%=t(:field_vehicle)%> #<%=@vehicle.id%>
<% unless @vehicle.vin_decoded? %>