Files
todoapp/app/views/todos/_todo.html.erb

14 lines
906 B
Plaintext

<li id="<%= "#{dom_id(todo)}" %>" class="py-3">
<%= turbo_frame_tag dom_id(todo) do %>
<div class="flex items-center justify-center">
<%= link_to todo.title, edit_todo_path(todo), class: "flex-1 #{"line-through opacity-50" if todo.complete?}" %>
<% if todo.complete? %>
<%= button_to "Mark incomplete", todo_path(todo, todo: { status: 'incomplete'}), method: :patch, class: "bg-gray-50 px-3 py-2 rounded inline-flex items-center justify-center text-gray-600" %>
<% else %>
<%= button_to "Mark complete", todo_path(todo, todo: { status: 'complete'}), method: :patch, class: "bg-green-50 px-3 py-2 rounded inline-flex items-center justify-center text-green-600" %>
<% end %>
<%= button_to "Delete", todo_path(todo), method: :delete, class: "bg-red-50 px-3 py-2 rounded inline-flex items-center justify-center text-red-600" %>
</div>
<% end %>
</li>