diff --git a/app/views/emails/_list.html.erb b/app/views/emails/_list.html.erb
index 93dae40..da47d41 100644
--- a/app/views/emails/_list.html.erb
+++ b/app/views/emails/_list.html.erb
@@ -9,31 +9,8 @@
- <% @emails.each do |email| %>
-
- <%= email.date %> |
- <%= email.subject %> |
-
- <% email.organisations.each do |organisation| %>
- <%= organisation %>
- <% end if email.organisations %>
- <% email.servers.each do |server| %>
- <%= server %>
- <% end if email.servers %>
- <% if email.cron? %>
- cron
- <% end %>
- <% if email.mailing_list? %>
- list
- <% end %>
- <% if email.junk? %>
- junk
- <% end %>
- |
- <%= link_to 'Show', email, "data-turbo-frame": "_top" %> |
- <%= link_to 'Edit', edit_email_path(email), "data-turbo-frame": "_top" %> |
- <%= link_to 'Destroy', email, method: :delete, data: { confirm: 'Are you sure?' }, "data-turbo-frame": "_top" %> |
-
+ <% emails.each do |email| %>
+ <%= render partial: "list_row", object: email, as: :email %>
<% end %>
diff --git a/app/views/emails/_list_row.html.erb b/app/views/emails/_list_row.html.erb
new file mode 100644
index 0000000..60fa4ea
--- /dev/null
+++ b/app/views/emails/_list_row.html.erb
@@ -0,0 +1,24 @@
+
+ <%= email.date %> |
+ <%= email.subject %> |
+
+ <% email.organisations.each do |organisation| %>
+ <%= organisation %>
+ <% end if email.organisations %>
+ <% email.servers.each do |server| %>
+ <%= server %>
+ <% end if email.servers %>
+ <% if email.cron? %>
+ cron
+ <% end %>
+ <% if email.mailing_list? %>
+ list
+ <% end %>
+ <% if email.junk? %>
+ junk
+ <% end %>
+ |
+ <%= link_to 'Show', email, "data-turbo-frame": "_top" %> |
+ <%= link_to 'Edit', edit_email_path(email), "data-turbo-frame": "_top" %> |
+ <%= link_to 'Destroy', email, method: :delete, data: { confirm: 'Are you sure?' }, "data-turbo-frame": "_top" %> |
+
diff --git a/app/views/emails/index.html.erb b/app/views/emails/index.html.erb
index 8a1c6e1..ec2f1c4 100644
--- a/app/views/emails/index.html.erb
+++ b/app/views/emails/index.html.erb
@@ -3,5 +3,5 @@
Emails
<%= turbo_frame_tag "emails" do %>
- <%= render partial: "list", object: @emails %>
+ <%= render partial: "list", object: @emails, as: :emails %>
<% end %>