diff --git a/lib/generators/tailwindcss/scaffold/templates/index.html.erb.tt b/lib/generators/tailwindcss/scaffold/templates/index.html.erb.tt index 3d337f95..7e9b26af 100644 --- a/lib/generators/tailwindcss/scaffold/templates/index.html.erb.tt +++ b/lib/generators/tailwindcss/scaffold/templates/index.html.erb.tt @@ -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" %> -
+
<%% if @<%= plural_table_name %>.any? %> <%% @<%= plural_table_name %>.each do |<%= singular_table_name %>| %> - <%%= render <%= singular_table_name %> %> -

- <%%= 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" %> -

+
+ <%%= render <%= singular_table_name %> %> +
+ <%%= 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" %> +
+ <%%= 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" %> +
+
+
<%% end %> <%% else %>

No <%= human_name.downcase.pluralize %> found.

diff --git a/test/integration/user_install_test.sh b/test/integration/user_install_test.sh index df3aa8f2..6f4ca301 100755 --- a/test/integration/user_install_test.sh +++ b/test/integration/user_install_test.sh @@ -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]