diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 4bfa8a3cc..5e2ae452f 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -23,6 +23,8 @@ class ApplicationController < ActionController::Base # See https://github.com/heartcombo/devise/wiki/How-To:-%5BRedirect-back-to-current-page-after-sign-in,-sign-out,-sign-up,-update%5D before_action :store_user_location!, if: :storable_location? + default_form_builder FormBuilders::Tailwind + sig { void } def authenticate_active_admin_user! authenticate_user! diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index b1b5ca26b..aa093065c 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -183,7 +183,6 @@ def pa_button_to(name, path = nil, options = {}, &block) end form_with( url: url_for(path), - builder: FormBuilders::Tailwind, class: options.delete(:form_class), method: options.delete(:method), data: options.delete(:data) diff --git a/app/views/alerts/edit.html.erb b/app/views/alerts/edit.html.erb index face87ebb..f9537fc9b 100644 --- a/app/views/alerts/edit.html.erb +++ b/app/views/alerts/edit.html.erb @@ -10,7 +10,7 @@
- <%= form_with model: [:profile, @alert], builder: FormBuilders::Tailwind, class: "mt-5" do |f| %> + <%= form_with model: [:profile, @alert], class: "mt-5" do |f| %> <%= f.label :radius_meters, "Alert distance" %>
<%= f.select :radius_meters, diff --git a/app/views/alerts/new.html.erb b/app/views/alerts/new.html.erb index 53ebbcc22..f481dfb21 100644 --- a/app/views/alerts/new.html.erb +++ b/app/views/alerts/new.html.erb @@ -1,5 +1,5 @@ <%= render HeadingComponent.new(tag: :h2).with_content("Create new alert") %> -<%= form_with model: [:profile, @alert], builder: FormBuilders::Tailwind, class: "mt-12" do |f| %> +<%= form_with model: [:profile, @alert], class: "mt-12" do |f| %>
<%= f.label :address, "Enter a street address" %> <%= f.street_address_field :address, class: "mt-2 block w-full" %> diff --git a/app/views/api_keys/non_commercials/new.html.erb b/app/views/api_keys/non_commercials/new.html.erb index 1999a6516..39bab27ae 100644 --- a/app/views/api_keys/non_commercials/new.html.erb +++ b/app/views/api_keys/non_commercials/new.html.erb @@ -10,7 +10,7 @@
<%# TODO: Add errors on all fields in the form %> - <%= form_with builder: FormBuilders::Tailwind do |f| %> + <%= form_with do |f| %>
<%= f.label :organisation, "Organisation", class: "block mb-3" %> <%= f.text_field :organisation, class: "block w-full" %> diff --git a/app/views/api_keys/paid/new.html.erb b/app/views/api_keys/paid/new.html.erb index 74dbc72e1..a1b7d9f72 100644 --- a/app/views/api_keys/paid/new.html.erb +++ b/app/views/api_keys/paid/new.html.erb @@ -22,7 +22,7 @@
<%# TODO: Add errors on all fields in the form %> - <%= form_with builder: FormBuilders::Tailwind do |f| %> + <%= form_with do |f| %> <%# TODO: How to style fieldset and legend? %>
Company diff --git a/app/views/applications/_address_search_form.html.erb b/app/views/applications/_address_search_form.html.erb index cf1a29466..fefbda17f 100644 --- a/app/views/applications/_address_search_form.html.erb +++ b/app/views/applications/_address_search_form.html.erb @@ -2,7 +2,7 @@ <%# Right now the styling is quite different from the other forms %> <%# TODO: Reuse at least some of the styling from the default form builder %>
- <%= form_with url: address_applications_path(anchor: "results"), method: :get, builder: FormBuilders::Tailwind, class: "gap-4 flex flex-col items-center" do |form| %> + <%= form_with url: address_applications_path(anchor: "results"), method: :get, class: "gap-4 flex flex-col items-center" do |form| %> <%# Not using a heading here so that we don't mess up the heading order on different pages. %> <%# TODO: There's probably something simpler and more sensible we should do here %>
diff --git a/app/views/applications/_create_alert_form.html.erb b/app/views/applications/_create_alert_form.html.erb index 6f9264037..11547eae8 100644 --- a/app/views/applications/_create_alert_form.html.erb +++ b/app/views/applications/_create_alert_form.html.erb @@ -3,7 +3,7 @@ <%= image_tag "bookmark.svg", alt: "", class: "mt-2 sm:mt-0" %>

Save this search as an email alert

