From 6e0e4bbae958d0a4705605e347f4c21a00a00bc6 Mon Sep 17 00:00:00 2001 From: Max Veytsman Date: Wed, 22 May 2024 15:57:04 -0400 Subject: [PATCH 1/5] Get rid of notes in mobile --- .../live/campaign_signup_live/show.html.heex | 5 ----- 1 file changed, 5 deletions(-) diff --git a/lib/bike_brigade_web/live/campaign_signup_live/show.html.heex b/lib/bike_brigade_web/live/campaign_signup_live/show.html.heex index bb2312bd..8c027551 100644 --- a/lib/bike_brigade_web/live/campaign_signup_live/show.html.heex +++ b/lib/bike_brigade_web/live/campaign_signup_live/show.html.heex @@ -53,11 +53,6 @@ <%= Locations.neighborhood(t.dropoff_location) %> -
- Notes: - <%= t.rider_notes %> -
-
<.signup_button id="signup-btn-mobile" From 6062015f96e9c261b9807861ab865b4019bc02bb Mon Sep 17 00:00:00 2001 From: Max Veytsman Date: Wed, 22 May 2024 16:00:51 -0400 Subject: [PATCH 2/5] Switch to using campaign name instead of category --- .../live/campaign_signup_live/show.ex | 12 +++--------- .../live/campaign_signup_live/show.html.heex | 4 ++-- .../live/campaign_signup_live_test.exs | 4 ++++ test/support/fixtures.ex | 7 +++---- 4 files changed, 12 insertions(+), 15 deletions(-) diff --git a/lib/bike_brigade_web/live/campaign_signup_live/show.ex b/lib/bike_brigade_web/live/campaign_signup_live/show.ex index 6187e3a1..a640c847 100644 --- a/lib/bike_brigade_web/live/campaign_signup_live/show.ex +++ b/lib/bike_brigade_web/live/campaign_signup_live/show.ex @@ -183,16 +183,10 @@ defmodule BikeBrigadeWeb.CampaignSignupLive.Show do ## Module specific components defp get_delivery_size(assigns) do - item_list = - Enum.map(assigns.task.task_items, fn task_item -> - "#{task_item.count} #{task_item.item.category}" - end) - - assigns = assign(assigns, :item_list, item_list) - ~H""" -
- <%= item %> +
+ 1}> task_item.count + <%= Inflex.inflect(task_item.item.name, task_item.count) %>
""" end diff --git a/lib/bike_brigade_web/live/campaign_signup_live/show.html.heex b/lib/bike_brigade_web/live/campaign_signup_live/show.html.heex index 8c027551..2f1a44b1 100644 --- a/lib/bike_brigade_web/live/campaign_signup_live/show.html.heex +++ b/lib/bike_brigade_web/live/campaign_signup_live/show.html.heex @@ -16,7 +16,7 @@ <:col :let={_task} label="Pickup time"> <%= pickup_window(@campaign) %> - <:col :let={task} label="Delivery Size"> + <:col :let={task} label="Delivery"> <.get_delivery_size task={task} /> <:col :let={task} label="Recipient"><%= initials(task.dropoff_name) %> @@ -42,7 +42,7 @@
- Delivery size: + Delivery: <.get_delivery_size task={t} /> diff --git a/test/bike_brigade_web/live/campaign_signup_live_test.exs b/test/bike_brigade_web/live/campaign_signup_live_test.exs index ed194469..071088b1 100644 --- a/test/bike_brigade_web/live/campaign_signup_live_test.exs +++ b/test/bike_brigade_web/live/campaign_signup_live_test.exs @@ -200,6 +200,10 @@ defmodule BikeBrigadeWeb.CampaignSignupLiveTest do assert live |> element("[data-test-id=dropoff-name-#{ctx.task.id}]") |> render =~ "CJH" assert html =~ BikeBrigade.Locations.neighborhood(ctx.task.dropoff_location) + + # We show the name of the item + assert html =~ "Burrito" + end test "Invalid route for campaign shows flash and redirects", ctx do diff --git a/test/support/fixtures.ex b/test/support/fixtures.ex index bdf5358c..3b24bcbc 100644 --- a/test/support/fixtures.ex +++ b/test/support/fixtures.ex @@ -223,10 +223,9 @@ defmodule BikeBrigade.Fixtures do defp fake_item() do %{ - name: "Foodshare Box", - plural: "Foodshare Boxes", - description: "a box", - category: "Foodshare Box" + name: "Burrito", + description: "a large burrito with all the fixings", + category: "Prepared Food" } end end From 0c1f461d50c69630f6d8b0635e3f0347f2d1be49 Mon Sep 17 00:00:00 2001 From: Max Veytsman Date: Wed, 22 May 2024 16:02:18 -0400 Subject: [PATCH 3/5] Dead code --- .../live/campaign_signup_live/show.ex | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/lib/bike_brigade_web/live/campaign_signup_live/show.ex b/lib/bike_brigade_web/live/campaign_signup_live/show.ex index a640c847..b8df32b0 100644 --- a/lib/bike_brigade_web/live/campaign_signup_live/show.ex +++ b/lib/bike_brigade_web/live/campaign_signup_live/show.ex @@ -191,23 +191,6 @@ defmodule BikeBrigadeWeb.CampaignSignupLive.Show do """ end - defp truncated_riders_notes(assigns) do - if String.length(assigns.note) > 40 do - ~H""" -
-
- <%= String.slice(@note, 0..40) %>... - <%= @note %> -
-
- """ - else - ~H""" -
<%= @note %>
- """ - end - end - @doc """ Shows one of the following: - A "Sign up" button if the campaign is eligible for signing up From 2b8166437a440385fd21ed88aaa050b0bf2b1738 Mon Sep 17 00:00:00 2001 From: Max Veytsman Date: Wed, 22 May 2024 16:37:54 -0400 Subject: [PATCH 4/5] Show item description in signup --- .../live/campaign_signup_live/show.ex | 16 ++++++++++++++-- .../live/campaign_signup_live_test.exs | 3 ++- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/lib/bike_brigade_web/live/campaign_signup_live/show.ex b/lib/bike_brigade_web/live/campaign_signup_live/show.ex index b8df32b0..a86d2e5a 100644 --- a/lib/bike_brigade_web/live/campaign_signup_live/show.ex +++ b/lib/bike_brigade_web/live/campaign_signup_live/show.ex @@ -184,9 +184,21 @@ defmodule BikeBrigadeWeb.CampaignSignupLive.Show do defp get_delivery_size(assigns) do ~H""" -
+
1}> task_item.count - <%= Inflex.inflect(task_item.item.name, task_item.count) %> + + <%= if task_item.item.description && task_item.item.description != "" do %> +
+
+ + <%= Inflex.inflect(task_item.item.name, task_item.count) %> + + <%= task_item.item.description %> +
+
+ <% else %> + <%= Inflex.inflect(task_item.item.name, task_item.count) %> + <% end %>
""" end diff --git a/test/bike_brigade_web/live/campaign_signup_live_test.exs b/test/bike_brigade_web/live/campaign_signup_live_test.exs index 071088b1..9758abe1 100644 --- a/test/bike_brigade_web/live/campaign_signup_live_test.exs +++ b/test/bike_brigade_web/live/campaign_signup_live_test.exs @@ -201,8 +201,9 @@ defmodule BikeBrigadeWeb.CampaignSignupLiveTest do assert live |> element("[data-test-id=dropoff-name-#{ctx.task.id}]") |> render =~ "CJH" assert html =~ BikeBrigade.Locations.neighborhood(ctx.task.dropoff_location) - # We show the name of the item + # We show the name and description of the item assert html =~ "Burrito" + assert html =~ "a large burrito with all the fixings" end From 4ebbc5e6f6b30b33982e57a9b6df0ed68b666f64 Mon Sep 17 00:00:00 2001 From: Max Veytsman Date: Thu, 23 May 2024 10:15:16 -0400 Subject: [PATCH 5/5] Add title element --- lib/bike_brigade_web/live/campaign_signup_live/show.ex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/bike_brigade_web/live/campaign_signup_live/show.ex b/lib/bike_brigade_web/live/campaign_signup_live/show.ex index a86d2e5a..8fbfb6a1 100644 --- a/lib/bike_brigade_web/live/campaign_signup_live/show.ex +++ b/lib/bike_brigade_web/live/campaign_signup_live/show.ex @@ -190,7 +190,7 @@ defmodule BikeBrigadeWeb.CampaignSignupLive.Show do <%= if task_item.item.description && task_item.item.description != "" do %>
- + <%= Inflex.inflect(task_item.item.name, task_item.count) %> <%= task_item.item.description %>