Skip to content

Commit 1abc785

Browse files
committed
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
1 parent bb82cbf commit 1abc785

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

app/views/appointments/_appointment.html.erb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@
1919
<dl class="flex w-full flex-none justify-between gap-x-8 sm:w-auto">
2020
<div class="flex w-16 gap-x-2.5">
2121
<span class="sr-only">Actions</span>
22-
<%= link_to "Edit", edit_appointment_path(appointment), class: "text-xs text-indigo-500 hover:text-indigo-400", data: { turbo: false } %>
22+
<% if appointment.created_by?(Current.user) %>
23+
<%= link_to "Edit", edit_appointment_path(appointment), class: "text-xs text-indigo-500 hover:text-indigo-400", data: { turbo: false } %>
24+
<% end %>
2325
</div>
2426
</dl>
2527
</div>

app/views/appointments/index.html.erb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
<%= turbo_stream_from "appointments_list" %>
2+
13
<div class="flex flex-col mx-auto">
24
<h1 class="text-3xl font-bold tracking-tight text-gray-900">Appointments</h1>
35

0 commit comments

Comments
 (0)