Skip to content

Commit 4f51cf9

Browse files
authored
Merge branch 'main' into feature/engines-convention-over-configuration-support
2 parents 284d66c + d08ca11 commit 4f51cf9

File tree

6 files changed

+35
-2
lines changed

6 files changed

+35
-2
lines changed

CHANGELOG.md

+8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# `tailwindcss-rails` Changelog
22

3+
## v4.2.1 / 2025-03-19
4+
5+
### Fixed
6+
7+
* Fix styles for form errors in some scaffold fields. #513 @patriciomacadden
8+
* Update scaffold system tests to handle the "Destroy" confirmation prompt when Turbo is enabled. Fixes #519. #520 @patriciomacadden @flavorjones
9+
10+
311
## v4.2.0 / 2025-03-02
412

513
### Features

lib/generators/tailwindcss/scaffold/scaffold_generator.rb

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
require "rails/generators/erb/scaffold/scaffold_generator"
22
require "rails/generators/resource_helpers"
3+
require File.expand_path("../../test_unit/scaffold/scaffold_generator.rb", __dir__)
34

45
module Tailwindcss
56
module Generators

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
<%%= form.password_field :password_confirmation, class: ["block shadow-sm rounded-md border px-3 py-2 mt-2 w-full", {"border-gray-400 focus:outline-blue-600": <%= model_resource_name %>.errors[:password_confirmation].none?, "border-red-400 focus:outline-red-600": <%= model_resource_name %>.errors[:password_confirmation].any?}] %>
2424
<% elsif attribute.attachments? -%>
2525
<%%= form.label :<%= attribute.column_name %> %>
26-
<%%= form.<%= attribute.field_type %> :<%= attribute.column_name %>, multiple: true, class: ["block shadow-sm rounded-md border px-3 py-2 mt-2 w-full", {"border-gray-400 focus:outline-blue-600": <%= model_resource_name %>.errors[:password].none?, "border-red-400 focus:outline-red-600": <%= model_resource_name %>.errors[:password].any?}] %>
26+
<%%= form.<%= attribute.field_type %> :<%= attribute.column_name %>, multiple: true, class: ["block shadow-sm rounded-md border px-3 py-2 mt-2 w-full", {"border-gray-400 focus:outline-blue-600": <%= model_resource_name %>.errors[:<%= attribute.column_name %>].none?, "border-red-400 focus:outline-red-600": <%= model_resource_name %>.errors[:<%= attribute.column_name %>].any?}] %>
2727
<% else -%>
2828
<%%= form.label :<%= attribute.column_name %> %>
2929
<% if attribute.field_type == :textarea || attribute.field_type == :text_area -%>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
require "rails/generators/test_unit/scaffold/scaffold_generator"
2+
3+
module TestUnit # :nodoc:
4+
module Generators # :nodoc:
5+
class ScaffoldGenerator < Base # :nodoc:
6+
def fix_system_test
7+
if turbo_defined?
8+
gsub_file File.join("test/system", class_path, "#{file_name.pluralize}_test.rb"),
9+
/(click_on.*Destroy this.*)$/,
10+
"accept_confirm { \\1 }"
11+
end
12+
end
13+
14+
private
15+
16+
def turbo_defined?
17+
defined?(Turbo)
18+
end
19+
end
20+
end
21+
end

lib/tailwindcss/version.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module Tailwindcss
2-
VERSION = "4.2.0"
2+
VERSION = "4.2.1"
33
end

test/integration/user_install_test.sh

+3
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,9 @@ fi
6363
bin/rails generate scaffold post title:string body:text published:boolean
6464
grep -q "Show" app/views/posts/index.html.erb
6565

66+
# TEST: the "accept_confirm" system test change was applied cleanly
67+
grep -q "accept_confirm { click_on \"Destroy this post\"" test/system/posts_test.rb
68+
6669
# TEST: contents of the css file
6770
bin/rails tailwindcss:build[verbose]
6871
grep -q "py-2" app/assets/builds/tailwind.css

0 commit comments

Comments
 (0)