diff --git a/lib/cannery_web/live/ammo_group_live/index.ex b/lib/cannery_web/live/ammo_group_live/index.ex index 2281fcc..0a030d8 100644 --- a/lib/cannery_web/live/ammo_group_live/index.ex +++ b/lib/cannery_web/live/ammo_group_live/index.ex @@ -17,6 +17,14 @@ defmodule CanneryWeb.AmmoGroupLive.Index do {:noreply, apply_action(socket, live_action, params)} end + defp apply_action(%{assigns: %{current_user: current_user}} = socket, :add_shot_group, %{ + "id" => id + }) do + socket + |> assign(:page_title, gettext("Record shots")) + |> assign(:ammo_group, Ammo.get_ammo_group!(id, current_user)) + end + defp apply_action(%{assigns: %{current_user: current_user}} = socket, :move, %{"id" => id}) do socket |> assign(:page_title, gettext("Move Ammo group")) diff --git a/lib/cannery_web/live/ammo_group_live/index.html.heex b/lib/cannery_web/live/ammo_group_live/index.html.heex index 2f5055a..74175fc 100644 --- a/lib/cannery_web/live/ammo_group_live/index.html.heex +++ b/lib/cannery_web/live/ammo_group_live/index.html.heex @@ -36,7 +36,7 @@ <%= gettext("Notes") %> - <%= gettext("Staged for Range") %> + <%= gettext("Range") %> <%= gettext("Container") %> @@ -70,14 +70,21 @@ - +
+ + + <%= live_patch(dgettext("actions", "Record shots"), + to: Routes.ammo_group_index_path(Endpoint, :add_shot_group, ammo_group), + class: "btn btn-primary" + ) %> +
diff --git a/lib/cannery_web/live/ammo_group_live/show.html.heex b/lib/cannery_web/live/ammo_group_live/show.html.heex index 3d02a78..881ce3d 100644 --- a/lib/cannery_web/live/ammo_group_live/show.html.heex +++ b/lib/cannery_web/live/ammo_group_live/show.html.heex @@ -24,38 +24,47 @@ <% end %> -
- <%= live_patch(dgettext("actions", "Ammo Details"), - to: Routes.ammo_type_show_path(Endpoint, :show, @ammo_group.ammo_type), - class: "mx-4 my-2 btn btn-primary", - data: [qa: "details"] - ) %> +
+
+ <%= live_patch(dgettext("actions", "Ammo Details"), + to: Routes.ammo_type_show_path(Endpoint, :show, @ammo_group.ammo_type), + class: "mx-4 my-2 btn btn-primary", + data: [qa: "details"] + ) %> - <%= live_patch to: Routes.ammo_group_show_path(Endpoint, :edit, @ammo_group), - class: "mx-4 my-2 text-primary-500 link", - data: [qa: "edit"] do %> - - <% end %> + <%= live_patch to: Routes.ammo_group_show_path(Endpoint, :edit, @ammo_group), + class: "mx-4 my-2 text-primary-500 link", + data: [qa: "edit"] do %> + + <% end %> - <%= link to: "#", - class: "mx-4 my-2 text-primary-500 link", - phx_click: "delete", - data: [ - confirm: dgettext("prompts", "Are you sure you want to delete this ammo?"), - qa: "delete" - ] do %> - - <% end %> + <%= link to: "#", + class: "mx-4 my-2 text-primary-500 link", + phx_click: "delete", + data: [ + confirm: dgettext("prompts", "Are you sure you want to delete this ammo?"), + qa: "delete" + ] do %> + + <% end %> +
- +
+ - <%= live_patch(dgettext("actions", "Move to different container"), - to: Routes.ammo_group_show_path(Endpoint, :move, @ammo_group), - class: "btn btn-primary", - data: [qa: "move"] - ) %> + <%= live_patch(dgettext("actions", "Move containers"), + to: Routes.ammo_group_show_path(Endpoint, :move, @ammo_group), + class: "btn btn-primary", + data: [qa: "move"] + ) %> + + <%= 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" + ) %> +

