diff --git a/lib/generators/tailwindcss/scaffold/templates/index.html.erb.tt b/lib/generators/tailwindcss/scaffold/templates/index.html.erb.tt index 3d337f95..7ea54857 100644 --- a/lib/generators/tailwindcss/scaffold/templates/index.html.erb.tt +++ b/lib/generators/tailwindcss/scaffold/templates/index.html.erb.tt @@ -10,14 +10,44 @@ <%%= 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" %> -

- <%% end %> + + + +<% attributes.reject(&:password_digest?).each do |attribute| -%> + +<% end -%> + + + + + <%% @<%= plural_table_name %>.each do |<%= singular_name %>| %> + +<% attributes.reject(&:password_digest?).each do |attribute| -%> +<% if attribute.attachment? -%> + +<% elsif attribute.attachments? -%> + +<% else -%> + +<% end -%> +<% end -%> + + + <%% end %> + +
<%= attribute.human_name %>Actions
<%%= link_to <%= singular_name %>.<%= attribute.column_name %>.filename, <%= singular_name %>.<%= attribute.column_name %> if <%= singular_name %>.<%= attribute.column_name %>.attached? %> + <%% <%= singular_name %>.<%= attribute.column_name %>.each do |<%= attribute.singular_name %>| %> +
<%%= link_to <%= attribute.singular_name %>.filename, <%= attribute.singular_name %> %>
+ <%% end %> +
<%%= <%= singular_name %>.<%= attribute.column_name %> %> + <%%= link_to "Show", <%= model_resource_name(singular_table_name) %>, class: "text-blue-600 hover:text-blue-900" %> + <%%= link_to "Edit", edit_<%= singular_route_name %>_path(<%= singular_table_name %>), class: "text-blue-600 hover:text-blue-900" %> +
+ <%%= button_to "Destroy", <%= model_resource_name %>, method: :delete, class: "text-red-600 hover:text-red-900" %> +
+
<%% else %>

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

<%% end %> diff --git a/test/integration/user_journey_test.sh b/test/integration/user_journey_test.sh index 14f4597a..4f11de93 100755 --- a/test/integration/user_journey_test.sh +++ b/test/integration/user_journey_test.sh @@ -68,7 +68,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]