From dbda06417b5972488df5592fa4f4b3dd392cc540 Mon Sep 17 00:00:00 2001 From: Ender Ahmet Yurt Date: Tue, 8 Oct 2024 16:29:16 +0300 Subject: [PATCH 1/4] Fix naming regarding Rails form naming --- lib/generators/tailwindcss/scaffold/templates/_form.html.erb.tt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/generators/tailwindcss/scaffold/templates/_form.html.erb.tt b/lib/generators/tailwindcss/scaffold/templates/_form.html.erb.tt index 5ee5ecf0..4ce66d6f 100644 --- a/lib/generators/tailwindcss/scaffold/templates/_form.html.erb.tt +++ b/lib/generators/tailwindcss/scaffold/templates/_form.html.erb.tt @@ -28,7 +28,7 @@ <%%= form.label :<%= attribute.column_name %> %> <% if attribute.field_type == :text_area -%> <%%= form.<%= attribute.field_type %> :<%= attribute.column_name %>, rows: 4, class: "block shadow rounded-md border border-gray-400 outline-none px-3 py-2 mt-2 w-full" %> -<% elsif attribute.field_type == :check_box -%> +<% elsif attribute.field_type == :checkbox -%> <%%= form.<%= attribute.field_type %> :<%= attribute.column_name %>, class: "block mt-2 h-5 w-5" %> <% else -%> <%%= form.<%= attribute.field_type %> :<%= attribute.column_name %>, class: "block shadow rounded-md border border-gray-400 outline-none px-3 py-2 mt-2 w-full" %> From 2a13fdd01ea73fd3ba5245dd7671438dd9960061 Mon Sep 17 00:00:00 2001 From: Mike Dalessio Date: Tue, 8 Oct 2024 14:49:18 -0400 Subject: [PATCH 2/4] version bump to v2.7.8 --- CHANGELOG.md | 5 +++++ Gemfile.lock | 2 +- lib/tailwindcss/version.rb | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 63d2e03c..3295be90 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## v2.7.8 / 2024-10-08 + +* Fix the scaffold form template to render checkboxes properly. (#416) @enderahmetyurt + + ## v2.7.7 / 2024-10-02 * Proactively support changes to Rails's authentication templates shipping in Rails 8.0.0.beta2 (which is not yet released). (#407, #408) @seanpdoyle @flavorjones diff --git a/Gemfile.lock b/Gemfile.lock index 922d259d..a6292810 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - tailwindcss-rails (2.7.6) + tailwindcss-rails (2.7.8) railties (>= 7.0.0) GEM diff --git a/lib/tailwindcss/version.rb b/lib/tailwindcss/version.rb index 6f849135..49a67214 100644 --- a/lib/tailwindcss/version.rb +++ b/lib/tailwindcss/version.rb @@ -1,3 +1,3 @@ module Tailwindcss - VERSION = "2.7.7" + VERSION = "2.7.8" end From 0c6b4955601c15d3df0034474c24114ecc7e6588 Mon Sep 17 00:00:00 2001 From: Earlopain <14981592+Earlopain@users.noreply.github.com> Date: Wed, 9 Oct 2024 16:20:26 +0200 Subject: [PATCH 3/4] Handle both rails 7.2 and rails 8.0 field types They got renamed in: * https://github.com/rails/rails/pull/52432 * https://github.com/rails/rails/pull/52467 This ensures the correct classes are generated for both old and new versions (cherry picked from commit 68d819afc165f3b74226130cabec334a8ce8b9d3) --- .../tailwindcss/scaffold/templates/_form.html.erb.tt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/generators/tailwindcss/scaffold/templates/_form.html.erb.tt b/lib/generators/tailwindcss/scaffold/templates/_form.html.erb.tt index 4ce66d6f..487f2f5f 100644 --- a/lib/generators/tailwindcss/scaffold/templates/_form.html.erb.tt +++ b/lib/generators/tailwindcss/scaffold/templates/_form.html.erb.tt @@ -26,9 +26,9 @@ <%%= form.<%= attribute.field_type %> :<%= attribute.column_name %>, multiple: true, class: "block shadow rounded-md border border-gray-400 outline-none px-3 py-2 mt-2 w-full" %> <% else -%> <%%= form.label :<%= attribute.column_name %> %> -<% if attribute.field_type == :text_area -%> +<% if attribute.field_type == :textarea || attribute.field_type == :text_area -%> <%%= form.<%= attribute.field_type %> :<%= attribute.column_name %>, rows: 4, class: "block shadow rounded-md border border-gray-400 outline-none px-3 py-2 mt-2 w-full" %> -<% elsif attribute.field_type == :checkbox -%> +<% elsif attribute.field_type == :checkbox || attribute.field_type == :check_box -%> <%%= form.<%= attribute.field_type %> :<%= attribute.column_name %>, class: "block mt-2 h-5 w-5" %> <% else -%> <%%= form.<%= attribute.field_type %> :<%= attribute.column_name %>, class: "block shadow rounded-md border border-gray-400 outline-none px-3 py-2 mt-2 w-full" %> From dc3ae9a994a1dc99f5eae7accee6029ec3c5d59a Mon Sep 17 00:00:00 2001 From: Mike Dalessio Date: Thu, 10 Oct 2024 14:00:32 -0400 Subject: [PATCH 4/4] version bump to v2.7.9 --- CHANGELOG.md | 5 +++++ Gemfile.lock | 2 +- lib/tailwindcss/version.rb | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3295be90..b996fd78 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## v2.7.9 / 2024-10-10 + +* Fix the scaffold form template to render text forms and check boxes properly in all versions of Rails. (#418) @Earlopain + + ## v2.7.8 / 2024-10-08 * Fix the scaffold form template to render checkboxes properly. (#416) @enderahmetyurt diff --git a/Gemfile.lock b/Gemfile.lock index a6292810..7ef04d57 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - tailwindcss-rails (2.7.8) + tailwindcss-rails (2.7.9) railties (>= 7.0.0) GEM diff --git a/lib/tailwindcss/version.rb b/lib/tailwindcss/version.rb index 49a67214..b0236c5b 100644 --- a/lib/tailwindcss/version.rb +++ b/lib/tailwindcss/version.rb @@ -1,3 +1,3 @@ module Tailwindcss - VERSION = "2.7.8" + VERSION = "2.7.9" end