remove data-qa

This commit is contained in:
2023-03-15 00:45:08 -04:00
parent b29a5cce7b
commit 8163b906a2
45 changed files with 1122 additions and 389 deletions

View File

@ -79,7 +79,9 @@ defmodule Cannery.ActivityLog.ShotGroup do
defp validate_create_shot_group_count(changeset, %AmmoGroup{count: ammo_group_count}) do
if changeset |> Changeset.get_field(:count) > ammo_group_count do
error = dgettext("errors", "Count must be less than %{count}", count: ammo_group_count)
error =
dgettext("errors", "Count must be less than %{count} shots", count: ammo_group_count)
changeset |> Changeset.add_error(:count, error)
else
changeset
@ -115,7 +117,9 @@ defmodule Cannery.ActivityLog.ShotGroup do
cond do
shot_diff_to_add > ammo_group_count ->
error = dgettext("errors", "Count must be less than %{count}", count: ammo_group_count)
error =
dgettext("errors", "Count must be less than %{count} shots", count: ammo_group_count)
changeset |> Changeset.add_error(:count, error)
new_shot_group_count <= 0 ->

View File

@ -185,11 +185,7 @@ defmodule CanneryWeb.Components.AmmoTypeTableComponent do
assigns = %{ammo_type: ammo_type}
~H"""
<.link
navigate={Routes.ammo_type_show_path(Endpoint, :show, @ammo_type)}
class="link"
data-qa={"view-name-#{@ammo_type.id}"}
>
<.link navigate={Routes.ammo_type_show_path(Endpoint, :show, @ammo_type)} class="link">
<%= @ammo_type.name %>
</.link>
"""

View File

@ -49,7 +49,6 @@
phx-change="search"
phx-submit="search"
class="grow self-stretch flex flex-col items-stretch"
data-qa="ammo_group_search"
>
<%= text_input(f, :search_term,
class: "input input-primary",
@ -124,7 +123,11 @@
<.link
navigate={Routes.ammo_group_show_path(Endpoint, :show, ammo_group)}
class="text-primary-600 link"
data-qa={"view-#{ammo_group.id}"}
aria-label={
gettext("View ammo group of %{ammo_group_count} bullets",
ammo_group_count: ammo_group.count
)
}
>
<i class="fa-fw fa-lg fas fa-eye"></i>
</.link>
@ -132,7 +135,11 @@
<.link
patch={Routes.ammo_group_index_path(Endpoint, :edit, ammo_group)}
class="text-primary-600 link"
data-qa={"edit-#{ammo_group.id}"}
aria-label={
gettext("Edit ammo group of %{ammo_group_count} bullets",
ammo_group_count: ammo_group.count
)
}
>
<i class="fa-fw fa-lg fas fa-edit"></i>
</.link>
@ -140,7 +147,11 @@
<.link
patch={Routes.ammo_group_index_path(Endpoint, :clone, ammo_group)}
class="text-primary-600 link"
data-qa={"clone-#{ammo_group.id}"}
aria-label={
gettext("Clone ammo group of %{ammo_group_count} bullets",
ammo_group_count: ammo_group.count
)
}
>
<i class="fa-fw fa-lg fas fa-copy"></i>
</.link>
@ -151,7 +162,11 @@
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}"}
aria-label={
gettext("Delete ammo group of %{ammo_group_count} bullets",
ammo_group_count: ammo_group.count
)
}
>
<i class="fa-fw fa-lg fas fa-trash"></i>
</.link>

View File

@ -129,7 +129,9 @@ defmodule CanneryWeb.AmmoGroupLive.Show 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}"}
aria-label={
gettext("Edit shot group of %{shot_group_count} shots", shot_group_count: @shot_group.count)
}
>
<i class="fa-fw fa-lg fas fa-edit"></i>
</.link>
@ -140,7 +142,11 @@ defmodule CanneryWeb.AmmoGroupLive.Show do
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}"}
aria-label={
gettext("Delete shot record of %{shot_group_count} shots",
shot_group_count: @shot_group.count
)
}
>
<i class="fa-fw fa-lg fas fa-trash"></i>
</.link>

View File

