Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions lib/generators/tailwindcss/scaffold/templates/index.html.erb.tt
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,19 @@
<%%= 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" %>
</div>

<div id="<%= plural_table_name %>" class="min-w-full">
<div id="<%= plural_table_name %>" class="min-w-full divide-y divide-gray-200 space-y-5">
<%% if @<%= plural_table_name %>.any? %>
<%% @<%= plural_table_name %>.each do |<%= singular_table_name %>| %>
<%%= render <%= singular_table_name %> %>
<p>
<%%= 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" %>
</p>
<div class="flex justify-between items-center">
<%%= render <%= singular_table_name %> %>
<div class="space-x-2">
<%%= 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" %>
<%%= link_to "Edit", <%= edit_helper(singular_table_name, type: :path) %>, class: "rounded-md px-3.5 py-2.5 bg-gray-100 hover:bg-gray-50 inline-block font-medium" %>
<div class="inline-block">
<%%= 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" %>
</div>
</div>
</div>
<%% end %>
<%% else %>
<p class="text-center my-10">No <%= human_name.downcase.pluralize %> found.</p>
Expand Down
2 changes: 1 addition & 1 deletion test/integration/user_install_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ fi

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

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