Skip to content

Commit dc8251d

Browse files
patriciomacaddenflavorjones
authored andcommitted
index: show the actions to the right of the partial and add a division
between objects
1 parent 1f68bbb commit dc8251d

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

lib/generators/tailwindcss/scaffold/templates/index.html.erb.tt

+11-5
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,19 @@
1010
<%%= link_to "New <%= human_name.downcase %>", new_<%= singular_route_name %>_path, class: "rounded-md px-3.5 py-2.5 bg-blue-600 hover:bg-blue-500 text-white block font-medium" %>
1111
</div>
1212

13-
<div id="<%= plural_table_name %>" class="min-w-full">
13+
<div id="<%= plural_table_name %>" class="min-w-full divide-y divide-gray-200 space-y-5">
1414
<%% if @<%= plural_table_name %>.any? %>
1515
<%% @<%= plural_table_name %>.each do |<%= singular_table_name %>| %>
16-
<%%= render <%= singular_table_name %> %>
17-
<p>
18-
<%%= link_to "Show this <%= human_name.downcase %>", <%= model_resource_name(singular_table_name) %>, class: "ml-2 rounded-md px-3.5 py-2.5 bg-gray-100 hover:bg-gray-50 inline-block font-medium" %>
19-
</p>
16+
<div class="flex justify-between items-center">
17+
<%%= render <%= singular_table_name %> %>
18+
<div class="space-x-2">
19+
<%%= link_to "Show", <%= model_resource_name(singular_table_name) %>, class: "rounded-md px-3.5 py-2.5 bg-gray-100 hover:bg-gray-50 inline-block font-medium" %>
20+
<%%= link_to "Edit", edit_<%= singular_route_name %>_path(<%= singular_table_name %>), class: "rounded-md px-3.5 py-2.5 bg-gray-100 hover:bg-gray-50 inline-block font-medium" %>
21+
<div class="inline-block">
22+
<%%= button_to "Destroy", <%= model_resource_name %>, method: :delete, class: "rounded-md px-3.5 py-2.5 text-white bg-red-600 hover:bg-red-500 font-medium" %>
23+
</div>
24+
</div>
25+
</div>
2026
<%% end %>
2127
<%% else %>
2228
<p class="text-center my-10">No <%= human_name.downcase.pluralize %> found.</p>

test/integration/user_install_test.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ fi
6161

6262
# TEST: presence of the generated file
6363
bin/rails generate scaffold post title:string body:text published:boolean
64-
grep -q "Show this post" app/views/posts/index.html.erb
64+
grep -q "Show" app/views/posts/index.html.erb
6565

6666
# TEST: contents of the css file
6767
bin/rails tailwindcss:build[verbose]

0 commit comments

Comments
 (0)