diff --git a/app/controllers/applications_controller.rb b/app/controllers/applications_controller.rb index 5d53b3ed0..aad96b56b 100644 --- a/app/controllers/applications_controller.rb +++ b/app/controllers/applications_controller.rb @@ -78,7 +78,7 @@ def address render "address" else @full_address = T.let(top.full_address, T.nilable(String)) - @alert = Alert.new(address: @q, user: User.new) + @alert = Alert.new(address: @q, user: User.new, radius_meters: Alert::DEFAULT_RADIUS) @other_addresses = T.must(result.rest).map(&:full_address) point = RGeo::Geographic.spherical_factory.point(top.lng, top.lat) @applications = Application.select("*", "ST_Distance(lonlat, '#{point}')/1000 AS distance") diff --git a/app/views/_tailwind/alerts_new/new.html.erb b/app/views/_tailwind/alerts_new/new.html.erb index 86c17348b..a8dce73cd 100644 --- a/app/views/_tailwind/alerts_new/new.html.erb +++ b/app/views/_tailwind/alerts_new/new.html.erb @@ -15,6 +15,7 @@ <%= b.label class: "ml-3 text-navy text-2xl" %> <% end %> + <%= f.error :radius_meters, class: "mt-5" %>
diff --git a/app/views/_tailwind/applications/_create_alert_form.html.erb b/app/views/_tailwind/applications/_create_alert_form.html.erb index eaedcf50c..41b41f0e1 100644 --- a/app/views/_tailwind/applications/_create_alert_form.html.erb +++ b/app/views/_tailwind/applications/_create_alert_form.html.erb @@ -4,8 +4,10 @@ <%= image_tag "tailwind/bookmark.svg" %>

Save this search as an email alert

- <%= render Tailwind::ButtonComponent.new(tag: :button, size: "2xl", type: :primary) do %> - Save + <%= form_with model: [:profile, alert], builder: FormBuilders::Tailwind do |f| %> + <%= f.hidden_field :address %> + <%= f.hidden_field :radius_meters %> + <%= f.button "Save" %> <% end %> <% else %> diff --git a/app/views/_tailwind/applications/address.html.erb b/app/views/_tailwind/applications/address.html.erb index a572a152a..0b64de315 100644 --- a/app/views/_tailwind/applications/address.html.erb +++ b/app/views/_tailwind/applications/address.html.erb @@ -16,7 +16,7 @@ <%= render "pagination", applications: @applications %>
- <%= render "create_alert_form" %> + <%= render "create_alert_form", alert: @alert %>
<%# TODO: Add "save this search" here %> @@ -30,7 +30,7 @@
- <%= render "create_alert_form" %> + <%= render "create_alert_form", alert: @alert %>
<%= render "pagination", applications: @applications %>