add data-qa tags

This commit is contained in:
shibao 2022-02-16 22:39:53 -05:00
parent 08f87d38eb
commit 3e0bd6ab34
14 changed files with 112 additions and 75 deletions

View File

@ -33,10 +33,13 @@ defmodule CanneryWeb.UserAuth do
def log_in_user(conn, %User{confirmed_at: nil}, params) do
conn
|> put_flash(:error, dgettext("errors", "You must confirm your account and log in to access this page."))
|> maybe_store_return_to()
|> redirect(to: Routes.user_session_path(conn, :new))
|> halt()
|> put_flash(
:error,
dgettext("errors", "You must confirm your account and log in to access this page.")
)
|> maybe_store_return_to()
|> redirect(to: Routes.user_session_path(conn, :new))
|> halt()
end
def log_in_user(conn, user, params) do
@ -152,7 +155,10 @@ defmodule CanneryWeb.UserAuth do
conn
else
conn
|> put_flash(:error, dgettext("errors", "You must confirm your account and log in to access this page."))
|> put_flash(
:error,
dgettext("errors", "You must confirm your account and log in to access this page.")
)
|> maybe_store_return_to()
|> redirect(to: Routes.user_session_path(conn, :new))
|> halt()

View File

@ -92,12 +92,14 @@
<td class="p-2">
<div class="px-4 py-2 space-x-4 flex justify-center items-center">
<%= live_redirect to: Routes.ammo_group_show_path(@socket, :show, ammo_group),
class: "text-primary-500 link" do %>
class: "text-primary-500 link",
data: [qa: "view-#{ammo_group.id}"] do %>
<i class="fa-fw fa-lg fas fa-eye"></i>
<% end %>
<%= live_patch to: Routes.ammo_group_index_path(@socket, :edit, ammo_group),
class: "text-primary-500 link" do %>
class: "text-primary-500 link",
data: [qa: "edit-#{ammo_group.id}"] do %>
<i class="fa-fw fa-lg fas fa-edit"></i>
<% end %>
@ -105,7 +107,10 @@
class: "text-primary-500 link",
phx_click: "delete",
phx_value_id: ammo_group.id,
data: [confirm: dgettext("prompts", "Are you sure you want to delete this ammo?")] do %>
data: [
confirm: dgettext("prompts", "Are you sure you want to delete this ammo?"),
qa: "delete-#{ammo_group.id}"
] do %>
<i class="fa-fw fa-lg fas fa-trash"></i>
<% end %>
</div>

View File

@ -27,18 +27,23 @@
<div class="flex flex-wrap justify-center items-center text-primary-500">
<%= 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"
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" do %>
class: "mx-4 my-2 text-primary-500 link",
data: [qa: "edit"] do %>
<i class="fa-fw fa-lg fas fa-edit"></i>
<% 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?")] do %>
data: [
confirm: dgettext("prompts", "Are you sure you want to delete this ammo?"),
qa: "delete"
] do %>
<i class="fa-fw fa-lg fas fa-trash"></i>
<% end %>
@ -48,7 +53,8 @@
<%= live_patch(dgettext("actions", "Move to different container"),
to: Routes.ammo_group_show_path(Endpoint, :move, @ammo_group),
class: "btn btn-primary"
class: "btn btn-primary",
data: [qa: "move"]
) %>
</div>

View File

@ -49,12 +49,14 @@
<td class="p-2">
<div class="px-4 py-2 space-x-4 flex justify-center items-center">
<%= live_redirect to: Routes.ammo_type_show_path(@socket, :show, ammo_type),
class: "text-primary-500 link" do %>
class: "text-primary-500 link",
data: [qa: "view-#{ammo_type.id}"] do %>
<i class="fa-fw fa-lg fas fa-eye"></i>
<% end %>
<%= live_patch to: Routes.ammo_type_index_path(@socket, :edit, ammo_type),
class: "text-primary-500 link" do %>
class: "text-primary-500 link",
data: [qa: "edit-#{ammo_type.id}"] do %>
<i class="fa-fw fa-lg fas fa-edit"></i>
<% end %>
@ -62,7 +64,10 @@
class: "text-primary-500 link",
phx_click: "delete",
phx_value_id: ammo_type.id,
data: [confirm: dgettext("prompts", "Are you sure you want to delete this ammo?")] do %>
data: [
confirm: dgettext("prompts", "Are you sure you want to delete this ammo?"),
qa: "delete-#{ammo_type.id}"
] do %>
<i class="fa-lg fas fa-trash"></i>
<% end %>
</div>

View File

