I didn't test, but I think something like the following patch could fix the issue:
diff --git a/app/views/audit_mailer/summary.html.erb b/app/views/audit_mailer/summary.html.erb
index f1b490df9..fb6392840 100644
--- a/app/views/audit_mailer/summary.html.erb
+++ b/app/views/audit_mailer/summary.html.erb
@@ -11,10 +11,10 @@
<%= link_to(audit.username, audits_url(:search => user_search_param)) %>
<span style="color: #cccccc"><%= audit_remote_address audit %></span>
<%= audit_action_name audit%> <%= audited_type audit %>:
- <%= link_to(audit_title(audit), audit_url(:id => audit), {:style => 'color: #2a6496'}) %>
+ <%= link_to(audit_title(audit), audits_url(search: "id=#{audit.id}"), {:style => 'color: #2a6496'}) %>
</b>
<ul style="list-style-type: none;">
- <% details(audit, audit_url(audit)).each do |detail| -%>
+ <% details(audit, audits_url(search: "id=#{audit.id}")).each do |detail| -%>
<li>
<%= detail %>
</li>
diff --git a/app/views/audit_mailer/summary.text.erb b/app/views/audit_mailer/summary.text.erb
index f0862265f..8e341b76b 100644
--- a/app/views/audit_mailer/summary.text.erb
+++ b/app/views/audit_mailer/summary.text.erb
@@ -5,7 +5,7 @@
'Displaying %{num_audits} of %{total_audits} audits', @count) % {:num_audits => @limit, :total_audits => @count} %>
<% @audits.each do |audit| %>
<%= audit.username %> (<%= audit.remote_address %>) <%= audit_action_name audit%> <%= audited_type audit %>: <%= audit_title(audit) %>
- (<%= audit_url(:id => audit) %>)
+ (<%= audits_url(search: "id=#{audit}") %>)
<% end %>
<% else %>
<%= _('No audit changes for this period') %>
diff --git a/config/routes.rb b/config/routes.rb
index b80a4edbf..75ace534e 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -264,7 +264,7 @@ Foreman::Application.routes.draw do
end
end
- resources :audits do
+ resources :audits, :only => [:index] do
collection do
get 'auto_complete_search'
end
it would be nice to expand the list if there is only one match to avoid the extra click