- <%= form_with model: [:profile, alert], builder: FormBuilders::Tailwind do |f| %> + <%= form_with model: [:profile, alert] do |f| %> <%= f.hidden_field :address %> <%= f.hidden_field :radius_meters %> <%= f.button "Save" %> diff --git a/app/views/applications/_create_alert_form_bigger.html.erb b/app/views/applications/_create_alert_form_bigger.html.erb index fe54a78dc..8c9a724ae 100644 --- a/app/views/applications/_create_alert_form_bigger.html.erb +++ b/app/views/applications/_create_alert_form_bigger.html.erb @@ -13,7 +13,7 @@ It only takes a moment.

<% else %> - <%= form_with model: [:profile, alert], builder: FormBuilders::Tailwind do |f| %> + <%= form_with model: [:profile, alert] do |f| %>

Save your search for applications within <%= meters_in_words(alert.radius_meters) %> of <%= alert.address %>?

diff --git a/app/views/applications/search.html.erb b/app/views/applications/search.html.erb index 1c59b30d6..f349d219d 100644 --- a/app/views/applications/search.html.erb +++ b/app/views/applications/search.html.erb @@ -2,7 +2,7 @@ <%# TODO: This page needs a proper design %> -<%= form_with url: search_applications_path, method: :get, builder: FormBuilders::Tailwind, class: "my-24" do |f| %> +<%= form_with url: search_applications_path, method: :get, class: "my-24" do |f| %> <%= f.text_field :q, value: @q, class: "block w-full", size: 50, autofocus: @applications.nil?, placeholder: "Tree work" %>
<%= f.button "Search" %> diff --git a/app/views/comments/_form.html.erb b/app/views/comments/_form.html.erb index 42e655abe..4750fc93a 100644 --- a/app/views/comments/_form.html.erb +++ b/app/views/comments/_form.html.erb @@ -1,4 +1,4 @@ -<%= form_with model: [application, comment], builder: FormBuilders::Tailwind do |f| %> +<%= form_with model: [application, comment] do |f| %>
<%= f.label :text, "Your comment" %> <%= f.text_area :text, diff --git a/app/views/comments/preview.html.erb b/app/views/comments/preview.html.erb index 21bc7020e..a71f95b83 100644 --- a/app/views/comments/preview.html.erb +++ b/app/views/comments/preview.html.erb @@ -30,7 +30,7 @@
- <%= form_with(url: publish_application_comment_path(@comment), builder: FormBuilders::Tailwind) do %> + <%= form_with(url: publish_application_comment_path(@comment)) do %> <%= render ButtonWithSideTextComponent.new(tag: :button, size: "xl", type: :primary) do |c| %> Publish <% c.with_side_text do %> diff --git a/app/views/contact_messages/_form.html.erb b/app/views/contact_messages/_form.html.erb index b418ed217..a4e5c97db 100644 --- a/app/views/contact_messages/_form.html.erb +++ b/app/views/contact_messages/_form.html.erb @@ -1,4 +1,4 @@ -<%= form_with model: contact_message, builder: FormBuilders::Tailwind do |f| %> +<%= form_with model: contact_message do |f| %> <% if current_user.nil? %>
<%= f.label :name, "Your name", class: "block mb-3" %> diff --git a/app/views/devise/confirmations/new.html.erb b/app/views/devise/confirmations/new.html.erb index 5123688ee..f4c240bef 100644 --- a/app/views/devise/confirmations/new.html.erb +++ b/app/views/devise/confirmations/new.html.erb @@ -5,7 +5,7 @@ Resend confirmation instructions <% end %> - <%= form_with model: resource, url: confirmation_path(resource_name), builder: FormBuilders::Tailwind do |f| %> + <%= form_with model: resource, url: confirmation_path(resource_name) do |f| %>
<%= f.label :email, class: "block" %> <%= f.email_field :email, class: "mt-1 block w-full", autocomplete: "email", autofocus: true, value: (resource.pending_reconfirmation? ? resource.unconfirmed_email : resource.email) %> diff --git a/app/views/devise/passwords/edit.html.erb b/app/views/devise/passwords/edit.html.erb index 484c3bf07..0103753c7 100644 --- a/app/views/devise/passwords/edit.html.erb +++ b/app/views/devise/passwords/edit.html.erb @@ -3,7 +3,7 @@
<%= render HeadingComponent.new(tag: :h1, extra_classes: "my-20 text-center").with_content("Create your new password") %> - <%= form_with model: resource, url: password_path(resource_name), method: :put, builder: FormBuilders::Tailwind do |f| %> + <%= form_with model: resource, url: password_path(resource_name), method: :put do |f| %> <%= f.hidden_field :reset_password_token %>
diff --git a/app/views/devise/passwords/new.html.erb b/app/views/devise/passwords/new.html.erb index f15b85e88..2a1fc24cf 100644 --- a/app/views/devise/passwords/new.html.erb +++ b/app/views/devise/passwords/new.html.erb @@ -4,7 +4,7 @@ <%= render HeadingComponent.new(tag: :h1, extra_classes: "my-20 text-center") do %> Let's get you to create a new password. First we need to confirm you're you <% end %> - <%= form_with model: resource, url: password_path(resource_name), builder: FormBuilders::Tailwind do |f| %> + <%= form_with model: resource, url: password_path(resource_name) do |f| %>
<%= f.label :email, class: "block" %> diff --git a/app/views/devise/registrations/edit.html.erb b/app/views/devise/registrations/edit.html.erb index 60b637399..d5ac1e964 100644 --- a/app/views/devise/registrations/edit.html.erb +++ b/app/views/devise/registrations/edit.html.erb @@ -1,6 +1,6 @@ <%= render HeadingComponent.new(tag: :h2, extra_classes: "pb-10").with_content("Edit your account") %> -<%= form_with model: resource, url: registration_path(resource_name), method: :put, builder: FormBuilders::Tailwind, class: "border-b border-light-grey pb-8" do |f| %> +<%= form_with model: resource, url: registration_path(resource_name), method: :put, class: "border-b border-light-grey pb-8" do |f| %> <%# TODO: What actually goes here and is it needed on other devise forms? %> <%= render "devise/shared/error_messages", resource: %> diff --git a/app/views/devise/registrations/new.html.erb b/app/views/devise/registrations/new.html.erb index 132ddc617..c6b3a61e3 100644 --- a/app/views/devise/registrations/new.html.erb +++ b/app/views/devise/registrations/new.html.erb @@ -1,7 +1,7 @@
<%= render HeadingComponent.new(tag: :h1, extra_classes: "mt-20 mb-12 text-center").with_content("Create an account") %> - <%= form_with model: resource, url: registration_path(resource_name), builder: FormBuilders::Tailwind do |f| %> + <%= form_with model: resource, url: registration_path(resource_name) do |f| %>
<%= f.label :name, "Your full name", class: "block" %> <%= f.text_field :name, class: "mt-1 block w-full", autofocus: true, autocomplete: "name", placeholder: "e.g. Jane Citizen" %> diff --git a/app/views/devise/sessions/new.html.erb b/app/views/devise/sessions/new.html.erb index d6ba64fe7..a3de34391 100644 --- a/app/views/devise/sessions/new.html.erb +++ b/app/views/devise/sessions/new.html.erb @@ -2,7 +2,7 @@ <%= render HeadingComponent.new(tag: :h1, extra_classes: "mt-20 mb-12 text-center") do %> Sign in to Planning Alerts <% end %> - <%= form_with model: resource, url: session_path(resource_name), builder: FormBuilders::Tailwind do |f| %> + <%= form_with model: resource, url: session_path(resource_name) do |f| %> <%# TODO: Add error display and styling %>
diff --git a/app/views/reports/new.html.erb b/app/views/reports/new.html.erb index 16d013a07..c5d5de64f 100644 --- a/app/views/reports/new.html.erb +++ b/app/views/reports/new.html.erb @@ -10,7 +10,7 @@ you think the comment should be removed.