@ -14,7 +14,8 @@
<div class="flex space-x-4 justify-center items-center text-primary-500">
<%= live_patch to: Routes.ammo_type_show_path(@socket, :edit, @ammo_type),
class: "text-primary-500 link" do %>
class: "text-primary-500 link",
data: [qa: "edit"] do %>
<i class="fa-fw fa-lg fas fa-edit"></i>
<% end %>
@ -23,7 +24,8 @@
phx_click: "delete",
data: [
confirm:
dgettext("prompts", "Are you sure you want to delete %{name}?", name: @ammo_type.name)
dgettext("prompts", "Are you sure you want to delete %{name}?", name: @ammo_type.name),
qa: "delete"
] do %>
<i class="fa-fw fa-lg fas fa-trash"></i>
<% end %>

View File

@ -24,7 +24,8 @@
<%= for container <- @containers do %>
<.container_card container={container}>
<%= live_patch to: Routes.container_index_path(@socket, :edit, container),
class: "text-primary-500 link" do %>
class: "text-primary-500 link",
data: [qa: "edit-#{container.id}"] do %>
<i class="fa-fw fa-lg fas fa-edit"></i>
<% end %>
@ -34,7 +35,8 @@
phx_value_id: container.id,
data: [
confirm:
dgettext("prompts", "Are you sure you want to delete %{name}?", name: container.name)
dgettext("prompts", "Are you sure you want to delete %{name}?", name: container.name),
qa: "delete-#{container.id}"
] do %>
<i class="fa-fw fa-lg fas fa-trash"></i>
<% end %>

View File

@ -24,7 +24,8 @@
<div class="flex space-x-4 justify-center items-center text-primary-500">
<%= live_patch to: Routes.container_show_path(@socket, :edit, @container),
class: "text-primary-500 link" do %>
class: "text-primary-500 link",
data: [qa: "edit"] do %>
<i class="fa-fw fa-lg fas fa-edit"></i>
<% end %>
@ -33,7 +34,8 @@
phx_click: "delete_container",
data: [
confirm:
dgettext("prompts", "Are you sure you want to delete %{name}?", name: @container.name)
dgettext("prompts", "Are you sure you want to delete %{name}?", name: @container.name),
qa: "delete"
] do %>
<i class="fa-fw fa-lg fas fa-trash"></i>
<% end %>

View File

@ -36,7 +36,8 @@
</form>
</:code_actions>
<%= live_patch to: Routes.invite_index_path(Endpoint, :edit, invite),
class: "text-primary-500 link" do %>
class: "text-primary-500 link",
data: [qa: "edit-#{invite.id}"] do %>
<i class="fa-fw fa-lg fas fa-edit"></i>
<% end %>
@ -48,7 +49,8 @@
confirm:
dgettext("prompts", "Are you sure you want to delete the invite for %{name}?",
name: invite.name
)
),
qa: "delete-#{invite.id}"
] do %>
<i class="fa-fw fa-lg fas fa-trash"></i>
<% end %>

View File

@ -93,7 +93,8 @@
<td class="p-2 w-full h-full space-x-2 flex justify-center items-center">
<div class="px-4 py-2 space-x-4 flex justify-center items-center">
<%= live_patch to: Routes.range_index_path(Endpoint, :edit, shot_group),
class: "text-primary-500 link" do %>
class: "text-primary-500 link",
data: [qa: "edit-#{shot_group.id}"] do %>
<i class="fa-fw fa-lg fas fa-edit"></i>
<% end %>
@ -101,7 +102,10 @@
class: "text-primary-500 link",
phx_click: "delete",
phx_value_id: shot_group.id,
data: [confirm: dgettext("prompts", "Are you sure you want to delete this shot record?")] do %>
data: [
confirm: dgettext("prompts", "Are you sure you want to delete this shot record?"),
qa: "delete-#{shot_group.id}"
] do %>
<i class="fa-fw fa-lg fas fa-trash"></i>
<% end %>
</div>

View File

@ -25,7 +25,8 @@
<%= for tag <- @tags do %>
<.tag_card tag={tag}>
<%= live_patch to: Routes.tag_index_path(Endpoint, :edit, tag),
class: "text-primary-500 link" do %>
class: "text-primary-500 link",
data: [qa: "edit-#{tag.id}"] do %>
<i class="fa-fw fa-lg fas fa-edit"></i>
<% end %>
@ -34,7 +35,8 @@
phx_click: "delete",
phx_value_id: tag.id,
data: [
confirm: dgettext("prompts", "Are you sure you want to delete %{name}?", name: tag.name)
confirm: dgettext("prompts", "Are you sure you want to delete %{name}?", name: tag.name),
qa: "delete-#{tag.id}"
] do %>
<i class="fa-fw fa-lg fas fa-trash"></i>
<% end %>