@ -55,7 +55,6 @@
<.link
navigate={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>
@ -63,7 +62,11 @@
<.link
patch={Routes.ammo_group_show_path(Endpoint, :edit, @ammo_group)}
class="mx-4 my-2 text-primary-600 link"
data-qa="edit"
aria-label={
gettext("Edit ammo group of %{ammo_group_count} bullets",
ammo_group_count: @ammo_group.count
)
}
>
<i class="fa-fw fa-lg fas fa-edit"></i>
</.link>
@ -73,7 +76,11 @@
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"
aria-label={
gettext("Delete ammo group of %{ammo_group_count} bullets",
ammo_group_count: @ammo_group.count
)
}
>
<i class="fa-fw fa-lg fas fa-trash"></i>
</.link>
@ -89,7 +96,6 @@
<.link
patch={Routes.ammo_group_show_path(Endpoint, :move, @ammo_group)}
class="btn btn-primary"
data-qa="move"
>
<%= dgettext("actions", "Move containers") %>
</.link>

View File

@ -24,7 +24,6 @@
phx-change="search"
phx-submit="search"
class="grow self-stretch flex flex-col items-stretch"
data-qa="ammo_type_search"
>
<%= text_input(f, :search_term,
class: "input input-primary",
@ -60,7 +59,7 @@
<.link
navigate={Routes.ammo_type_show_path(Endpoint, :show, ammo_type)}
class="text-primary-600 link"
data-qa={"view-#{ammo_type.id}"}
aria-label={gettext("View %{ammo_type_name}", ammo_type_name: ammo_type.name)}
>
<i class="fa-fw fa-lg fas fa-eye"></i>
</.link>
@ -68,7 +67,7 @@
<.link
patch={Routes.ammo_type_index_path(Endpoint, :edit, ammo_type)}
class="text-primary-600 link"
data-qa={"edit-#{ammo_type.id}"}
aria-label={gettext("Edit %{ammo_type_name}", ammo_type_name: ammo_type.name)}
>
<i class="fa-fw fa-lg fas fa-edit"></i>
</.link>
@ -76,7 +75,7 @@
<.link
patch={Routes.ammo_type_index_path(Endpoint, :clone, ammo_type)}
class="text-primary-600 link"
data-qa={"clone-#{ammo_type.id}"}
aria-label={gettext("Clone %{ammo_type_name}", ammo_type_name: ammo_type.name)}
>
<i class="fa-fw fa-lg fas fa-copy"></i>
</.link>
@ -93,7 +92,7 @@
name: ammo_type.name
)
}
data-qa={"delete-#{ammo_type.id}"}
aria-label={gettext("Delete %{ammo_type_name}", ammo_type_name: ammo_type.name)}
>
<i class="fa-lg fas fa-trash"></i>
</.link>

View File

@ -16,7 +16,7 @@
<.link
patch={Routes.ammo_type_show_path(Endpoint, :edit, @ammo_type)}
class="text-primary-600 link"
data-qa="edit"
aria-label={gettext("Edit %{ammo_type_name}", ammo_type_name: @ammo_type.name)}
>
<i class="fa-fw fa-lg fas fa-edit"></i>
</.link>
@ -32,7 +32,7 @@
name: @ammo_type.name
)
}
data-qa="delete"
aria-label={gettext("Delete %{ammo_type_name}", ammo_type_name: @ammo_type.name)}
>
<i class="fa-fw fa-lg fas fa-trash"></i>
</.link>

View File

@ -24,7 +24,6 @@
phx-change="search"
phx-submit="search"
class="grow self-stretch flex flex-col items-stretch"
data-qa="container_search"
>
<%= text_input(f, :search_term,
class: "input input-primary",
@ -61,6 +60,7 @@
<.link
patch={Routes.container_index_path(Endpoint, :edit_tags, container)}
class="text-primary-600 link"
aria-label={gettext("Tag %{container_name}", container_name: container.name)}
>
<i class="fa-fw fa-lg fas fa-tags"></i>
</.link>
@ -70,7 +70,7 @@
<.link
patch={Routes.container_index_path(Endpoint, :edit, container)}
class="text-primary-600 link"
data-qa={"edit-#{container.id}"}
aria-label={gettext("Edit %{container_name}", container_name: container.name)}
>
<i class="fa-fw fa-lg fas fa-edit"></i>
</.link>
@ -78,7 +78,7 @@
<.link
patch={Routes.container_index_path(Endpoint, :clone, container)}
class="text-primary-600 link"
data-qa={"clone-#{container.id}"}
aria-label={gettext("Clone %{container_name}", container_name: container.name)}
>
<i class="fa-fw fa-lg fas fa-copy"></i>
</.link>
@ -91,7 +91,7 @@
data-confirm={
dgettext("prompts", "Are you sure you want to delete %{name}?", name: container.name)
}
data-qa={"delete-#{container.id}"}
aria-label={gettext("Delete %{container_name}", container_name: container.name)}
>
<i class="fa-fw fa-lg fas fa-trash"></i>
</.link>
@ -105,6 +105,7 @@
<.link
patch={Routes.container_index_path(Endpoint, :edit_tags, container)}
class="text-primary-600 link"
aria-label={gettext("Tag %{container_name}", container_name: container.name)}
>
<i class="fa-fw fa-lg fas fa-tags"></i>
</.link>
@ -113,7 +114,7 @@
<.link
patch={Routes.container_index_path(Endpoint, :edit, container)}
class="text-primary-600 link"
data-qa={"edit-#{container.id}"}
aria-label={gettext("Edit %{container_name}", container_name: container.name)}
>
<i class="fa-fw fa-lg fas fa-edit"></i>
</.link>
@ -121,7 +122,7 @@
<.link
patch={Routes.container_index_path(Endpoint, :clone, container)}
class="text-primary-600 link"
data-qa={"clone-#{container.id}"}
aria-label={gettext("Clone %{container_name}", container_name: container.name)}
>
<i class="fa-fw fa-lg fas fa-copy"></i>
</.link>
@ -134,7 +135,7 @@
data-confirm={
dgettext("prompts", "Are you sure you want to delete %{name}?", name: container.name)
}
data-qa={"delete-#{container.id}"}
aria-label={gettext("Delete %{container_name}", container_name: container.name)}
>
<i class="fa-fw fa-lg fas fa-trash"></i>
</.link>

View File

@ -42,7 +42,7 @@
<.link
patch={Routes.container_show_path(Endpoint, :edit, @container)}
class="text-primary-600 link"
data-qa="edit"
aria-label={gettext("Edit %{container_name}", container_name: @container.name)}
>
<i class="fa-fw fa-lg fas fa-edit"></i>
</.link>
@ -54,7 +54,7 @@
data-confirm={
dgettext("prompts", "Are you sure you want to delete %{name}?", name: @container.name)
}
data-qa="delete"
aria-label={gettext("Delete %{container_name}", container_name: @container.name)}
>
<i class="fa-fw fa-lg fas fa-trash"></i>
</.link>

View File

@ -26,6 +26,7 @@
type="submit"
class="mx-2 my-1 btn btn-primary"
phx-click={JS.dispatch("cannery:clipcopy", to: "#code-#{invite.id}")}
aria-label={gettext("Copy invite link for %{invite_name}", invite_name: invite.name)}
>
<%= dgettext("actions", "Copy to clipboard") %>
</button>
@ -34,7 +35,7 @@
<.link
patch={Routes.invite_index_path(Endpoint, :edit, invite)}
class="text-primary-600 link"
data-qa={"edit-#{invite.id}"}
aria-label={gettext("Edit invite for %{invite_name}", invite_name: invite.name)}
>
<i class="fa-fw fa-lg fas fa-edit"></i>
</.link>
@ -49,7 +50,7 @@
invite_name: invite.name
)
}
data-qa={"delete-#{invite.id}"}
aria-label={gettext("Delete invite for %{invite_name}", invite_name: invite.name)}
>
<i class="fa-fw fa-lg fas fa-trash"></i>
</.link>

