add data-qa tags

This commit is contained in:
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 %>