View File

@ -140,7 +140,7 @@ msgid "Send instructions to reset password"
msgstr ""
#, elixir-autogen, elixir-format
#: lib/cannery_web/live/container_live/show.html.heex:51
#: lib/cannery_web/live/container_live/show.html.heex:53
msgid "Why not add one?"
msgstr ""
@ -175,7 +175,7 @@ msgid "Add another container!"
msgstr ""
#, elixir-autogen, elixir-format
#: lib/cannery_web/live/ammo_group_live/show.html.heex:49
#: lib/cannery_web/live/ammo_group_live/show.html.heex:54
msgid "Move to different container"
msgstr ""

View File

@ -21,7 +21,7 @@ msgid "Access from any internet-capable device"
msgstr ""
#, elixir-autogen, elixir-format
#: lib/cannery_web/live/invite_live/index.html.heex:85
#: lib/cannery_web/live/invite_live/index.html.heex:87
msgid "Admins"
msgstr ""
@ -44,7 +44,7 @@ msgid "Ammo type"
msgstr ""
#, elixir-autogen, elixir-format
#: lib/cannery_web/live/ammo_type_live/show.html.heex:90
#: lib/cannery_web/live/ammo_type_live/show.html.heex:92
msgid "Average Price paid"
msgstr ""
@ -68,35 +68,35 @@ msgstr ""
#, elixir-autogen, elixir-format
#: lib/cannery_web/live/ammo_type_live/form_component.html.heex:44
#: lib/cannery_web/live/ammo_type_live/index.ex:53
#: lib/cannery_web/live/ammo_type_live/show.html.heex:37
#: lib/cannery_web/live/ammo_type_live/show.html.heex:39
msgid "Bullet core"
msgstr ""
#, elixir-autogen, elixir-format
#: lib/cannery_web/live/ammo_type_live/form_component.html.heex:37
#: lib/cannery_web/live/ammo_type_live/index.ex:52
#: lib/cannery_web/live/ammo_type_live/show.html.heex:36
#: lib/cannery_web/live/ammo_type_live/show.html.heex:38
msgid "Bullet type"
msgstr ""
#, elixir-autogen, elixir-format
#: lib/cannery_web/live/ammo_type_live/form_component.html.heex:58
#: lib/cannery_web/live/ammo_type_live/index.ex:55
#: lib/cannery_web/live/ammo_type_live/show.html.heex:39
#: lib/cannery_web/live/ammo_type_live/show.html.heex:41
msgid "Caliber"
msgstr ""
#, elixir-autogen, elixir-format
#: lib/cannery_web/live/ammo_type_live/form_component.html.heex:51
#: lib/cannery_web/live/ammo_type_live/index.ex:54
#: lib/cannery_web/live/ammo_type_live/show.html.heex:38
#: lib/cannery_web/live/ammo_type_live/show.html.heex:40
msgid "Cartridge"
msgstr ""
#, elixir-autogen, elixir-format
#: lib/cannery_web/live/ammo_type_live/form_component.html.heex:65
#: lib/cannery_web/live/ammo_type_live/index.ex:56
#: lib/cannery_web/live/ammo_type_live/show.html.heex:40
#: lib/cannery_web/live/ammo_type_live/show.html.heex:42
msgid "Case material"
msgstr ""
@ -144,7 +144,7 @@ msgid "Description:"
msgstr ""
#, elixir-autogen, elixir-format
#: lib/cannery_web/live/invite_live/index.html.heex:58
#: lib/cannery_web/live/invite_live/index.html.heex:60
msgid "Disable"
msgstr ""
@ -182,7 +182,7 @@ msgid "Edit Tag"
msgstr ""
#, elixir-autogen, elixir-format
#: lib/cannery_web/live/invite_live/index.html.heex:62
#: lib/cannery_web/live/invite_live/index.html.heex:64
msgid "Enable"
msgstr ""
@ -199,7 +199,7 @@ msgstr ""
#, elixir-autogen, elixir-format
#: lib/cannery_web/live/ammo_type_live/form_component.html.heex:106
#: lib/cannery_web/live/ammo_type_live/index.ex:61
#: lib/cannery_web/live/ammo_type_live/show.html.heex:45
#: lib/cannery_web/live/ammo_type_live/show.html.heex:47
msgid "Grains"
msgstr ""
@ -333,12 +333,12 @@ msgid "No Ammo Types"
msgstr ""
#, elixir-autogen, elixir-format
#: lib/cannery_web/live/ammo_type_live/show.html.heex:103
#: lib/cannery_web/live/ammo_type_live/show.html.heex:105
msgid "No ammo for this type"
msgstr ""
#, elixir-autogen, elixir-format
#: lib/cannery_web/live/container_live/show.html.heex:86
#: lib/cannery_web/live/container_live/show.html.heex:88
msgid "No ammo groups in this container"
msgstr ""
@ -380,7 +380,7 @@ msgstr ""
#, elixir-autogen, elixir-format
#: lib/cannery_web/live/ammo_type_live/form_component.html.heex:114
#: lib/cannery_web/live/ammo_type_live/index.ex:62
#: lib/cannery_web/live/ammo_type_live/show.html.heex:46
#: lib/cannery_web/live/ammo_type_live/show.html.heex:48
msgid "Pressure"
msgstr ""
@ -399,7 +399,7 @@ msgstr ""
#, elixir-autogen, elixir-format
#: lib/cannery_web/live/ammo_type_live/form_component.html.heex:121
#: lib/cannery_web/live/ammo_type_live/index.ex:63
#: lib/cannery_web/live/ammo_type_live/show.html.heex:47
#: lib/cannery_web/live/ammo_type_live/show.html.heex:49
msgid "Primer type"
msgstr ""
@ -424,7 +424,7 @@ msgid "Self-host your own instance, or use an instance from someone you trust."
msgstr ""
#, elixir-autogen, elixir-format
#: lib/cannery_web/live/invite_live/index.html.heex:74
#: lib/cannery_web/live/invite_live/index.html.heex:76
msgid "Set Unlimited"
msgstr ""
@ -459,13 +459,13 @@ msgid "Steel"
msgstr ""
#, elixir-autogen, elixir-format
#: lib/cannery_web/live/ammo_group_live/show.html.heex:60
#: lib/cannery_web/live/ammo_group_live/show.html.heex:66
msgid "Stored in"
msgstr ""
#, elixir-autogen, elixir-format
#: lib/cannery_web/components/topbar.ex:39
#: lib/cannery_web/live/container_live/show.html.heex:58
#: lib/cannery_web/live/container_live/show.html.heex:60
#: lib/cannery_web/live/tag_live/index.html.heex:3
msgid "Tags"
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:65
#: lib/cannery_web/live/ammo_group_live/show.html.heex:71
msgid "This ammo group is not in a container"
msgstr ""
@ -509,7 +509,7 @@ msgid "Type:"
msgstr ""
#, elixir-autogen, elixir-format
#: lib/cannery_web/live/invite_live/index.html.heex:114
#: lib/cannery_web/live/invite_live/index.html.heex:116
msgid "Users"
msgstr ""
@ -539,7 +539,7 @@ msgid "Add Tag to Container"
msgstr ""
#, elixir-autogen, elixir-format
#: lib/cannery_web/live/container_live/show.html.heex:47
#: lib/cannery_web/live/container_live/show.html.heex:49
msgid "No tags for this container"
msgstr ""
@ -569,13 +569,13 @@ msgid "No ammo staged"
msgstr ""
#, elixir-autogen, elixir-format
#: lib/cannery_web/live/ammo_group_live/show.html.heex:46
#: lib/cannery_web/live/ammo_group_live/show.html.heex:51
#: 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:46
#: lib/cannery_web/live/ammo_group_live/show.html.heex:51
#: lib/cannery_web/live/range_live/index.html.heex:31
msgid "Unstage from range"
msgstr ""
@ -662,7 +662,7 @@ msgstr ""
#: lib/cannery_web/components/ammo_group_card.ex:43
#: lib/cannery_web/live/ammo_group_live/index.html.heex:64
#: lib/cannery_web/live/ammo_group_live/show.html.heex:22
#: lib/cannery_web/live/ammo_type_live/show.html.heex:94
#: lib/cannery_web/live/ammo_type_live/show.html.heex:96
msgid "$%{amount}"
msgstr ""
@ -674,28 +674,28 @@ msgstr ""
#, elixir-autogen, elixir-format
#: lib/cannery_web/live/ammo_type_live/form_component.html.heex:72
#: lib/cannery_web/live/ammo_type_live/index.ex:57
#: lib/cannery_web/live/ammo_type_live/show.html.heex:41
#: lib/cannery_web/live/ammo_type_live/show.html.heex:43
msgid "Jacket type"
msgstr ""
#, elixir-autogen, elixir-format
#: lib/cannery_web/live/ammo_type_live/form_component.html.heex:79
#: lib/cannery_web/live/ammo_type_live/index.ex:58
#: lib/cannery_web/live/ammo_type_live/show.html.heex:42
#: lib/cannery_web/live/ammo_type_live/show.html.heex:44
msgid "Muzzle velocity"
msgstr ""
#, elixir-autogen, elixir-format
#: lib/cannery_web/live/ammo_type_live/form_component.html.heex:96
#: lib/cannery_web/live/ammo_type_live/index.ex:60
#: lib/cannery_web/live/ammo_type_live/show.html.heex:44
#: lib/cannery_web/live/ammo_type_live/show.html.heex:46
msgid "Powder grains per charge"
msgstr ""
#, elixir-autogen, elixir-format
#: lib/cannery_web/live/ammo_type_live/form_component.html.heex:89
#: lib/cannery_web/live/ammo_type_live/index.ex:59
#: lib/cannery_web/live/ammo_type_live/show.html.heex:43
#: lib/cannery_web/live/ammo_type_live/show.html.heex:45
msgid "Powder type"
msgstr ""