View File

@ -103,7 +103,7 @@ defmodule CanneryWeb.LiveHelpers do
value={@value}
checked={@value}
class="sr-only peer"
data-qa={@id}
aria-labelledby={"#{@id}-label"}
{
if assigns |> Map.has_key?(:target),
do: %{"phx-click": @action, "phx-value-value": @value, "phx-target": @target},
@ -119,7 +119,7 @@ defmodule CanneryWeb.LiveHelpers do
after:transition-all after:duration-250 after:ease-in-out
transition-colors duration-250 ease-in-out">
</div>
<span class="ml-3 text-sm font-medium text-gray-900 dark:text-gray-300">
<span id={"#{@id}-label"} class="ml-3 text-sm font-medium text-gray-900 dark:text-gray-300">
<%= render_slot(@inner_block) %>
</span>
</label>

View File

@ -74,7 +74,6 @@
phx-change="search"
phx-submit="search"
class="grow self-stretch flex flex-col items-stretch"
data-qa="shot_group_search"
>
<%= text_input(f, :search_term,
class: "input input-primary",
@ -102,7 +101,11 @@
<.link
patch={Routes.range_index_path(Endpoint, :edit, shot_group)}
class="text-primary-600 link"
data-qa={"edit-#{shot_group.id}"}
aria-label={
gettext("Edit shot record of %{shot_group_count} shots",
shot_group_count: shot_group.count
)
}
>
<i class="fa-fw fa-lg fas fa-edit"></i>
</.link>
@ -115,7 +118,11 @@
data-confirm={
dgettext("prompts", "Are you sure you want to delete this shot record?")
}
data-qa={"delete-#{shot_group.id}"}
aria-label={
gettext("Delete shot record of %{shot_group_count} shots",
shot_group_count: shot_group.count
)
}
>
<i class="fa-fw fa-lg fas fa-trash"></i>
</.link>

View File

@ -27,7 +27,6 @@
phx-change="search"
phx-submit="search"
class="grow self-stretch flex flex-col items-stretch"
data-qa="tag_search"
>
<%= text_input(f, :search_term,
class: "input input-primary",
@ -49,7 +48,7 @@
<.link
patch={Routes.tag_index_path(Endpoint, :edit, tag)}
class="text-primary-600 link"
data-qa={"edit-#{tag.id}"}
aria-label={gettext("Edit %{tag_name}", tag_name: tag.name)}
>
<i class="fa-fw fa-lg fas fa-edit"></i>
</.link>
@ -62,7 +61,7 @@
data-confirm={
dgettext("prompts", "Are you sure you want to delete %{name}?", name: tag.name)
}
data-qa={"delete-#{tag.id}"}
aria-label={gettext("Delete %{tag_name}", tag_name: tag.name)}
>
<i class="fa-fw fa-lg fas fa-trash"></i>
</.link>