4 Commits

Author SHA1 Message Date
cad2fc9c3a run mix format
All checks were successful
continuous-integration/drone/push Build is passing
2022-02-18 19:00:49 -05:00
9e0e9ea2ae fix ammo group create not handling invalid attrs
Some checks failed
continuous-integration/drone/push Build is failing
2022-02-18 18:49:11 -05:00
2a0f5720ee fix confusing placeholder
Some checks reported errors
continuous-integration/drone/push Build was killed
2022-02-18 18:41:45 -05:00
aede4f45ba fix tests and mix format
All checks were successful
continuous-integration/drone/push Build is passing
2022-02-18 18:25:28 -05:00
7 changed files with 52 additions and 50 deletions

View File

@@ -256,6 +256,12 @@ defmodule Cannery.Ammo do
|> Repo.insert()
end
def create_ammo_group(invalid_attrs, _user) do
%AmmoGroup{}
|> AmmoGroup.create_changeset(invalid_attrs |> Map.put("user_id", "-1"))
|> Repo.insert()
end
@doc """
Updates a ammo_group.

View File

@@ -97,10 +97,7 @@
<%= label(f, :powder_type, gettext("Powder type"),
class: "mr-4 title text-lg text-primary-600"
) %>
<%= text_input(f, :powder_type,
class: "text-center col-span-2 input input-primary",
placeholder: gettext("Brass")
) %>
<%= text_input(f, :powder_type, class: "text-center col-span-2 input input-primary") %>
<%= error_tag(f, :powder_type, "col-span-3 text-center") %>
<%= label(f, :powder_grains_per_charge, gettext("Powder grains per charge"),

View File

@@ -31,14 +31,14 @@ msgid "Add your first type!"
msgstr ""
#, elixir-autogen, elixir-format
#: lib/cannery_web/templates/user_settings/edit.html.heex:17
#: lib/cannery_web/templates/user_settings/edit.html.heex:46
#: lib/cannery_web/templates/user_settings/edit.html.heex:16
#: lib/cannery_web/templates/user_settings/edit.html.heex:45
msgid "Change email"
msgstr ""
#, elixir-autogen, elixir-format
#: lib/cannery_web/templates/user_settings/edit.html.heex:61
#: lib/cannery_web/templates/user_settings/edit.html.heex:102
#: lib/cannery_web/templates/user_settings/edit.html.heex:60
#: lib/cannery_web/templates/user_settings/edit.html.heex:101
msgid "Change password"
msgstr ""
@@ -48,14 +48,14 @@ msgid "Create Invite"
msgstr ""
#, elixir-autogen, elixir-format
#: lib/cannery_web/templates/user_settings/edit.html.heex:109
#: lib/cannery_web/templates/user_settings/edit.html.heex:108
msgid "Delete User"
msgstr ""
#, elixir-autogen, elixir-format
#: lib/cannery_web/templates/user_registration/new.html.heex:44
#: lib/cannery_web/templates/user_registration/new.html.heex:43
#: lib/cannery_web/templates/user_reset_password/new.html.heex:3
#: lib/cannery_web/templates/user_session/new.html.heex:46
#: lib/cannery_web/templates/user_session/new.html.heex:45
msgid "Forgot your password?"
msgstr ""
@@ -66,12 +66,12 @@ msgstr ""
#, elixir-autogen, elixir-format
#: lib/cannery_web/components/topbar.ex:108
#: lib/cannery_web/templates/user_confirmation/new.html.heex:31
#: lib/cannery_web/templates/user_registration/new.html.heex:40
#: lib/cannery_web/templates/user_reset_password/edit.html.heex:49
#: lib/cannery_web/templates/user_reset_password/new.html.heex:31
#: lib/cannery_web/templates/user_confirmation/new.html.heex:30
#: lib/cannery_web/templates/user_registration/new.html.heex:39
#: lib/cannery_web/templates/user_reset_password/edit.html.heex:48
#: lib/cannery_web/templates/user_reset_password/new.html.heex:30
#: lib/cannery_web/templates/user_session/new.html.heex:3
#: lib/cannery_web/templates/user_session/new.html.heex:34
#: lib/cannery_web/templates/user_session/new.html.heex:33
msgid "Log in"
msgstr ""
@@ -102,31 +102,31 @@ msgstr ""
#, elixir-autogen, elixir-format
#: lib/cannery_web/components/topbar.ex:101
#: lib/cannery_web/templates/user_confirmation/new.html.heex:26
#: lib/cannery_web/templates/user_confirmation/new.html.heex:25
#: lib/cannery_web/templates/user_registration/new.html.heex:3
#: lib/cannery_web/templates/user_registration/new.html.heex:34
#: lib/cannery_web/templates/user_reset_password/edit.html.heex:44
#: lib/cannery_web/templates/user_reset_password/new.html.heex:26
#: lib/cannery_web/templates/user_session/new.html.heex:41
#: lib/cannery_web/templates/user_registration/new.html.heex:33
#: lib/cannery_web/templates/user_reset_password/edit.html.heex:43
#: lib/cannery_web/templates/user_reset_password/new.html.heex:25
#: lib/cannery_web/templates/user_session/new.html.heex:40
msgid "Register"
msgstr ""
#, elixir-autogen, elixir-format
#: lib/cannery_web/templates/user_confirmation/new.html.heex:3
#: lib/cannery_web/templates/user_confirmation/new.html.heex:17
#: lib/cannery_web/templates/user_confirmation/new.html.heex:16
msgid "Resend confirmation instructions"
msgstr ""
#, elixir-autogen, elixir-format
#: lib/cannery_web/templates/user_reset_password/edit.html.heex:3
#: lib/cannery_web/templates/user_reset_password/edit.html.heex:35
#: lib/cannery_web/templates/user_reset_password/edit.html.heex:34
msgid "Reset password"
msgstr ""
#, elixir-autogen, elixir-format
#: lib/cannery_web/components/add_shot_group_component.html.heex:42
#: lib/cannery_web/live/ammo_group_live/form_component.html.heex:54
#: lib/cannery_web/live/ammo_type_live/form_component.html.heex:175
#: lib/cannery_web/live/ammo_type_live/form_component.html.heex:172
#: lib/cannery_web/live/container_live/form_component.html.heex:50
#: lib/cannery_web/live/invite_live/form_component.html.heex:28
#: lib/cannery_web/live/range_live/form_component.html.heex:40
@@ -135,7 +135,7 @@ msgid "Save"
msgstr ""
#, elixir-autogen, elixir-format
#: lib/cannery_web/templates/user_reset_password/new.html.heex:17
#: lib/cannery_web/templates/user_reset_password/new.html.heex:16
msgid "Send instructions to reset password"
msgstr ""

View File

@@ -54,14 +54,13 @@ msgid "Background color"
msgstr ""
#, elixir-autogen, elixir-format
#: lib/cannery_web/live/ammo_type_live/form_component.html.heex:157
#: lib/cannery_web/live/ammo_type_live/form_component.html.heex:154
#: lib/cannery_web/live/ammo_type_live/index.ex:67
msgid "Blank"
msgstr ""
#, elixir-autogen, elixir-format
#: lib/cannery_web/live/ammo_type_live/form_component.html.heex:74
#: lib/cannery_web/live/ammo_type_live/form_component.html.heex:102
msgid "Brass"
msgstr ""
@@ -114,7 +113,7 @@ msgid "Containers"
msgstr ""
#, elixir-autogen, elixir-format
#: lib/cannery_web/live/ammo_type_live/form_component.html.heex:161
#: lib/cannery_web/live/ammo_type_live/form_component.html.heex:158
#: lib/cannery_web/live/ammo_type_live/index.ex:68
msgid "Corrosive"
msgstr ""
@@ -197,14 +196,14 @@ msgid "FMJ"
msgstr ""
#, elixir-autogen, elixir-format
#: lib/cannery_web/live/ammo_type_live/form_component.html.heex:116
#: lib/cannery_web/live/ammo_type_live/form_component.html.heex:113
#: lib/cannery_web/live/ammo_type_live/index.ex:61
#: lib/cannery_web/live/ammo_type_live/show.html.heex:49
msgid "Grains"
msgstr ""
#, elixir-autogen, elixir-format
#: lib/cannery_web/live/ammo_type_live/form_component.html.heex:153
#: lib/cannery_web/live/ammo_type_live/form_component.html.heex:150
#: lib/cannery_web/live/ammo_type_live/index.ex:66
msgid "Incendiary"
msgstr ""
@@ -231,7 +230,7 @@ msgid "Invites"
msgstr ""
#, elixir-autogen, elixir-format
#: lib/cannery_web/templates/user_session/new.html.heex:29
#: lib/cannery_web/templates/user_session/new.html.heex:28
msgid "Keep me logged in for 60 days"
msgstr ""
@@ -278,7 +277,7 @@ msgid "Manage"
msgstr ""
#, elixir-autogen, elixir-format
#: lib/cannery_web/live/ammo_type_live/form_component.html.heex:165
#: lib/cannery_web/live/ammo_type_live/form_component.html.heex:162
#: lib/cannery_web/live/ammo_type_live/index.ex:69
msgid "Manufacturer"
msgstr ""
@@ -378,7 +377,7 @@ msgid "On the bookshelf"
msgstr ""
#, elixir-autogen, elixir-format
#: lib/cannery_web/live/ammo_type_live/form_component.html.heex:124
#: lib/cannery_web/live/ammo_type_live/form_component.html.heex:121
#: lib/cannery_web/live/ammo_type_live/index.ex:62
#: lib/cannery_web/live/ammo_type_live/show.html.heex:50
msgid "Pressure"
@@ -397,7 +396,7 @@ msgid "Price paid:"
msgstr ""
#, elixir-autogen, elixir-format
#: lib/cannery_web/live/ammo_type_live/form_component.html.heex:131
#: lib/cannery_web/live/ammo_type_live/form_component.html.heex:128
#: lib/cannery_web/live/ammo_type_live/index.ex:63
#: lib/cannery_web/live/ammo_type_live/show.html.heex:51
msgid "Primer type"
@@ -491,7 +490,7 @@ msgid "This ammo group is not in a container"
msgstr ""
#, elixir-autogen, elixir-format
#: lib/cannery_web/live/ammo_type_live/form_component.html.heex:149
#: lib/cannery_web/live/ammo_type_live/form_component.html.heex:146
#: lib/cannery_web/live/ammo_type_live/index.ex:65
msgid "Tracer"
msgstr ""
@@ -688,7 +687,7 @@ msgid "Muzzle velocity"
msgstr ""
#, elixir-autogen, elixir-format
#: lib/cannery_web/live/ammo_type_live/form_component.html.heex:106
#: lib/cannery_web/live/ammo_type_live/form_component.html.heex:103
#: lib/cannery_web/live/ammo_type_live/index.ex:60
#: lib/cannery_web/live/ammo_type_live/show.html.heex:48
msgid "Powder grains per charge"
@@ -702,24 +701,24 @@ msgid "Powder type"
msgstr ""
#, elixir-autogen, elixir-format
#: lib/cannery_web/live/ammo_type_live/form_component.html.heex:171
#: lib/cannery_web/live/ammo_type_live/form_component.html.heex:168
#: lib/cannery_web/live/ammo_type_live/index.ex:70
msgid "UPC"
msgstr ""
#, elixir-autogen, elixir-format
#: lib/cannery_web/templates/user_settings/edit.html.heex:81
#: lib/cannery_web/templates/user_settings/edit.html.heex:80
msgid "Confirm new password"
msgstr ""
#, elixir-autogen, elixir-format
#: lib/cannery_web/templates/user_settings/edit.html.heex:34
#: lib/cannery_web/templates/user_settings/edit.html.heex:90
#: lib/cannery_web/templates/user_settings/edit.html.heex:33
#: lib/cannery_web/templates/user_settings/edit.html.heex:89
msgid "Current password"
msgstr ""
#, elixir-autogen, elixir-format
#: lib/cannery_web/templates/user_settings/edit.html.heex:74
#: lib/cannery_web/templates/user_settings/edit.html.heex:73
msgid "New password"
msgstr ""
@@ -734,7 +733,7 @@ msgid "Unstage"
msgstr ""
#, elixir-autogen, elixir-format
#: lib/cannery_web/live/ammo_type_live/form_component.html.heex:140
#: lib/cannery_web/live/ammo_type_live/form_component.html.heex:137
msgid "Firing type"
msgstr ""

View File

@@ -57,10 +57,10 @@ msgid "Not found"
msgstr ""
#, elixir-autogen, elixir-format
#: lib/cannery_web/templates/user_registration/new.html.heex:17
#: lib/cannery_web/templates/user_reset_password/edit.html.heex:17
#: lib/cannery_web/templates/user_settings/edit.html.heex:23
#: lib/cannery_web/templates/user_settings/edit.html.heex:67
#: lib/cannery_web/templates/user_registration/new.html.heex:16
#: lib/cannery_web/templates/user_reset_password/edit.html.heex:16
#: lib/cannery_web/templates/user_settings/edit.html.heex:22
#: lib/cannery_web/templates/user_settings/edit.html.heex:66
msgid "Oops, something went wrong! Please check the errors below."
msgstr ""

View File

@@ -104,7 +104,7 @@ msgid "Are you sure you want to delete this ammo?"
msgstr ""
#, elixir-autogen, elixir-format
#: lib/cannery_web/templates/user_settings/edit.html.heex:113
#: lib/cannery_web/templates/user_settings/edit.html.heex:112
msgid "Are you sure you want to delete your account?"
msgstr ""
@@ -161,7 +161,7 @@ msgstr ""
#, elixir-autogen, elixir-format
#: lib/cannery_web/components/add_shot_group_component.html.heex:44
#: lib/cannery_web/live/ammo_group_live/form_component.html.heex:55
#: lib/cannery_web/live/ammo_type_live/form_component.html.heex:176
#: lib/cannery_web/live/ammo_type_live/form_component.html.heex:173
#: lib/cannery_web/live/container_live/form_component.html.heex:52
#: lib/cannery_web/live/invite_live/form_component.html.heex:30
#: lib/cannery_web/live/range_live/form_component.html.heex:42

View File

@@ -56,8 +56,8 @@ defmodule Cannery.Fixtures do
|> Atom.to_string()
|> Email.generate_email(Accounts.get_user!(user_id), attrs)
[_, html_token, _] = email.html_body |> String.split("[TOKEN]")
[_, text_token, _] = email.text_body |> String.split("[TOKEN]")
[_, html_token | _] = email.html_body |> String.split("[TOKEN]")
[_, text_token | _] = email.text_body |> String.split("[TOKEN]")
^text_token = html_token
end