diff --git a/priv/gettext/actions.pot b/priv/gettext/actions.pot index 8bff506..b2abdc7 100644 --- a/priv/gettext/actions.pot +++ b/priv/gettext/actions.pot @@ -11,7 +11,7 @@ msgid "" msgstr "" #, elixir-autogen, elixir-format -#: lib/cannery_web/live/ammo_group_live/index.ex:34 +#: lib/cannery_web/live/ammo_group_live/index.ex:42 msgid "Add Ammo" msgstr "" @@ -160,12 +160,14 @@ msgid "Why not get some ready to shoot?" msgstr "" #, elixir-autogen, elixir-format +#: lib/cannery_web/live/ammo_group_live/index.html.heex:83 +#: lib/cannery_web/live/ammo_group_live/show.html.heex:63 #: lib/cannery_web/live/range_live/index.html.heex:34 msgid "Record shots" msgstr "" #, elixir-autogen, elixir-format -#: lib/cannery_web/live/ammo_group_live/show.html.heex:28 +#: lib/cannery_web/live/ammo_group_live/show.html.heex:29 msgid "Ammo Details" msgstr "" @@ -175,8 +177,8 @@ msgid "Add another container!" msgstr "" #, elixir-autogen, elixir-format -#: lib/cannery_web/live/ammo_group_live/show.html.heex:54 -msgid "Move to different container" +#: lib/cannery_web/live/ammo_group_live/show.html.heex:57 +msgid "Move containers" msgstr "" #, elixir-autogen, elixir-format diff --git a/priv/gettext/default.pot b/priv/gettext/default.pot index 41af512..220a6f5 100644 --- a/priv/gettext/default.pot +++ b/priv/gettext/default.pot @@ -154,7 +154,7 @@ msgid "Easy to Use:" msgstr "" #, elixir-autogen, elixir-format -#: lib/cannery_web/live/ammo_group_live/index.ex:28 +#: lib/cannery_web/live/ammo_group_live/index.ex:36 #: lib/cannery_web/live/ammo_group_live/show.ex:55 msgid "Edit Ammo group" msgstr "" @@ -459,7 +459,7 @@ msgid "Steel" msgstr "" #, elixir-autogen, elixir-format -#: lib/cannery_web/live/ammo_group_live/show.html.heex:66 +#: lib/cannery_web/live/ammo_group_live/show.html.heex:75 msgid "Stored in" msgstr "" @@ -486,7 +486,7 @@ msgid "The self-hosted firearm tracker website" msgstr "" #, elixir-autogen, elixir-format -#: lib/cannery_web/live/ammo_group_live/show.html.heex:71 +#: lib/cannery_web/live/ammo_group_live/show.html.heex:80 msgid "This ammo group is not in a container" msgstr "" @@ -545,6 +545,7 @@ msgstr "" #, elixir-autogen, elixir-format #: lib/cannery_web/components/topbar.ex:63 +#: lib/cannery_web/live/ammo_group_live/index.html.heex:39 msgid "Range" msgstr "" @@ -569,13 +570,13 @@ msgid "No ammo staged" msgstr "" #, elixir-autogen, elixir-format -#: lib/cannery_web/live/ammo_group_live/show.html.heex:51 +#: lib/cannery_web/live/ammo_group_live/show.html.heex:54 #: lib/cannery_web/live/range_live/index.html.heex:31 msgid "Stage for range" msgstr "" #, elixir-autogen, elixir-format -#: lib/cannery_web/live/ammo_group_live/show.html.heex:51 +#: lib/cannery_web/live/ammo_group_live/show.html.heex:54 #: lib/cannery_web/live/range_live/index.html.heex:31 msgid "Unstage from range" msgstr "" @@ -587,6 +588,7 @@ msgstr "" #, elixir-autogen, elixir-format #: lib/cannery_web/components/add_shot_group_component.html.heex:3 +#: lib/cannery_web/live/ammo_group_live/index.ex:24 #: lib/cannery_web/live/range_live/index.ex:28 msgid "Record shots" msgstr "" @@ -597,7 +599,7 @@ msgid "Ammo Types" msgstr "" #, elixir-autogen, elixir-format -#: lib/cannery_web/live/ammo_group_live/index.ex:39 +#: lib/cannery_web/live/ammo_group_live/index.ex:47 msgid "Ammo groups" msgstr "" @@ -638,7 +640,7 @@ msgid "Shot Records" msgstr "" #, elixir-autogen, elixir-format -#: lib/cannery_web/live/ammo_group_live/index.ex:22 +#: lib/cannery_web/live/ammo_group_live/index.ex:30 #: lib/cannery_web/live/ammo_group_live/show.ex:53 msgid "Move Ammo group" msgstr "" @@ -722,17 +724,12 @@ msgid "New password" msgstr "" #, elixir-autogen, elixir-format -#: lib/cannery_web/live/ammo_group_live/index.html.heex:79 +#: lib/cannery_web/live/ammo_group_live/index.html.heex:80 msgid "Stage" msgstr "" #, elixir-autogen, elixir-format -#: lib/cannery_web/live/ammo_group_live/index.html.heex:39 -msgid "Staged for Range" -msgstr "" - -#, elixir-autogen, elixir-format -#: lib/cannery_web/live/ammo_group_live/index.html.heex:79 +#: lib/cannery_web/live/ammo_group_live/index.html.heex:80 msgid "Unstage" msgstr "" diff --git a/priv/gettext/prompts.pot b/priv/gettext/prompts.pot index 497f03b..c89cea5 100644 --- a/priv/gettext/prompts.pot +++ b/priv/gettext/prompts.pot @@ -67,7 +67,7 @@ msgid "Ammo group created successfully" msgstr "" #, elixir-autogen, elixir-format -#: lib/cannery_web/live/ammo_group_live/index.ex:46 +#: lib/cannery_web/live/ammo_group_live/index.ex:54 #: lib/cannery_web/live/ammo_group_live/show.ex:34 msgid "Ammo group deleted succesfully" msgstr "" @@ -97,8 +97,8 @@ msgid "Are you sure you want to delete the invite for %{name}?" msgstr "" #, elixir-autogen, elixir-format -#: lib/cannery_web/live/ammo_group_live/index.html.heex:111 -#: lib/cannery_web/live/ammo_group_live/show.html.heex:44 +#: lib/cannery_web/live/ammo_group_live/index.html.heex:118 +#: lib/cannery_web/live/ammo_group_live/show.html.heex:45 #: lib/cannery_web/live/ammo_type_live/index.html.heex:68 msgid "Are you sure you want to delete this ammo?" msgstr ""