From 6e689a83f50c181fec00323c5501acfae8f3efe0 Mon Sep 17 00:00:00 2001 From: Andrew Vogel Date: Sun, 26 Jan 2025 16:27:47 -0500 Subject: [PATCH] feat: broadcast appointments list updates on save this is the broken state. Current.user will always be nil and therefore, the edit link will fail to render for all attached clients --- app/views/appointments/_appointment.html.erb | 4 +++- app/views/appointments/index.html.erb | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/app/views/appointments/_appointment.html.erb b/app/views/appointments/_appointment.html.erb index 69b8797..f0eb703 100644 --- a/app/views/appointments/_appointment.html.erb +++ b/app/views/appointments/_appointment.html.erb @@ -19,7 +19,9 @@
Actions - <%= link_to "Edit", edit_appointment_path(appointment), class: "text-xs text-indigo-500 hover:text-indigo-400", data: { turbo: false } %> + <% if appointment.created_by?(Current.user) %> + <%= link_to "Edit", edit_appointment_path(appointment), class: "text-xs text-indigo-500 hover:text-indigo-400", data: { turbo: false } %> + <% end %>
diff --git a/app/views/appointments/index.html.erb b/app/views/appointments/index.html.erb index 6bc3c9e..fd9cb4f 100644 --- a/app/views/appointments/index.html.erb +++ b/app/views/appointments/index.html.erb @@ -1,3 +1,5 @@ +<%= turbo_stream_from "appointments_list" %> +

Appointments