You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
1.3 KiB
43 lines
1.3 KiB
<% content_for :title, "Posts" %>
|
|
|
|
<div class="w-full">
|
|
<% if notice.present? %>
|
|
<p
|
|
class="
|
|
py-2 px-3 bg-green-50 mb-5 text-green-500 font-medium rounded-md
|
|
inline-block
|
|
"
|
|
id="notice"
|
|
>
|
|
<%= notice %>
|
|
</p>
|
|
<% end %>
|
|
|
|
<div class="flex justify-between items-center">
|
|
<h1 class="font-bold text-4xl">Posts</h1>
|
|
<%= link_to "New post", new_post_path, class: "rounded-md px-3.5 py-2.5 bg-blue-600 hover:bg-blue-500 text-white block font-medium" %>
|
|
</div>
|
|
|
|
<div id="posts" class="min-w-full divide-y divide-gray-200 space-y-5">
|
|
<% if @posts.any? %>
|
|
<% @posts.each do |post| %>
|
|
<div
|
|
class="
|
|
flex flex-col sm:flex-row justify-between items-center pb-5
|
|
sm:pb-0
|
|
"
|
|
>
|
|
<%= render post %>
|
|
|
|
<div class="w-full sm:w-auto flex flex-col sm:flex-row space-x-2 space-y-2">
|
|
<%= link_to "Show", post, class: "btn btn-primary" %>
|
|
<%= link_to "Edit", edit_post_path(post), class: "btn btn-secondary" %>
|
|
<%= button_to "Destroy", post, method: :delete, class: "btn btn-accent", data: { turbo_confirm: "Are you sure?" } %>
|
|
</div>
|
|
</div>
|
|
<% end %>
|
|
<% else %>
|
|
<p class="text-center my-10">No posts found.</p>
|
|
<% end %>
|
|
</div>
|
|
</div>
|