-<%= form_with model: [@comment, @report], builder: FormBuilders::Tailwind, class: "mt-12" do |f| %> +<%= form_with model: [@comment, @report], class: "mt-12" do |f| %>
<%= f.label :details, "Why should the comment below be removed?" %> <%= f.text_area :details, class: "block w-full mt-4", rows: 8 %> diff --git a/app/views/users/activations/edit.html.erb b/app/views/users/activations/edit.html.erb index b442fb695..d65cf01ea 100644 --- a/app/views/users/activations/edit.html.erb +++ b/app/views/users/activations/edit.html.erb @@ -3,7 +3,7 @@
<%= render HeadingComponent.new(tag: :h1, extra_classes: "my-20 text-center").with_content("Activate your account") %> - <%= form_with model: @user, url: users_activation_path, method: :put, builder: FormBuilders::Tailwind do |f| %> + <%= form_with model: @user, url: users_activation_path, method: :put do |f| %> <%= f.hidden_field :reset_password_token %>
diff --git a/app/views/users/activations/new.html.erb b/app/views/users/activations/new.html.erb index 589abd0cf..124d65222 100644 --- a/app/views/users/activations/new.html.erb +++ b/app/views/users/activations/new.html.erb @@ -5,7 +5,7 @@ Activate your account <% end %> - <%= form_with model: @user, url: users_activation_path, builder: FormBuilders::Tailwind do |f| %> + <%= form_with model: @user, url: users_activation_path do |f| %>
<%= f.label :email, class: "block" %> <%= f.email_field :email, class: "mt-1 block w-full", autocomplete: "email", autofocus: true %>