mix format with new version

This commit is contained in:
2022-02-17 21:24:59 -05:00
parent 39ba51fba1
commit ba2294f156
29 changed files with 239 additions and 193 deletions

View File

@ -40,7 +40,9 @@ defmodule CanneryWeb.Components.AmmoGroupCard do
<%= if @ammo_group.price_paid do %>
<span class="rounded-lg title text-lg">
<%= gettext("Price paid:") %>
<%= gettext("$%{amount}", amount: @ammo_group.price_paid |> :erlang.float_to_binary(decimals: 2)) %>
<%= gettext("$%{amount}",
amount: @ammo_group.price_paid |> :erlang.float_to_binary(decimals: 2)
) %>
</span>
<% end %>
</div>

View File

@ -8,9 +8,11 @@ defmodule CanneryWeb.Components.InviteCard do
def invite_card(assigns) do
~H"""
<div class="mx-4 my-2 px-8 py-4 flex flex-col justify-center items-center space-y-4
<div
class="mx-4 my-2 px-8 py-4 flex flex-col justify-center items-center space-y-4
border border-gray-400 rounded-lg shadow-lg hover:shadow-md
transition-all duration-300 ease-in-out">
transition-all duration-300 ease-in-out"
>
<h1 class="title text-xl">
<%= @invite.name %>
</h1>
@ -30,7 +32,8 @@ defmodule CanneryWeb.Components.InviteCard do
<code
id={"code-#{@invite.id}"}
class="mx-2 my-1 text-xs px-4 py-2 rounded-lg text-center break-all text-gray-100 bg-primary-800"
><%= Routes.user_registration_url(Endpoint, :new, invite: @invite.token) %>
>
<%= Routes.user_registration_url(Endpoint, :new, invite: @invite.token) %>
</code>
<%= if @code_actions do %>

View File

@ -30,10 +30,12 @@ defmodule CanneryWeb.Components.Topbar do
<% end %>
</div>
<hr class="mb-2 sm:hidden hr-light">
<hr class="mb-2 sm:hidden hr-light" />
<ul class="flex flex-row flex-wrap justify-center items-center
text-lg text-white text-ellipsis">
<ul
class="flex flex-row flex-wrap justify-center items-center
text-lg text-white text-ellipsis"
>
<%= if @current_user do %>
<li class="mx-2 my-1">
<%= link(gettext("Tags"),

View File

@ -21,7 +21,7 @@ defmodule CanneryWeb.Components.UserCard do
<%= if @user.confirmed_at |> is_nil() do %>
Email unconfirmed
<% else %>
User was confirmed at <%= @user.confirmed_at |> display_datetime() %>
User was confirmed at<%= @user.confirmed_at |> display_datetime() %>
<% end %>
</h3>

View File

@ -61,7 +61,9 @@
<td class="p-2">
<%= if ammo_group.price_paid do %>
<%= gettext("$%{amount}", amount: ammo_group.price_paid |> :erlang.float_to_binary(decimals: 2)) %>
<%= gettext("$%{amount}",
amount: ammo_group.price_paid |> :erlang.float_to_binary(decimals: 2)
) %>
<% end %>
</td>
@ -143,7 +145,6 @@
current_user={@current_user}
/>
</.modal>
<% @live_action == :add_shot_group -> %>
<.modal return_to={Routes.ammo_group_index_path(Endpoint, :index)}>
<.live_component
@ -156,7 +157,6 @@
current_user={@current_user}
/>
</.modal>
<% @live_action == :move -> %>
<.modal return_to={Routes.ammo_group_index_path(Endpoint, :index)}>
<.live_component
@ -169,6 +169,5 @@
current_user={@current_user}
/>
</.modal>
<% true -> %>
<% end %>
<% end %>

View File

@ -19,7 +19,9 @@
<%= if @ammo_group.price_paid do %>
<span class="rounded-lg title text-lg">
<%= gettext("Price paid:") %>
<%= gettext("$%{amount}", amount: @ammo_group.price_paid |> :erlang.float_to_binary(decimals: 2)) %>
<%= gettext("$%{amount}",
amount: @ammo_group.price_paid |> :erlang.float_to_binary(decimals: 2)
) %>
</span>
<% end %>
</div>
@ -51,7 +53,9 @@
<div class="flex flex-wrap justify-center items-center text-primary-500">
<button type="button" class="mx-4 my-2 btn btn-primary" phx-click="toggle_staged">
<%= if @ammo_group.staged, do: gettext("Unstage from range"), else: gettext("Stage for range") %>
<%= if @ammo_group.staged,
do: gettext("Unstage from range"),
else: gettext("Stage for range") %>
</button>
<%= live_patch(dgettext("actions", "Move containers"),
@ -67,7 +71,7 @@
</div>
</div>
<hr class="mb-4 w-full">
<hr class="mb-4 w-full" />
<div>
<%= if @ammo_group.container do %>
@ -95,7 +99,6 @@
current_user={@current_user}
/>
</.modal>
<% :add_shot_group -> %>
<.modal return_to={Routes.ammo_group_show_path(Endpoint, :show, @ammo_group)}>
<.live_component
@ -108,7 +111,6 @@
current_user={@current_user}
/>
</.modal>
<% :move -> %>
<.modal return_to={Routes.ammo_group_show_path(Endpoint, :show, @ammo_group)}>
<.live_component
@ -121,6 +123,5 @@
current_user={@current_user}
/>
</.modal>
<% _show -> %>
<% end %>
<% end %>

View File

@ -34,14 +34,18 @@
>
<%= gettext("Example bullet type abbreviations") %>
</a>
<%= label(f, :bullet_type, gettext("Bullet type"), class: "mr-4 title text-lg text-primary-500") %>
<%= label(f, :bullet_type, gettext("Bullet type"),
class: "mr-4 title text-lg text-primary-500"
) %>
<%= text_input(f, :bullet_type,
class: "text-center col-span-2 input input-primary",
placeholder: gettext("FMJ")
) %>
<%= error_tag(f, :bullet_type, "col-span-3 text-center") %>
<%= label(f, :bullet_core, gettext("Bullet core"), class: "mr-4 title text-lg text-primary-500") %>
<%= label(f, :bullet_core, gettext("Bullet core"),
class: "mr-4 title text-lg text-primary-500"
) %>
<%= text_input(f, :bullet_core,
class: "text-center col-span-2 input input-primary",
placeholder: gettext("Steel")
@ -62,14 +66,18 @@
) %>
<%= error_tag(f, :caliber, "col-span-3 text-center") %>
<%= label(f, :case_material, gettext("Case material"), class: "mr-4 title text-lg text-primary-500") %>
<%= label(f, :case_material, gettext("Case material"),
class: "mr-4 title text-lg text-primary-500"
) %>
<%= text_input(f, :case_material,
class: "text-center col-span-2 input input-primary",
placeholder: gettext("Brass")
) %>
<%= error_tag(f, :case_material, "col-span-3 text-center") %>
<%= label(f, :jacket_type, gettext("Jacket type"), class: "mr-4 title text-lg text-primary-500") %>
<%= label(f, :jacket_type, gettext("Jacket type"),
class: "mr-4 title text-lg text-primary-500"
) %>
<%= text_input(f, :jacket_type,
class: "text-center col-span-2 input input-primary",
placeholder: gettext("Bimetal")
@ -86,7 +94,9 @@
) %>
<%= error_tag(f, :muzzle_velocity, "col-span-3 text-center") %>
<%= label(f, :powder_type, gettext("Powder type"), class: "mr-4 title text-lg text-primary-500") %>
<%= label(f, :powder_type, gettext("Powder type"),
class: "mr-4 title text-lg text-primary-500"
) %>
<%= text_input(f, :powder_type,
class: "text-center col-span-2 input input-primary",
placeholder: gettext("Brass")
@ -118,14 +128,18 @@
) %>
<%= error_tag(f, :pressure, "col-span-3 text-center") %>
<%= label(f, :primer_type, gettext("Primer type"), class: "mr-4 title text-lg text-primary-500") %>
<%= label(f, :primer_type, gettext("Primer type"),
class: "mr-4 title text-lg text-primary-500"
) %>
<%= text_input(f, :primer_type,
class: "text-center col-span-2 input input-primary",
placeholder: "Boxer"
) %>
<%= error_tag(f, :primer_type, "col-span-3 text-center") %>
<%= label(f, :firing_type, gettext("Firing type"), class: "mr-4 title text-lg text-primary-500") %>
<%= label(f, :firing_type, gettext("Firing type"),
class: "mr-4 title text-lg text-primary-500"
) %>
<%= text_input(f, :firing_type,
class: "text-center col-span-2 input input-primary",
placeholder: "Centerfire"
@ -148,7 +162,9 @@
<%= checkbox(f, :corrosive, class: "text-center col-span-2 checkbox") %>
<%= error_tag(f, :corrosive, "col-span-3 text-center") %>
<%= label(f, :manufacturer, gettext("Manufacturer"), class: "mr-4 title text-lg text-primary-500") %>
<%= label(f, :manufacturer, gettext("Manufacturer"),
class: "mr-4 title text-lg text-primary-500"
) %>
<%= text_input(f, :manufacturer, class: "text-center col-span-2 input input-primary") %>
<%= error_tag(f, :manufacturer, "col-span-3 text-center") %>

View File

@ -5,9 +5,11 @@
</h1>
<%= if @ammo_type.desc do %>
<span class="max-w-2xl w-full px-8 py-4 rounded-lg
<span
class="max-w-2xl w-full px-8 py-4 rounded-lg
text-center title text-lg
border border-primary-600">
border border-primary-600"
>
<%= @ammo_type.desc %>
</span>
<% end %>
@ -31,7 +33,7 @@
<% end %>
</div>
<hr class="hr">
<hr class="hr" />
<div class="grid sm:grid-cols-2 text-center justify-center items-center">
<%= for {field_name, field} <- [
@ -50,7 +52,7 @@
] do %>
<%= if @ammo_type |> Map.get(field) do %>
<h3 class="mb-2 sm:mr-4 title text-lg">
<%= field_name %> :
<%= field_name %>:
</h3>
<span class="mb-4 sm:mb-2 text-primary-600">
@ -67,7 +69,7 @@
{"Corrosive", :corrosive}
] do %>
<h3 class="mb-2 sm:mr-4 title text-lg">
<%= field_name %> :
<%= field_name %>:
</h3>
<span class="mb-4 sm:mb-2 text-primary-600">
@ -78,7 +80,7 @@
<%= for {field_name, field} <- [{"Manufacturer", :manufacturer}, {"UPC", :upc}] do %>
<%= if @ammo_type |> Map.get(field) do %>
<h3 class="mb-2 sm:mr-4 title text-lg">
<%= field_name %> :
<%= field_name %>:
</h3>
<span class="mb-4 sm:mb-2 text-primary-600">
@ -89,16 +91,18 @@
<%= if @avg_cost_per_round do %>
<h3 class="mb-2 sm:mr-4 title text-lg">
<%= gettext("Average Price paid") %> :
<%= gettext("Average Price paid") %>:
</h3>
<span class="mb-4 sm:mb-2 text-primary-600">
<%= gettext("$%{amount}", amount: @avg_cost_per_round |> :erlang.float_to_binary(decimals: 2)) %>
<%= gettext("$%{amount}",
amount: @avg_cost_per_round |> :erlang.float_to_binary(decimals: 2)
) %>
</span>
<% end %>
</div>
<hr class="hr">
<hr class="hr" />
<div>
<%= if @ammo_groups |> Enum.empty?() do %>

View File

@ -41,7 +41,7 @@
<% end %>
</div>
<hr class="mb-4 hr">
<hr class="mb-4 hr" />
<%= if @container.tags |> Enum.empty?() do %>
<div class="flex flex-row justify-center items-center space-x-4">
@ -81,7 +81,7 @@
<% end %>
<% end %>
<hr class="mb-4 hr">
<hr class="mb-4 hr" />
<p>
<%= if @container.ammo_groups |> Enum.empty?() do %>

View File

@ -34,7 +34,9 @@ defmodule CanneryWeb.HomeLive do
@impl true
def render(assigns) do
~H"""
<div class="mx-auto px-8 sm:px-16 flex flex-col justify-center items-center text-center space-y-4 max-w-3xl">
<div
class="mx-auto px-8 sm:px-16 flex flex-col justify-center items-center text-center space-y-4 max-w-3xl"
>
<h1 class="title text-primary-500 text-2xl">
<%= gettext("Welcome to %{name}", name: "Cannery") %>
</h1>
@ -52,7 +54,8 @@ defmodule CanneryWeb.HomeLive do
<%= gettext("Easy to Use:") %>
</b>
<p>
<%= gettext("%{name} lets you easily keep an eye on your ammo levels before and after range day",
<%= gettext(
"%{name} lets you easily keep an eye on your ammo levels before and after range day",
name: "Cannery"
) %>
</p>
@ -78,7 +81,7 @@ defmodule CanneryWeb.HomeLive do
</li>
</ul>
<hr class="hr">
<hr class="hr" />
<ul class="flex flex-col space-y-2 text-center justify-center">
<h2 class="title text-primary-500 text-lg">

View File

@ -71,7 +71,11 @@
class="btn btn-primary"
phx-click="set_unlimited"
phx-value-id={invite.id}
data-confirm={dgettext("prompts", "Are you sure you want to make %{name} unlimited?", name: invite.name)}
data-confirm={
dgettext("prompts", "Are you sure you want to make %{name} unlimited?",
name: invite.name
)
}
>
<%= gettext("Set Unlimited") %>
</a>
@ -81,7 +85,7 @@
</div>
<%= unless @admins |> Enum.empty?() do %>
<hr class="hr">
<hr class="hr" />
<h1 class="title text-2xl text-primary-500">
<%= gettext("Admins") %>
@ -110,7 +114,7 @@
<% end %>
<%= unless @users |> Enum.empty?() do %>
<hr class="hr">
<hr class="hr" />
<h1 class="title text-2xl text-primary-500">
<%= gettext("Users") %>

View File

@ -28,7 +28,9 @@
phx-value-ammo_group_id={ammo_group.id}
data-confirm={"#{dgettext("prompts", "Are you sure you want to unstage this ammo?")}"}
>
<%= if ammo_group.staged, do: gettext("Unstage from range"), else: gettext("Stage for range") %>
<%= if ammo_group.staged,
do: gettext("Unstage from range"),
else: gettext("Stage for range") %>
</button>
<%= live_patch(dgettext("actions", "Record shots"),
@ -39,7 +41,7 @@
<% end %>
<% end %>
<hr class="hr">
<hr class="hr" />
<%= if @shot_groups |> Enum.empty?() do %>
<h1 class="title text-xl text-primary-500">

View File

@ -5,11 +5,10 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>
<%= dgettext("errors", "Error") %> | Cannery
<%= dgettext("errors", "Error") %>| Cannery
</title>
<link rel="stylesheet" href="/css/app.css" />
<script defer type="text/javascript" src="/js/app.js">
</script>
<script defer type="text/javascript" src="/js/app.js"></script>
</head>
<body class="pb-8 m-0 p-0 w-full h-full">
<header>
@ -17,12 +16,14 @@
</header>
<div class="pb-8 w-full flex flex-col justify-center items-center text-center">
<div class="p-8 sm:p-16 w-full flex flex-col justify-center items-center space-y-4 max-w-3xl">
<div
class="p-8 sm:p-16 w-full flex flex-col justify-center items-center space-y-4 max-w-3xl"
>
<h1 class="title text-primary-500 text-3xl">
<%= @error_string %>
</h1>
<hr class="w-full hr">
<hr class="w-full hr" />
<a href={Routes.live_path(Endpoint, HomeLive)} class="link title text-primary-500 text-lg">
<%= dgettext("errors", "Go back home") %>

View File

@ -7,7 +7,9 @@
<body>
<%= @inner_content %>
<hr style="border-width: 1px; border-color: rgb(212, 212, 216); width: 100%; max-width: 42rem;">
<hr
style="border-width: 1px; border-color: rgb(212, 212, 216); width: 100%; max-width: 42rem;"
/>
<a href={Routes.live_url(Endpoint, HomeLive)}>
<%= dgettext("emails", "This email was sent from %{name}", name: "Cannery") %>

View File

@ -10,7 +10,12 @@
<% end %>
<%= if @flash && @flash |> Map.has_key?("error") do %>
<p class="alert alert-danger" role="alert" phx-click="lv:clear-flash" phx-value-key="error">
<p
class="alert alert-danger"
role="alert"
phx-click="lv:clear-flash"
phx-value-key="error"
>
<%= live_flash(@flash, "error") %>
</p>
<% end %>

View File

@ -19,7 +19,7 @@
) %>
<% end %>
<hr class="hr">
<hr class="hr" />
<div class="flex flex-row justify-center items-center space-x-4">
<%= if Accounts.allow_registration?() do %>

View File

@ -34,7 +34,7 @@
<%= submit(dgettext("actions", "Register"), class: "mx-auto my-4 btn btn-primary col-span-3") %>
<% end %>
<hr class="hr">
<hr class="hr" />
<div class="flex flex-row justify-center items-center space-x-4">
<%= link(dgettext("actions", "Log in"),

View File

@ -23,14 +23,21 @@
<%= password_input(f, :password, required: true, class: "input input-primary col-span-2") %>
<%= error_tag(f, :password, "col-span-3") %>
<%= label(f, :password_confirmation, "Confirm new password", class: "title text-lg text-primary-500") %>
<%= password_input(f, :password_confirmation, required: true, class: "input input-primary col-span-2") %>
<%= label(f, :password_confirmation, "Confirm new password",
class: "title text-lg text-primary-500"
) %>
<%= password_input(f, :password_confirmation,
required: true,
class: "input input-primary col-span-2"
) %>
<%= error_tag(f, :password_confirmation, "col-span-3") %>
<%= submit(dgettext("actions", "Reset password"), class: "mx-auto my-4 btn btn-primary col-span-3") %>
<%= submit(dgettext("actions", "Reset password"),
class: "mx-auto my-4 btn btn-primary col-span-3"
) %>
<% end %>
<hr class="hr">
<hr class="hr" />
<div class="flex flex-row justify-center items-center space-x-4">
<%= if Accounts.allow_registration?() do %>

View File

@ -11,7 +11,6 @@
"justify-center items-center text-center space-y-4"
],
fn f -> %>
<%= label(f, :email, class: "title text-lg text-primary-500") %>
<%= email_input(f, :email, required: true, class: "input input-primary col-span-2") %>
@ -20,7 +19,7 @@
) %>
<% end %>
<hr class="hr">
<hr class="hr" />
<div class="flex flex-row justify-center items-center space-x-4">
<%= if Accounts.allow_registration?() do %>