View File

@ -102,15 +102,10 @@ msgid "You are not authorized to view this page"
msgstr ""
#, elixir-autogen, elixir-format
#: lib/cannery_web/controllers/user_auth.ex:160
#: lib/cannery_web/controllers/user_auth.ex:176
msgid "You are not authorized to view this page."
msgstr ""
#, elixir-autogen, elixir-format
#: lib/cannery_web/controllers/user_auth.ex:145
msgid "You must log in to access this page."
msgstr ""
#, elixir-autogen, elixir-format
#: lib/cannery/accounts/user.ex:128
msgid "did not change"
@ -151,3 +146,9 @@ msgstr ""
#: lib/cannery/activity_log.ex:120
msgid "Count must be less than %{count}"
msgstr ""
#, elixir-autogen, elixir-format
#: lib/cannery_web/controllers/user_auth.ex:38
#: lib/cannery_web/controllers/user_auth.ex:160
msgid "You must confirm your account and log in to access this page."
msgstr ""

View File

@ -78,28 +78,28 @@ msgid "Ammo group updated successfully"
msgstr ""
#, elixir-autogen, elixir-format
#: lib/cannery_web/live/invite_live/index.html.heex:97
#: lib/cannery_web/live/invite_live/index.html.heex:126
#: lib/cannery_web/live/invite_live/index.html.heex:99
#: lib/cannery_web/live/invite_live/index.html.heex:128
msgid "Are you sure you want to delete %{email}? This action is permanent!"
msgstr ""
#, elixir-autogen, elixir-format
#: lib/cannery_web/live/ammo_type_live/show.html.heex:26
#: lib/cannery_web/live/container_live/index.html.heex:37
#: lib/cannery_web/live/container_live/show.html.heex:36
#: lib/cannery_web/live/tag_live/index.html.heex:37
#: lib/cannery_web/live/ammo_type_live/show.html.heex:27
#: lib/cannery_web/live/container_live/index.html.heex:38
#: lib/cannery_web/live/container_live/show.html.heex:37
#: lib/cannery_web/live/tag_live/index.html.heex:38
msgid "Are you sure you want to delete %{name}?"
msgstr ""
#, elixir-autogen, elixir-format
#: lib/cannery_web/live/invite_live/index.html.heex:49
#: lib/cannery_web/live/invite_live/index.html.heex:50
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:108
#: lib/cannery_web/live/ammo_group_live/show.html.heex:41
#: lib/cannery_web/live/ammo_type_live/index.html.heex:65
#: 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_type_live/index.html.heex:68
msgid "Are you sure you want to delete this ammo?"
msgstr ""
@ -114,7 +114,7 @@ msgid "Are you sure you want to log out?"
msgstr ""
#, elixir-autogen, elixir-format
#: lib/cannery_web/live/invite_live/index.html.heex:72
#: lib/cannery_web/live/invite_live/index.html.heex:74
msgid "Are you sure you want to make %{name} unlimited?"
msgstr ""
@ -175,7 +175,7 @@ msgid "Your account has been deleted"
msgstr ""
#, elixir-autogen, elixir-format
#: lib/cannery_web/live/container_live/show.html.heex:69
#: lib/cannery_web/live/container_live/show.html.heex:71
msgid "Are you sure you want to remove the %{tag_name} tag from %{container_name}?"
msgstr ""
@ -210,7 +210,7 @@ msgid "Ammo group unstaged succesfully"
msgstr ""
#, elixir-autogen, elixir-format
#: lib/cannery_web/live/range_live/index.html.heex:104
#: lib/cannery_web/live/range_live/index.html.heex:106
msgid "Are you sure you want to delete this shot record?"
msgstr ""