update to liveview 0.18 and use elixir 1.14
	
		
			
	
		
	
	
		
	
		
			All checks were successful
		
		
	
	
		
			
				
	
				continuous-integration/drone/push Build is passing
				
			
		
		
	
	
				
					
				
			
		
			All checks were successful
		
		
	
	continuous-integration/drone/push Build is passing
				
			This commit is contained in:
		| @@ -116,7 +116,7 @@ defmodule CanneryWeb.AmmoGroupLive.FormComponent do | ||||
|       case Ammo.update_ammo_group(ammo_group, ammo_group_params, current_user) do | ||||
|         {:ok, _ammo_group} -> | ||||
|           prompt = dgettext("prompts", "Ammo updated successfully") | ||||
|           socket |> put_flash(:info, prompt) |> push_redirect(to: return_to) | ||||
|           socket |> put_flash(:info, prompt) |> push_navigate(to: return_to) | ||||
|  | ||||
|         {:error, %Changeset{} = changeset} -> | ||||
|           socket |> assign(:changeset, changeset) | ||||
| @@ -181,7 +181,7 @@ defmodule CanneryWeb.AmmoGroupLive.FormComponent do | ||||
|             count | ||||
|           ) | ||||
|  | ||||
|         socket |> put_flash(:info, prompt) |> push_redirect(to: return_to) | ||||
|         socket |> put_flash(:info, prompt) |> push_navigate(to: return_to) | ||||
|  | ||||
|       {:error, %Changeset{} = changeset} -> | ||||
|         socket |> assign(changeset: changeset) | ||||
|   | ||||
| @@ -4,7 +4,7 @@ | ||||
|   </h2> | ||||
|  | ||||
|   <.form | ||||
|     let={f} | ||||
|     :let={f} | ||||
|     for={@changeset} | ||||
|     id="ammo_group-form" | ||||
|     phx-target={@myself} | ||||
|   | ||||
| @@ -129,11 +129,14 @@ defmodule CanneryWeb.AmmoGroupLive.Index do | ||||
|  | ||||
|   @spec get_value_for_key(atom(), AmmoGroup.t()) :: any() | ||||
|   defp get_value_for_key(:ammo_type, %{ammo_type: ammo_type}) do | ||||
|     assigns = %{ammo_type: ammo_type} | ||||
|  | ||||
|     {ammo_type.name, | ||||
|      live_patch(ammo_type.name, | ||||
|        to: Routes.ammo_type_show_path(Endpoint, :show, ammo_type), | ||||
|        class: "link" | ||||
|      )} | ||||
|      ~H""" | ||||
|      <.link patch={Routes.ammo_type_show_path(Endpoint, :show, @ammo_type)} class="link"> | ||||
|        <%= @ammo_type.name %> | ||||
|      </.link> | ||||
|      """} | ||||
|   end | ||||
|  | ||||
|   defp get_value_for_key(:price_paid, %{price_paid: nil}), do: {"a", nil} | ||||
| @@ -175,15 +178,17 @@ defmodule CanneryWeb.AmmoGroupLive.Index do | ||||
|          type="button" | ||||
|          class="mx-2 my-1 text-sm btn btn-primary" | ||||
|          phx-click="toggle_staged" | ||||
|          phx-value-ammo_group_id={ammo_group.id} | ||||
|          phx-value-ammo_group_id={@ammo_group.id} | ||||
|        > | ||||
|          <%= if ammo_group.staged, do: gettext("Unstage"), else: gettext("Stage") %> | ||||
|          <%= if @ammo_group.staged, do: gettext("Unstage"), else: gettext("Stage") %> | ||||
|        </button> | ||||
|  | ||||
|        <%= live_patch(dgettext("actions", "Record shots"), | ||||
|          to: Routes.ammo_group_index_path(Endpoint, :add_shot_group, ammo_group), | ||||
|          class: "mx-2 my-1 text-sm btn btn-primary" | ||||
|        ) %> | ||||
|        <.link | ||||
|          patch={Routes.ammo_group_index_path(Endpoint, :add_shot_group, @ammo_group)} | ||||
|          class="mx-2 my-1 text-sm btn btn-primary" | ||||
|        > | ||||
|          <%= dgettext("actions", "Record shots") %> | ||||
|        </.link> | ||||
|      </div> | ||||
|      """} | ||||
|   end | ||||
| @@ -196,28 +201,32 @@ defmodule CanneryWeb.AmmoGroupLive.Index do | ||||
|  | ||||
|     ~H""" | ||||
|     <div class="py-2 px-4 h-full space-x-4 flex justify-center items-center"> | ||||
|       <%= live_redirect to: Routes.ammo_group_show_path(Endpoint, :show, ammo_group), | ||||
|                     class: "text-primary-600 link", | ||||
|                     data: [qa: "view-#{ammo_group.id}"] do %> | ||||
|       <.link | ||||
|         patch={Routes.ammo_group_show_path(Endpoint, :show, @ammo_group)} | ||||
|         class="text-primary-600 link" | ||||
|         data-qa={"view-#{@ammo_group.id}"} | ||||
|       > | ||||
|         <i class="fa-fw fa-lg fas fa-eye"></i> | ||||
|       <% end %> | ||||
|       </.link> | ||||
|  | ||||
|       <%= live_patch to: Routes.ammo_group_index_path(Endpoint, :edit, ammo_group), | ||||
|                   class: "text-primary-600 link", | ||||
|                   data: [qa: "edit-#{ammo_group.id}"] do %> | ||||
|       <.link | ||||
|         patch={Routes.ammo_group_index_path(Endpoint, :edit, @ammo_group)} | ||||
|         class="text-primary-600 link" | ||||
|         data-qa={"edit-#{@ammo_group.id}"} | ||||
|       > | ||||
|         <i class="fa-fw fa-lg fas fa-edit"></i> | ||||
|       <% end %> | ||||
|       </.link> | ||||
|  | ||||
|       <%= link to: "#", | ||||
|             class: "text-primary-600 link", | ||||
|             phx_click: "delete", | ||||
|             phx_value_id: ammo_group.id, | ||||
|             data: [ | ||||
|               confirm: dgettext("prompts", "Are you sure you want to delete this ammo?"), | ||||
|               qa: "delete-#{ammo_group.id}" | ||||
|             ] do %> | ||||
|       <.link | ||||
|         href="#" | ||||
|         class="text-primary-600 link" | ||||
|         phx-click="delete" | ||||
|         phx-value-id={@ammo_group.id} | ||||
|         data-confirm={dgettext("prompts", "Are you sure you want to delete this ammo?")} | ||||
|         data-qa={"delete-#{@ammo_group.id}"} | ||||
|       > | ||||
|         <i class="fa-fw fa-lg fas fa-trash"></i> | ||||
|       <% end %> | ||||
|       </.link> | ||||
|     </div> | ||||
|     """ | ||||
|   end | ||||
| @@ -230,17 +239,19 @@ defmodule CanneryWeb.AmmoGroupLive.Index do | ||||
|     {container_name, | ||||
|      ~H""" | ||||
|      <div class="min-w-20 py-2 px-4 h-full flex flew-wrap justify-center items-center"> | ||||
|        <%= live_patch( | ||||
|          @ammo_group.container.name, | ||||
|          to: Routes.container_show_path(Endpoint, :show, @ammo_group.container), | ||||
|          class: "mx-2 my-1 link" | ||||
|        ) %> | ||||
|        <.link | ||||
|          patch={Routes.container_show_path(Endpoint, :show, @ammo_group.container)} | ||||
|          class="mx-2 my-1 link" | ||||
|        > | ||||
|          <%= @ammo_group.container.name %> | ||||
|        </.link> | ||||
|  | ||||
|        <%= live_patch( | ||||
|          gettext("Move ammo"), | ||||
|          to: Routes.ammo_group_index_path(Endpoint, :move, @ammo_group), | ||||
|          class: "mx-2 my-1 text-sm btn btn-primary" | ||||
|        ) %> | ||||
|        <.link | ||||
|          patch={Routes.ammo_group_index_path(Endpoint, :move, @ammo_group)} | ||||
|          class="mx-2 my-1 text-sm btn btn-primary" | ||||
|        > | ||||
|          <%= gettext("Move ammo") %> | ||||
|        </.link> | ||||
|      </div> | ||||
|      """} | ||||
|   end | ||||
|   | ||||
| @@ -17,10 +17,9 @@ | ||||
|           <%= dgettext("prompts", "You'll need to") %> | ||||
|         </h2> | ||||
|  | ||||
|         <%= live_patch(dgettext("actions", "add a container first"), | ||||
|           to: Routes.container_index_path(Endpoint, :new), | ||||
|           class: "btn btn-primary" | ||||
|         ) %> | ||||
|         <.link patch={Routes.container_index_path(Endpoint, :new)} class="btn btn-primary"> | ||||
|           <%= dgettext("actions", "add a container first") %> | ||||
|         </.link> | ||||
|       </div> | ||||
|     <% @ammo_types_count == 0 -> %> | ||||
|       <div class="flex justify-center items-center"> | ||||
| @@ -28,21 +27,18 @@ | ||||
|           <%= dgettext("prompts", "You'll need to") %> | ||||
|         </h2> | ||||
|  | ||||
|         <%= live_patch(dgettext("actions", "add an ammo type first"), | ||||
|           to: Routes.ammo_type_index_path(Endpoint, :new), | ||||
|           class: "btn btn-primary" | ||||
|         ) %> | ||||
|         <.link patch={Routes.ammo_type_index_path(Endpoint, :new)} class="btn btn-primary"> | ||||
|           <%= dgettext("actions", "add an ammo type first") %> | ||||
|         </.link> | ||||
|       </div> | ||||
|     <% @ammo_groups |> Enum.empty?() -> %> | ||||
|       <%= live_patch(dgettext("actions", "Add your first box!"), | ||||
|         to: Routes.ammo_group_index_path(Endpoint, :new), | ||||
|         class: "btn btn-primary" | ||||
|       ) %> | ||||
|       <.link patch={Routes.ammo_group_index_path(Endpoint, :new)} class="btn btn-primary"> | ||||
|         <%= dgettext("actions", "Add your first box!") %> | ||||
|       </.link> | ||||
|     <% true -> %> | ||||
|       <%= live_patch(dgettext("actions", "Add Ammo"), | ||||
|         to: Routes.ammo_group_index_path(Endpoint, :new), | ||||
|         class: "btn btn-primary" | ||||
|       ) %> | ||||
|       <.link patch={Routes.ammo_group_index_path(Endpoint, :new)} class="btn btn-primary"> | ||||
|         <%= dgettext("actions", "Add Ammo") %> | ||||
|       </.link> | ||||
|   <% end %> | ||||
|  | ||||
|   <%= unless @ammo_groups |> Enum.empty?() do %> | ||||
|   | ||||
| @@ -50,7 +50,7 @@ defmodule CanneryWeb.AmmoGroupLive.Show do | ||||
|     prompt = dgettext("prompts", "Ammo deleted succesfully") | ||||
|     redirect_to = Routes.ammo_group_index_path(socket, :index) | ||||
|  | ||||
|     {:noreply, socket |> put_flash(:info, prompt) |> push_redirect(to: redirect_to)} | ||||
|     {:noreply, socket |> put_flash(:info, prompt) |> push_navigate(to: redirect_to)} | ||||
|   end | ||||
|  | ||||
|   @impl true | ||||
| @@ -116,22 +116,24 @@ defmodule CanneryWeb.AmmoGroupLive.Show do | ||||
|           :actions -> | ||||
|             ~H""" | ||||
|             <div class="px-4 py-2 space-x-4 flex justify-center items-center"> | ||||
|               <%= live_patch to: Routes.ammo_group_show_path(Endpoint, :edit_shot_group, @ammo_group, shot_group), | ||||
|                           class: "text-primary-600 link", | ||||
|                           data: [qa: "edit-#{shot_group.id}"] do %> | ||||
|               <.link | ||||
|                 patch={Routes.ammo_group_show_path(Endpoint, :edit_shot_group, @ammo_group, @shot_group)} | ||||
|                 class="text-primary-600 link" | ||||
|                 data-qa={"edit-#{@shot_group.id}"} | ||||
|               > | ||||
|                 <i class="fa-fw fa-lg fas fa-edit"></i> | ||||
|               <% end %> | ||||
|               </.link> | ||||
|  | ||||
|               <%= link to: "#", | ||||
|                     class: "text-primary-600 link", | ||||
|                     phx_click: "delete_shot_group", | ||||
|                     phx_value_id: shot_group.id, | ||||
|                     data: [ | ||||
|                       confirm: dgettext("prompts", "Are you sure you want to delete this shot record?"), | ||||
|                       qa: "delete-#{shot_group.id}" | ||||
|                     ] do %> | ||||
|               <.link | ||||
|                 href="#" | ||||
|                 class="text-primary-600 link" | ||||
|                 phx-click="delete_shot_group" | ||||
|                 phx-value-id={@shot_group.id} | ||||
|                 data-confirm={dgettext("prompts", "Are you sure you want to delete this shot record?")} | ||||
|                 data-qa={"delete-#{@shot_group.id}"} | ||||
|               > | ||||
|                 <i class="fa-fw fa-lg fas fa-trash"></i> | ||||
|               <% end %> | ||||
|               </.link> | ||||
|             </div> | ||||
|             """ | ||||
|  | ||||
|   | ||||
| @@ -52,27 +52,31 @@ | ||||
|  | ||||
|   <div class="flex flex-col justify-center items-center"> | ||||
|     <div class="flex flex-wrap justify-center items-center text-primary-600"> | ||||
|       <%= live_patch(dgettext("actions", "View in Catalog"), | ||||
|         to: Routes.ammo_type_show_path(Endpoint, :show, @ammo_group.ammo_type), | ||||
|         class: "mx-4 my-2 btn btn-primary", | ||||
|         data: [qa: "details"] | ||||
|       ) %> | ||||
|       <.link | ||||
|         patch={Routes.ammo_type_show_path(Endpoint, :show, @ammo_group.ammo_type)} | ||||
|         class="mx-4 my-2 btn btn-primary" | ||||
|         data-qa="details" | ||||
|       > | ||||
|         <%= dgettext("actions", "View in Catalog") %> | ||||
|       </.link> | ||||
|  | ||||
|       <%= live_patch to: Routes.ammo_group_show_path(Endpoint, :edit, @ammo_group), | ||||
|                  class: "mx-4 my-2 text-primary-600 link", | ||||
|                  data: [qa: "edit"] do %> | ||||
|       <.link | ||||
|         patch={Routes.ammo_group_show_path(Endpoint, :edit, @ammo_group)} | ||||
|         class="mx-4 my-2 text-primary-600 link" | ||||
|         data-qa="edit" | ||||
|       > | ||||
|         <i class="fa-fw fa-lg fas fa-edit"></i> | ||||
|       <% end %> | ||||
|       </.link> | ||||
|  | ||||
|       <%= link to: "#", | ||||
|            class: "mx-4 my-2 text-primary-600 link", | ||||
|            phx_click: "delete", | ||||
|            data: [ | ||||
|              confirm: dgettext("prompts", "Are you sure you want to delete this ammo?"), | ||||
|              qa: "delete" | ||||
|            ] do %> | ||||
|       <.link | ||||
|         href="#" | ||||
|         class="mx-4 my-2 text-primary-600 link" | ||||
|         phx-click="delete" | ||||
|         data-confirm={dgettext("prompts", "Are you sure you want to delete this ammo?")} | ||||
|         data-qa="delete" | ||||
|       > | ||||
|         <i class="fa-fw fa-lg fas fa-trash"></i> | ||||
|       <% end %> | ||||
|       </.link> | ||||
|     </div> | ||||
|  | ||||
|     <div class="flex flex-wrap justify-center items-center text-primary-600"> | ||||
| @@ -82,16 +86,20 @@ | ||||
|           else: gettext("Stage for range") %> | ||||
|       </button> | ||||
|  | ||||
|       <%= live_patch(dgettext("actions", "Move containers"), | ||||
|         to: Routes.ammo_group_show_path(Endpoint, :move, @ammo_group), | ||||
|         class: "btn btn-primary", | ||||
|         data: [qa: "move"] | ||||
|       ) %> | ||||
|       <.link | ||||
|         patch={Routes.ammo_group_show_path(Endpoint, :move, @ammo_group)} | ||||
|         class="btn btn-primary" | ||||
|         data-qa="move" | ||||
|       > | ||||
|         <%= dgettext("actions", "Move containers") %> | ||||
|       </.link> | ||||
|  | ||||
|       <%= live_patch(dgettext("actions", "Record shots"), | ||||
|         to: Routes.ammo_group_show_path(Endpoint, :add_shot_group, @ammo_group), | ||||
|         class: "mx-4 my-2 btn btn-primary" | ||||
|       ) %> | ||||
|       <.link | ||||
|         patch={Routes.ammo_group_show_path(Endpoint, :add_shot_group, @ammo_group)} | ||||
|         class="mx-4 my-2 btn btn-primary" | ||||
|       > | ||||
|         <%= dgettext("actions", "Record shots") %> | ||||
|       </.link> | ||||
|     </div> | ||||
|   </div> | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user