View File

@ -34,7 +34,7 @@
<%= submit(dgettext("actions", "Log in"), class: "mx-auto my-4 btn btn-primary col-span-3") %>
<% end %>
<hr class="hr">
<hr class="hr" />
<div class="flex flex-row justify-center items-center space-x-4">
<%= if Accounts.allow_registration?() do %>

View File

@ -3,7 +3,7 @@
<%= gettext("Settings") %>
</h1>
<hr class="hr">
<hr class="hr" />
<%= form_for @email_changeset,
Routes.user_settings_path(@conn, :update),
@ -43,10 +43,12 @@
) %>
<%= error_tag(f, :current_password, "col-span-3") %>
<%= submit(dgettext("actions", "Change email"), class: "mx-auto my-4 btn btn-primary col-span-3") %>
<%= submit(dgettext("actions", "Change email"),
class: "mx-auto my-4 btn btn-primary col-span-3"
) %>
<% end %>
<hr class="hr">
<hr class="hr" />
<%= form_for @password_changeset,
Routes.user_settings_path(@conn, :update),
@ -97,10 +99,12 @@
) %>
<%= error_tag(f, :current_password, "col-span-3") %>
<%= submit(dgettext("actions", "Change password"), class: "mx-auto my-4 btn btn-primary col-span-3") %>
<%= submit(dgettext("actions", "Change password"),
class: "mx-auto my-4 btn btn-primary col-span-3"
) %>
<% end %>
<hr class="hr">
<hr class="hr" />
<%= link(dgettext("actions", "Delete User"),
to: Routes.user_settings_path(@conn, :delete, @current_user),

View File

@ -20,15 +20,11 @@ defmodule CanneryWeb.ViewHelpers do
}
~H"""
<time
datetime={@datetime}
x-data={"{
<time datetime={@datetime} x-data={"{
date:
Intl.DateTimeFormat([], {dateStyle: 'short', timeStyle: 'long'})
.format(new Date(\"#{@datetime}\"))
}"}
x-text="date"
>
}"} x-text="date">
<%= @datetime %>
</time>
"""
@ -45,14 +41,10 @@ defmodule CanneryWeb.ViewHelpers do
assigns = %{date: date |> Date.to_iso8601(:extended)}
~H"""
<time
datetime={@date}
x-data={"{
<time datetime={@date} x-data={"{
date:
Intl.DateTimeFormat([], {timeZone: 'Etc/UTC', dateStyle: 'short'}).format(new Date(\"#{@date}\"))
}"}
x-text="date"
>
}"} x-text="date">
<%= @date %>
</time>
"""