65 Commits
0.6.0 ... 0.8.1

Author SHA1 Message Date
75fcbb1e65 fix runtime config
All checks were successful
continuous-integration/drone/push Build is passing
2023-01-26 19:48:58 -05:00
e568a2f073 fix credo
All checks were successful
continuous-integration/drone/push Build is passing
2023-01-26 18:11:56 -05:00
0b27c8f80b add qr code for invite link
Some checks failed
continuous-integration/drone/push Build is failing
2023-01-26 00:46:25 -05:00
0ad1ee47de improve formatting 2023-01-26 00:40:48 -05:00
8ea2b06487 use list for classes 2023-01-26 00:39:53 -05:00
1e4accec9d fix padding at bottom of page in chrome 2023-01-25 22:14:04 -05:00
076d5eea18 add styles to background element 2023-01-25 22:07:33 -05:00
5b6bd00047 improve locale 2023-01-25 21:52:30 -05:00
8dd471afa8 use topbar through npm 2023-01-25 21:17:45 -05:00
09d3754f92 remove name
All checks were successful
continuous-integration/drone/push Build is passing
2023-01-23 00:05:15 -05:00
fa67fd5a3b add comment
All checks were successful
continuous-integration/drone/push Build is passing
2023-01-22 23:47:28 -05:00
0a56b32b17 make loading/reconnection less intrusive
All checks were successful
continuous-integration/drone/push Build is passing
2023-01-22 23:39:54 -05:00
5f214ab7f9 show topbar in more situations 2023-01-22 23:16:36 -05:00
0c95fa88f4 fix translations
All checks were successful
continuous-integration/drone/push Build is passing
2023-01-22 22:50:57 -05:00
61f8776d2e update deps 2023-01-22 22:50:47 -05:00
26f75c7d15 add brea
All checks were successful
continuous-integration/drone/push Build is passing
2022-12-06 20:59:19 -05:00
23f7af2a93 fix libcrypto 1.1 issue
All checks were successful
continuous-integration/drone/push Build is passing
2022-12-03 22:59:43 -05:00
8e771a2d9a add spanish
All checks were successful
continuous-integration/drone/push Build is passing
2022-12-03 22:50:21 -05:00
16155687c9 update translations
Some checks reported errors
continuous-integration/drone/push Build was killed
2022-12-03 22:14:35 -05:00
ef0d644ee3 improve more card styles 2022-12-03 22:09:32 -05:00
faacf80b51 improve container card style 2022-12-03 21:56:14 -05:00
7a7754767f improve tag card style 2022-12-03 21:54:41 -05:00
0894293620 improve code in table components 2022-12-03 21:41:54 -05:00
58b32817ba use shot group table component instead 2022-12-03 21:40:05 -05:00
45da547f62 add search to range index 2022-12-03 21:27:39 -05:00
3ea4b77b67 add search to tag index 2022-12-03 20:35:54 -05:00
d743336868 fixup! add search to container index 2022-12-03 20:26:22 -05:00
c99fbabcaa use container table component instead 2022-12-03 20:23:15 -05:00
95642061db add search to container index 2022-12-03 20:23:12 -05:00
11ef53d1bf add search to ammo groups index 2022-12-03 19:44:57 -05:00
757eca47f7 use ammo type table component instead 2022-12-03 19:35:08 -05:00
7191fe8e4b add search to catalog index 2022-12-03 19:35:00 -05:00
02253c74ac Translated using Weblate (Spanish)
All checks were successful
continuous-integration/drone/push Build is passing
Currently translated at 100.0% (34 of 34 strings)

Translation: cannery/errors
Translate-URL: https://weblate.bubbletea.dev/projects/cannery/errors/es/
2022-12-01 19:21:30 +00:00
fa32b2a073 Translated using Weblate (Spanish)
Currently translated at 97.4% (193 of 198 strings)

Translation: cannery/default
Translate-URL: https://weblate.bubbletea.dev/projects/cannery/default/es/
2022-12-01 19:21:30 +00:00
aa0ea10fa4 Translated using Weblate (Spanish)
All checks were successful
continuous-integration/drone/push Build is passing
Currently translated at 100.0% (42 of 42 strings)

Translation: cannery/actions
Translate-URL: https://weblate.bubbletea.dev/projects/cannery/actions/es/
2022-11-30 19:19:48 +00:00
72ac611e15 Translated using Weblate (Spanish)
Currently translated at 100.0% (47 of 47 strings)

Translation: cannery/prompts
Translate-URL: https://weblate.bubbletea.dev/projects/cannery/prompts/es/
2022-11-30 19:19:48 +00:00
ff0af84d5d Translated using Weblate (Spanish)
Currently translated at 100.0% (15 of 15 strings)

Translation: cannery/emails
Translate-URL: https://weblate.bubbletea.dev/projects/cannery/emails/es/
2022-11-30 19:19:48 +00:00
851d0954ad Translated using Weblate (Spanish)
Currently translated at 100.0% (15 of 15 strings)

Translation: cannery/emails
Translate-URL: https://weblate.bubbletea.dev/projects/cannery/emails/es/
2022-11-30 19:19:48 +00:00
ea4336adc5 Translated using Weblate (Spanish)
Currently translated at 100.0% (34 of 34 strings)

Translation: cannery/errors
Translate-URL: https://weblate.bubbletea.dev/projects/cannery/errors/es/
2022-11-30 19:19:48 +00:00
fcce6a6f40 Translated using Weblate (Spanish)
Currently translated at 100.0% (34 of 34 strings)

Translation: cannery/errors
Translate-URL: https://weblate.bubbletea.dev/projects/cannery/errors/es/
2022-11-30 19:19:48 +00:00
4d3085da2a Translated using Weblate (Spanish)
Currently translated at 49.4% (98 of 198 strings)

Translation: cannery/default
Translate-URL: https://weblate.bubbletea.dev/projects/cannery/default/es/
2022-11-30 19:19:48 +00:00
2ec60ba342 fix admin user fixture 2022-11-23 21:14:29 -05:00
e0ac714681 improve changesets and typespecs 2022-11-23 20:46:41 -05:00
20a2311229 bump to 0.7.1
All checks were successful
continuous-integration/drone/push Build is passing
2022-11-19 15:24:20 -05:00
a6ae8a872d update translations 2022-11-19 15:12:01 -05:00
81e448afc4 improve some wording 2022-11-19 15:11:34 -05:00
dfebad713f replace ammo added on with purchased on 2022-11-19 15:10:15 -05:00
bf0ea4168b fix bug with ammo group not updating after deleting shot group 2022-11-19 15:10:15 -05:00
5ffa627beb improve table route navigation 2022-11-19 15:10:15 -05:00
25d4f1916a display link to container in table 2022-11-19 15:10:15 -05:00
fd583f2941 add ids to some cards 2022-11-19 15:10:15 -05:00
5cae646758 improve indexes 2022-11-19 15:10:15 -05:00
d389515f76 be more specific on wording for show container 2022-11-19 15:10:15 -05:00
c2568b6521 move toggle button to live_helpers 2022-11-19 15:10:15 -05:00
60462877c5 pull version number from config 2022-11-19 15:10:15 -05:00
ba5a4e69b2 fix table alignment 2022-11-19 15:10:15 -05:00
ba36b4e4c5 Translated using Weblate (Spanish)
All checks were successful
continuous-integration/drone/push Build is passing
Currently translated at 90.4% (38 of 42 strings)

Translation: cannery/actions
Translate-URL: https://weblate.bubbletea.dev/projects/cannery/actions/es/
2022-11-13 21:49:26 +00:00
f5a092e91f Translated using Weblate (Spanish)
Currently translated at 94.1% (32 of 34 strings)

Translation: cannery/errors
Translate-URL: https://weblate.bubbletea.dev/projects/cannery/errors/es/
2022-11-13 21:49:26 +00:00
09774e0aed bump to 0.7.0
All checks were successful
continuous-integration/drone/push Build is passing
2022-11-12 14:38:40 -05:00
44d4d7c6f9 add CPR and original count to json export 2022-11-12 14:37:55 -05:00
1fed895b82 display cpr for ammo packs and add original count for ammo packs 2022-11-12 14:33:11 -05:00
3480aff61d make ammo type show page and container show page also display ammo groups as table 2022-11-12 13:53:23 -05:00
1ea4b99c81 fix whitespace when copying invite url 2022-11-11 21:36:57 -05:00
2191e7f4f4 fix chart to sum by day 2022-11-11 19:34:23 -05:00
8231683958 add shading to table component 2022-11-11 18:47:55 -05:00
111 changed files with 6097 additions and 3796 deletions

View File

@ -1,3 +1,39 @@
# v0.8.1
- Update dependencies
- Show topbar on form submit/page refresh
- Make loading/reconnection less intrusive
- Add QR code for invite link
# v0.8.0
- Add search to catalog, ammo, container, tag and range index pages
- Tweak urls for catalog, ammo, containers, tags and shot records
- Fix bug with shot group chart not drawing lines between days correctly
- Improve cards across app (make them line up with each other)
- Update translations and add spanish!!! (thank you Brea and Hannah!)
# v0.7.2
- Code improvements
# v0.7.1
- Fix table component alignment and styling
- Fix toggle button styling
- Miscellanous code improvements
- Improve container index table
- Fix bug with ammo not updating after deleting shot group
- Replace ammo "added on" with "purchased on"
- Miscellaneous wording improvements
- Update translations
# v0.7.0
- Add shading to table component
- Fix chart to sum by day
- Fix whitespace when copying invite url
- Make ammo type show page also display ammo groups as table
- Make container show page also display ammo groups as table
- Display CPR for ammo packs
- Add original count for ammo packs
- Add ammo pack CPR and original count to json export
# v0.6.0 # v0.6.0
- Update translations - Update translations
- Display used-up date on used-up ammo - Display used-up date on used-up ammo

View File

@ -17,8 +17,8 @@ If you're multilingual, this project can use your translations! Visit
functions as short as possible while keeping variable names descriptive! For functions as short as possible while keeping variable names descriptive! For
instance, use inline `do:` blocks for short functions and make your aliases as instance, use inline `do:` blocks for short functions and make your aliases as
short as possible without introducing ambiguity. short as possible without introducing ambiguity.
- I.e. since there's only one `Changeset` in the app, please alias - I.e. since there's only one `AmmoGroup` in the app, please alias
`Changeset.t(Type.t())` instead of using `Ecto.Changeset.t(Long.Type.t())` `AmmoGroup.t()` instead of using `Cannery.Ammo.AmmoGroup.t()`
- Use pipelines when possible. If only calling a single method, a pipeline isn't - Use pipelines when possible. If only calling a single method, a pipeline isn't
strictly necessary but still encouraged for future modification. strictly necessary but still encouraged for future modification.
- Please add typespecs to your functions! Even your private functions may be - Please add typespecs to your functions! Even your private functions may be
@ -144,3 +144,4 @@ Thank you so much for your contributions!
- kaia (https://shitposter.club/users/kaia) - kaia (https://shitposter.club/users/kaia)
- duponin (https://udongein.xyz/users/duponin) - duponin (https://udongein.xyz/users/duponin)
- kalli (https://twitter.com/t0kkuro) - kalli (https://twitter.com/t0kkuro)
- brea (https://refusal.biz/users/tarperfume)

View File

@ -37,7 +37,7 @@ RUN mix do compile, release
FROM alpine:latest AS app FROM alpine:latest AS app
RUN apk upgrade --no-cache && \ RUN apk upgrade --no-cache && \
apk add --no-cache bash openssl libgcc libstdc++ ncurses-libs apk add --no-cache bash openssl libssl1.1 libcrypto1.1 libgcc libstdc++ ncurses-libs
WORKDIR /app WORKDIR /app

View File

@ -25,12 +25,13 @@ $fa-font-path: "@fortawesome/fontawesome-free/webfonts";
100% { scale: 1.0; opacity: 1; } 100% { scale: 1.0; opacity: 1; }
} }
.phx-connected > #disconnect, #loading { // disconnect toast
.phx-connected > #disconnect {
opacity: 0 !important; opacity: 0 !important;
pointer-events: none; pointer-events: none;
} }
.phx-loading:not(.phx-error) > #loading, .phx-error > #disconnect { .phx-error > #disconnect {
opacity: 0.95 !important; opacity: 0.95 !important;
} }

View File

@ -24,7 +24,7 @@ import 'phoenix_html'
// Establish Phoenix Socket and LiveView configuration. // Establish Phoenix Socket and LiveView configuration.
import { Socket } from 'phoenix' import { Socket } from 'phoenix'
import { LiveSocket } from 'phoenix_live_view' import { LiveSocket } from 'phoenix_live_view'
import topbar from '../vendor/topbar' import topbar from 'topbar'
import MaintainAttrs from './maintain_attrs' import MaintainAttrs from './maintain_attrs'
import ShotLogChart from './shot_log_chart' import ShotLogChart from './shot_log_chart'
import Alpine from 'alpinejs' import Alpine from 'alpinejs'
@ -48,6 +48,8 @@ Alpine.start()
topbar.config({ barColors: { 0: '#29d' }, shadowColor: 'rgba(0, 0, 0, .3)' }) topbar.config({ barColors: { 0: '#29d' }, shadowColor: 'rgba(0, 0, 0, .3)' })
window.addEventListener('phx:page-loading-start', info => topbar.show()) window.addEventListener('phx:page-loading-start', info => topbar.show())
window.addEventListener('phx:page-loading-stop', info => topbar.hide()) window.addEventListener('phx:page-loading-stop', info => topbar.hide())
window.addEventListener('submit', info => topbar.show())
window.addEventListener('beforeunload', info => topbar.show())
// connect if there are any LiveViews on the page // connect if there are any LiveViews on the page
liveSocket.connect() liveSocket.connect()

View File

@ -11,22 +11,23 @@ export default {
data: { data: {
datasets: [{ datasets: [{
label: el.dataset.label, label: el.dataset.label,
data: data.map(({ date, count, labels }) => ({ data: data.map(({ date, count, label }) => ({
labels, label,
x: date, x: date,
y: count y: count
})), })),
backgroundColor: el.dataset.color, backgroundColor: `${el.dataset.color}77`,
borderColor: el.dataset.color, borderColor: el.dataset.color,
fill: true, fill: true,
borderWidth: 4 borderWidth: 3,
pointBorderWidth: 1
}] }]
}, },
options: { options: {
elements: { elements: {
point: { point: {
radius: 7, radius: 9,
hoverRadius: 10 hoverRadius: 12
} }
}, },
plugins: { plugins: {
@ -39,7 +40,8 @@ export default {
tooltip: { tooltip: {
displayColors: false, displayColors: false,
callbacks: { callbacks: {
label: ({ raw: { labels } }) => labels title: (contexts) => contexts.map(({ raw: { x } }) => Intl.DateTimeFormat([], { timeZone: 'Etc/UTC', dateStyle: 'short' }).format(new Date(x))),
label: ({ raw: { label } }) => label
} }
} }
}, },
@ -78,6 +80,27 @@ export default {
} }
}) })
}, },
updateChart (el) {
const data = JSON.parse(el.dataset.chartData)
this.el.chart.data = {
datasets: [{
label: el.dataset.label,
data: data.map(({ date, count, label }) => ({
label,
x: date,
y: count
})),
backgroundColor: `${el.dataset.color}77`,
borderColor: el.dataset.color,
fill: true,
borderWidth: 3,
pointBorderWidth: 1
}]
}
this.el.chart.update()
},
mounted () { this.initalizeChart(this.el) }, mounted () { this.initalizeChart(this.el) },
updated () { this.initalizeChart(this.el) } updated () { this.updateChart(this.el) }
} }

View File

@ -6215,9 +6215,9 @@
"dev": true "dev": true
}, },
"node_modules/json5": { "node_modules/json5": {
"version": "2.2.1", "version": "2.2.3",
"resolved": "https://registry.npmjs.org/json5/-/json5-2.2.1.tgz", "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz",
"integrity": "sha512-1hqLFMSrGHRHxav9q9gNjJ5EXznIxGVO09xQRrwplcS8qs28pZ8s8hupZAmqDwZUmVZ2Qb2jnyPOWcDH8m8dlA==", "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==",
"dev": true, "dev": true,
"bin": { "bin": {
"json5": "lib/cli.js" "json5": "lib/cli.js"
@ -6333,9 +6333,9 @@
} }
}, },
"node_modules/loader-utils": { "node_modules/loader-utils": {
"version": "2.0.3", "version": "2.0.4",
"resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-2.0.3.tgz", "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-2.0.4.tgz",
"integrity": "sha512-THWqIsn8QRnvLl0shHYVBN9syumU8pYWEHPTmkiVGd+7K5eFNVSY6AJhRvgGF70gg1Dz+l/k8WicvFCxdEs60A==", "integrity": "sha512-xXqpXoINfFhgua9xiqD8fPFHgkoq1mmmpE92WlDbm9rNRd/EbRb+Gqf908T2DMfuHjjJlksiK2RbHVOdD/MqSw==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"big.js": "^5.2.2", "big.js": "^5.2.2",
@ -9639,9 +9639,9 @@
} }
}, },
"node_modules/tsconfig-paths/node_modules/json5": { "node_modules/tsconfig-paths/node_modules/json5": {
"version": "1.0.1", "version": "1.0.2",
"resolved": "https://registry.npmjs.org/json5/-/json5-1.0.1.tgz", "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.2.tgz",
"integrity": "sha512-aKS4WQjPenRxiQsC93MNfjx+nbF4PAdYzmd/1JIj8HYzqfbu86beTuNgXDzPknWk0n0uARlyewZo4s++ES36Ow==", "integrity": "sha512-g1MWMLBiz8FKi1e4w0UyVL3w+iJceWAFBAaBnnGKOpNa5f8TLktkbre1+s6oICydWAm+HRUGTmI+//xv2hvXYA==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"minimist": "^1.2.0" "minimist": "^1.2.0"
@ -14763,9 +14763,9 @@
"dev": true "dev": true
}, },
"json5": { "json5": {
"version": "2.2.1", "version": "2.2.3",
"resolved": "https://registry.npmjs.org/json5/-/json5-2.2.1.tgz", "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz",
"integrity": "sha512-1hqLFMSrGHRHxav9q9gNjJ5EXznIxGVO09xQRrwplcS8qs28pZ8s8hupZAmqDwZUmVZ2Qb2jnyPOWcDH8m8dlA==", "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==",
"dev": true "dev": true
}, },
"jsx-ast-utils": { "jsx-ast-utils": {
@ -14850,9 +14850,9 @@
"dev": true "dev": true
}, },
"loader-utils": { "loader-utils": {
"version": "2.0.3", "version": "2.0.4",
"resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-2.0.3.tgz", "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-2.0.4.tgz",
"integrity": "sha512-THWqIsn8QRnvLl0shHYVBN9syumU8pYWEHPTmkiVGd+7K5eFNVSY6AJhRvgGF70gg1Dz+l/k8WicvFCxdEs60A==", "integrity": "sha512-xXqpXoINfFhgua9xiqD8fPFHgkoq1mmmpE92WlDbm9rNRd/EbRb+Gqf908T2DMfuHjjJlksiK2RbHVOdD/MqSw==",
"dev": true, "dev": true,
"requires": { "requires": {
"big.js": "^5.2.2", "big.js": "^5.2.2",
@ -17080,9 +17080,9 @@
}, },
"dependencies": { "dependencies": {
"json5": { "json5": {
"version": "1.0.1", "version": "1.0.2",
"resolved": "https://registry.npmjs.org/json5/-/json5-1.0.1.tgz", "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.2.tgz",
"integrity": "sha512-aKS4WQjPenRxiQsC93MNfjx+nbF4PAdYzmd/1JIj8HYzqfbu86beTuNgXDzPknWk0n0uARlyewZo4s++ES36Ow==", "integrity": "sha512-g1MWMLBiz8FKi1e4w0UyVL3w+iJceWAFBAaBnnGKOpNa5f8TLktkbre1+s6oICydWAm+HRUGTmI+//xv2hvXYA==",
"dev": true, "dev": true,
"requires": { "requires": {
"minimist": "^1.2.0" "minimist": "^1.2.0"

View File

@ -1,157 +0,0 @@
/**
* @license MIT
* topbar 1.0.0, 2021-01-06
* https://buunguyen.github.io/topbar
* Copyright (c) 2021 Buu Nguyen
*/
(function (window, document) {
"use strict";
// https://gist.github.com/paulirish/1579671
(function () {
var lastTime = 0;
var vendors = ["ms", "moz", "webkit", "o"];
for (var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) {
window.requestAnimationFrame =
window[vendors[x] + "RequestAnimationFrame"];
window.cancelAnimationFrame =
window[vendors[x] + "CancelAnimationFrame"] ||
window[vendors[x] + "CancelRequestAnimationFrame"];
}
if (!window.requestAnimationFrame)
window.requestAnimationFrame = function (callback, element) {
var currTime = new Date().getTime();
var timeToCall = Math.max(0, 16 - (currTime - lastTime));
var id = window.setTimeout(function () {
callback(currTime + timeToCall);
}, timeToCall);
lastTime = currTime + timeToCall;
return id;
};
if (!window.cancelAnimationFrame)
window.cancelAnimationFrame = function (id) {
clearTimeout(id);
};
})();
var canvas,
progressTimerId,
fadeTimerId,
currentProgress,
showing,
addEvent = function (elem, type, handler) {
if (elem.addEventListener) elem.addEventListener(type, handler, false);
else if (elem.attachEvent) elem.attachEvent("on" + type, handler);
else elem["on" + type] = handler;
},
options = {
autoRun: true,
barThickness: 3,
barColors: {
0: "rgba(26, 188, 156, .9)",
".25": "rgba(52, 152, 219, .9)",
".50": "rgba(241, 196, 15, .9)",
".75": "rgba(230, 126, 34, .9)",
"1.0": "rgba(211, 84, 0, .9)",
},
shadowBlur: 10,
shadowColor: "rgba(0, 0, 0, .6)",
className: null,
},
repaint = function () {
canvas.width = window.innerWidth;
canvas.height = options.barThickness * 5; // need space for shadow
var ctx = canvas.getContext("2d");
ctx.shadowBlur = options.shadowBlur;
ctx.shadowColor = options.shadowColor;
var lineGradient = ctx.createLinearGradient(0, 0, canvas.width, 0);
for (var stop in options.barColors)
lineGradient.addColorStop(stop, options.barColors[stop]);
ctx.lineWidth = options.barThickness;
ctx.beginPath();
ctx.moveTo(0, options.barThickness / 2);
ctx.lineTo(
Math.ceil(currentProgress * canvas.width),
options.barThickness / 2
);
ctx.strokeStyle = lineGradient;
ctx.stroke();
},
createCanvas = function () {
canvas = document.createElement("canvas");
var style = canvas.style;
style.position = "fixed";
style.top = style.left = style.right = style.margin = style.padding = 0;
style.zIndex = 100001;
style.display = "none";
if (options.className) canvas.classList.add(options.className);
document.body.appendChild(canvas);
addEvent(window, "resize", repaint);
},
topbar = {
config: function (opts) {
for (var key in opts)
if (options.hasOwnProperty(key)) options[key] = opts[key];
},
show: function () {
if (showing) return;
showing = true;
if (fadeTimerId !== null) window.cancelAnimationFrame(fadeTimerId);
if (!canvas) createCanvas();
canvas.style.opacity = 1;
canvas.style.display = "block";
topbar.progress(0);
if (options.autoRun) {
(function loop() {
progressTimerId = window.requestAnimationFrame(loop);
topbar.progress(
"+" + 0.05 * Math.pow(1 - Math.sqrt(currentProgress), 2)
);
})();
}
},
progress: function (to) {
if (typeof to === "undefined") return currentProgress;
if (typeof to === "string") {
to =
(to.indexOf("+") >= 0 || to.indexOf("-") >= 0
? currentProgress
: 0) + parseFloat(to);
}
currentProgress = to > 1 ? 1 : to;
repaint();
return currentProgress;
},
hide: function () {
if (!showing) return;
showing = false;
if (progressTimerId != null) {
window.cancelAnimationFrame(progressTimerId);
progressTimerId = null;
}
(function loop() {
if (topbar.progress("+.1") >= 1) {
canvas.style.opacity -= 0.05;
if (canvas.style.opacity <= 0.05) {
canvas.style.display = "none";
fadeTimerId = null;
return;
}
}
fadeTimerId = window.requestAnimationFrame(loop);
})();
},
};
if (typeof module === "object" && typeof module.exports === "object") {
module.exports = topbar;
} else if (typeof define === "function" && define.amd) {
define(function () {
return topbar;
});
} else {
this.topbar = topbar;
}
}.call(this, window, document));

View File

@ -15,17 +15,18 @@ end
config :cannery, CanneryWeb.ViewHelpers, shibao_mode: System.get_env("SHIBAO_MODE") == "true" config :cannery, CanneryWeb.ViewHelpers, shibao_mode: System.get_env("SHIBAO_MODE") == "true"
# Set default locale # Set default locale
config :gettext, :default_locale, System.get_env("LOCALE") || "en_US" config :gettext, :default_locale, System.get_env("LOCALE", "en_US")
maybe_ipv6 = if System.get_env("ECTO_IPV6") == "true", do: [:inet6], else: [] maybe_ipv6 = if System.get_env("ECTO_IPV6") == "true", do: [:inet6], else: []
database_url = database_url =
if config_env() == :test do if config_env() == :test do
System.get_env("TEST_DATABASE_URL") || System.get_env(
"TEST_DATABASE_URL",
"ecto://postgres:postgres@localhost/cannery_test#{System.get_env("MIX_TEST_PARTITION")}" "ecto://postgres:postgres@localhost/cannery_test#{System.get_env("MIX_TEST_PARTITION")}"
)
else else
System.get_env("DATABASE_URL") || System.get_env("DATABASE_URL", "ecto://postgres:postgres@cannery-db/cannery")
"ecto://postgres:postgres@cannery-db/cannery"
end end
host = host =
@ -40,7 +41,7 @@ interface =
config :cannery, Cannery.Repo, config :cannery, Cannery.Repo,
# ssl: true, # ssl: true,
url: database_url, url: database_url,
pool_size: String.to_integer(System.get_env("POOL_SIZE") || "10"), pool_size: String.to_integer(System.get_env("POOL_SIZE", "10")),
socket_options: maybe_ipv6 socket_options: maybe_ipv6
config :cannery, CanneryWeb.Endpoint, config :cannery, CanneryWeb.Endpoint,
@ -49,10 +50,10 @@ config :cannery, CanneryWeb.Endpoint,
# See the documentation on https://hexdocs.pm/plug_cowboy/Plug.Cowboy.html # See the documentation on https://hexdocs.pm/plug_cowboy/Plug.Cowboy.html
# for details about using IPv6 vs IPv4 and loopback vs public addresses. # for details about using IPv6 vs IPv4 and loopback vs public addresses.
ip: interface, ip: interface,
port: String.to_integer(System.get_env("PORT") || "4000") port: String.to_integer(System.get_env("PORT", "4000"))
], ],
server: true, server: true,
registration: System.get_env("REGISTRATION") || "invite" registration: System.get_env("REGISTRATION", "invite")
if config_env() == :prod do if config_env() == :prod do
# The secret key base is used to sign/encrypt cookies and other secrets. # The secret key base is used to sign/encrypt cookies and other secrets.
@ -76,12 +77,12 @@ if config_env() == :prod do
config :cannery, Cannery.Mailer, config :cannery, Cannery.Mailer,
adapter: Swoosh.Adapters.SMTP, adapter: Swoosh.Adapters.SMTP,
relay: System.get_env("SMTP_HOST") || raise("No SMTP_HOST set!"), relay: System.get_env("SMTP_HOST") || raise("No SMTP_HOST set!"),
port: System.get_env("SMTP_PORT") || 587, port: System.get_env("SMTP_PORT", "587"),
username: System.get_env("SMTP_USERNAME") || raise("No SMTP_USERNAME set!"), username: System.get_env("SMTP_USERNAME") || raise("No SMTP_USERNAME set!"),
password: System.get_env("SMTP_PASSWORD") || raise("No SMTP_PASSWORD set!"), password: System.get_env("SMTP_PASSWORD") || raise("No SMTP_PASSWORD set!"),
ssl: System.get_env("SMTP_SSL") == "true", ssl: System.get_env("SMTP_SSL") == "true",
email_from: System.get_env("EMAIL_FROM") || "no-reply@#{System.get_env("HOST")}", email_from: System.get_env("EMAIL_FROM", "no-reply@#{System.get_env("HOST")}"),
email_name: System.get_env("EMAIL_NAME") || "Cannery" email_name: System.get_env("EMAIL_NAME", "Cannery")
# ## Using releases # ## Using releases
# #

View File

@ -23,7 +23,7 @@ defmodule Cannery.Accounts do
nil nil
""" """
@spec get_user_by_email(String.t()) :: User.t() | nil @spec get_user_by_email(email :: String.t()) :: User.t() | nil
def get_user_by_email(email) when is_binary(email), do: Repo.get_by(User, email: email) def get_user_by_email(email) when is_binary(email), do: Repo.get_by(User, email: email)
@doc """ @doc """
@ -38,7 +38,7 @@ defmodule Cannery.Accounts do
nil nil
""" """
@spec get_user_by_email_and_password(String.t(), String.t()) :: @spec get_user_by_email_and_password(email :: String.t(), password :: String.t()) ::
User.t() | nil User.t() | nil
def get_user_by_email_and_password(email, password) def get_user_by_email_and_password(email, password)
when is_binary(email) and is_binary(password) do when is_binary(email) and is_binary(password) do
@ -86,7 +86,7 @@ defmodule Cannery.Accounts do
[%User{}] [%User{}]
""" """
@spec list_users_by_role(:admin | :user) :: [User.t()] @spec list_users_by_role(User.role()) :: [User.t()]
def list_users_by_role(role) do def list_users_by_role(role) do
role = role |> to_string() role = role |> to_string()
Repo.all(from u in User, where: u.role == ^role, order_by: u.email) Repo.all(from u in User, where: u.role == ^role, order_by: u.email)
@ -106,15 +106,21 @@ defmodule Cannery.Accounts do
{:error, %Changeset{}} {:error, %Changeset{}}
""" """
@spec register_user(map()) :: {:ok, User.t()} | {:error, Changeset.t(User.new_user())} @spec register_user(attrs :: map()) :: {:ok, User.t()} | {:error, User.changeset()}
def register_user(attrs) do def register_user(attrs) do
# if no registered users, make first user an admin Multi.new()
role = |> Multi.one(:users_count, from(u in User, select: count(u.id), distinct: true))
if Repo.one!(from u in User, select: count(u.id), distinct: true) == 0, |> Multi.insert(:add_user, fn %{users_count: count} ->
do: "admin", # if no registered users, make first user an admin
else: "user" role = if count == 0, do: "admin", else: "user"
%User{} |> User.registration_changeset(attrs |> Map.put("role", role)) |> Repo.insert() User.registration_changeset(attrs) |> User.role_changeset(role)
end)
|> Repo.transaction()
|> case do
{:ok, %{add_user: user}} -> {:ok, user}
{:error, :add_user, changeset, _changes_so_far} -> {:error, changeset}
end
end end
@doc """ @doc """
@ -126,12 +132,10 @@ defmodule Cannery.Accounts do
%Changeset{data: %User{}} %Changeset{data: %User{}}
""" """
@spec change_user_registration(User.t() | User.new_user()) :: @spec change_user_registration() :: User.changeset()
Changeset.t(User.t() | User.new_user()) @spec change_user_registration(attrs :: map()) :: User.changeset()
@spec change_user_registration(User.t() | User.new_user(), map()) :: def change_user_registration(attrs \\ %{}),
Changeset.t(User.t() | User.new_user()) do: User.registration_changeset(attrs, hash_password: false)
def change_user_registration(user, attrs \\ %{}),
do: User.registration_changeset(user, attrs, hash_password: false)
## Settings ## Settings
@ -144,7 +148,8 @@ defmodule Cannery.Accounts do
%Changeset{data: %User{}} %Changeset{data: %User{}}
""" """
@spec change_user_email(User.t(), map()) :: Changeset.t(User.t()) @spec change_user_email(User.t()) :: User.changeset()
@spec change_user_email(User.t(), attrs :: map()) :: User.changeset()
def change_user_email(user, attrs \\ %{}), do: User.email_changeset(user, attrs) def change_user_email(user, attrs \\ %{}), do: User.email_changeset(user, attrs)
@doc """ @doc """
@ -156,7 +161,7 @@ defmodule Cannery.Accounts do
%Changeset{data: %User{}} %Changeset{data: %User{}}
""" """
@spec change_user_role(User.t(), atom()) :: Changeset.t(User.t()) @spec change_user_role(User.t(), User.role()) :: User.changeset()
def change_user_role(user, role), do: User.role_changeset(user, role) def change_user_role(user, role), do: User.role_changeset(user, role)
@doc """ @doc """
@ -172,8 +177,8 @@ defmodule Cannery.Accounts do
{:error, %Changeset{}} {:error, %Changeset{}}
""" """
@spec apply_user_email(User.t(), String.t(), map()) :: @spec apply_user_email(User.t(), email :: String.t(), attrs :: map()) ::
{:ok, User.t()} | {:error, Changeset.t(User.t())} {:ok, User.t()} | {:error, User.changeset()}
def apply_user_email(user, password, attrs) do def apply_user_email(user, password, attrs) do
user user
|> User.email_changeset(attrs) |> User.email_changeset(attrs)
@ -187,7 +192,7 @@ defmodule Cannery.Accounts do
If the token matches, the user email is updated and the token is deleted. If the token matches, the user email is updated and the token is deleted.
The confirmed_at date is also updated to the current time. The confirmed_at date is also updated to the current time.
""" """
@spec update_user_email(User.t(), String.t()) :: :ok | :error @spec update_user_email(User.t(), token :: String.t()) :: :ok | :error
def update_user_email(user, token) do def update_user_email(user, token) do
context = "change:#{user.email}" context = "change:#{user.email}"
@ -200,7 +205,7 @@ defmodule Cannery.Accounts do
end end
end end
@spec user_email_multi(User.t(), String.t(), String.t()) :: Multi.t() @spec user_email_multi(User.t(), email :: String.t(), context :: String.t()) :: Multi.t()
defp user_email_multi(user, email, context) do defp user_email_multi(user, email, context) do
changeset = user |> User.email_changeset(%{email: email}) |> User.confirm_changeset() changeset = user |> User.email_changeset(%{email: email}) |> User.confirm_changeset()
@ -218,7 +223,8 @@ defmodule Cannery.Accounts do
{:ok, %{to: ..., body: ...}} {:ok, %{to: ..., body: ...}}
""" """
@spec deliver_update_email_instructions(User.t(), String.t(), function) :: Job.t() @spec deliver_update_email_instructions(User.t(), current_email :: String.t(), function) ::
Job.t()
def deliver_update_email_instructions(user, current_email, update_email_url_fun) def deliver_update_email_instructions(user, current_email, update_email_url_fun)
when is_function(update_email_url_fun, 1) do when is_function(update_email_url_fun, 1) do
{encoded_token, user_token} = UserToken.build_email_token(user, "change:#{current_email}") {encoded_token, user_token} = UserToken.build_email_token(user, "change:#{current_email}")
@ -235,7 +241,7 @@ defmodule Cannery.Accounts do
%Changeset{data: %User{}} %Changeset{data: %User{}}
""" """
@spec change_user_password(User.t(), map()) :: Changeset.t(User.t()) @spec change_user_password(User.t(), attrs :: map()) :: User.changeset()
def change_user_password(user, attrs \\ %{}), def change_user_password(user, attrs \\ %{}),
do: User.password_changeset(user, attrs, hash_password: false) do: User.password_changeset(user, attrs, hash_password: false)
@ -251,8 +257,8 @@ defmodule Cannery.Accounts do
{:error, %Changeset{}} {:error, %Changeset{}}
""" """
@spec update_user_password(User.t(), String.t(), map()) :: @spec update_user_password(User.t(), String.t(), attrs :: map()) ::
{:ok, User.t()} | {:error, Changeset.t(User.t())} {:ok, User.t()} | {:error, User.changeset()}
def update_user_password(user, password, attrs) do def update_user_password(user, password, attrs) do
changeset = changeset =
user user
@ -278,7 +284,7 @@ defmodule Cannery.Accounts do
%Changeset{data: %User{}} %Changeset{data: %User{}}
""" """
@spec change_user_locale(User.t()) :: Changeset.t(User.t()) @spec change_user_locale(User.t()) :: User.changeset()
def change_user_locale(%{locale: locale} = user), do: User.locale_changeset(user, locale) def change_user_locale(%{locale: locale} = user), do: User.locale_changeset(user, locale)
@doc """ @doc """
@ -294,7 +300,7 @@ defmodule Cannery.Accounts do
""" """
@spec update_user_locale(User.t(), locale :: String.t()) :: @spec update_user_locale(User.t(), locale :: String.t()) ::
{:ok, User.t()} | {:error, Changeset.t(User.t())} {:ok, User.t()} | {:error, User.changeset()}
def update_user_locale(user, locale), def update_user_locale(user, locale),
do: user |> User.locale_changeset(locale) |> Repo.update() do: user |> User.locale_changeset(locale) |> Repo.update()
@ -310,7 +316,7 @@ defmodule Cannery.Accounts do
%User{} %User{}
""" """
@spec delete_user!(User.t(), User.t()) :: User.t() @spec delete_user!(user_to_delete :: User.t(), User.t()) :: User.t()
def delete_user!(user, %User{role: :admin}), do: user |> Repo.delete!() def delete_user!(user, %User{role: :admin}), do: user |> Repo.delete!()
def delete_user!(%User{id: user_id} = user, %User{id: user_id}), do: user |> Repo.delete!() def delete_user!(%User{id: user_id} = user, %User{id: user_id}), do: user |> Repo.delete!()
@ -329,7 +335,7 @@ defmodule Cannery.Accounts do
@doc """ @doc """
Gets the user with the given signed token. Gets the user with the given signed token.
""" """
@spec get_user_by_session_token(String.t()) :: User.t() @spec get_user_by_session_token(token :: String.t()) :: User.t()
def get_user_by_session_token(token) do def get_user_by_session_token(token) do
{:ok, query} = UserToken.verify_session_token_query(token) {:ok, query} = UserToken.verify_session_token_query(token)
Repo.one(query) Repo.one(query)
@ -338,7 +344,7 @@ defmodule Cannery.Accounts do
@doc """ @doc """
Deletes the signed token with the given context. Deletes the signed token with the given context.
""" """
@spec delete_session_token(String.t()) :: :ok @spec delete_session_token(token :: String.t()) :: :ok
def delete_session_token(token) do def delete_session_token(token) do
Repo.delete_all(UserToken.token_and_context_query(token, "session")) Repo.delete_all(UserToken.token_and_context_query(token, "session"))
:ok :ok
@ -394,7 +400,7 @@ defmodule Cannery.Accounts do
If the token matches, the user account is marked as confirmed If the token matches, the user account is marked as confirmed
and the token is deleted. and the token is deleted.
""" """
@spec confirm_user(String.t()) :: {:ok, User.t()} | atom() @spec confirm_user(token :: String.t()) :: {:ok, User.t()} | :error
def confirm_user(token) do def confirm_user(token) do
with {:ok, query} <- UserToken.verify_email_token_query(token, "confirm"), with {:ok, query} <- UserToken.verify_email_token_query(token, "confirm"),
%User{} = user <- Repo.one(query), %User{} = user <- Repo.one(query),
@ -443,7 +449,7 @@ defmodule Cannery.Accounts do
nil nil
""" """
@spec get_user_by_reset_password_token(String.t()) :: User.t() | nil @spec get_user_by_reset_password_token(token :: String.t()) :: User.t() | nil
def get_user_by_reset_password_token(token) do def get_user_by_reset_password_token(token) do
with {:ok, query} <- UserToken.verify_email_token_query(token, "reset_password"), with {:ok, query} <- UserToken.verify_email_token_query(token, "reset_password"),
%User{} = user <- Repo.one(query) do %User{} = user <- Repo.one(query) do
@ -465,7 +471,8 @@ defmodule Cannery.Accounts do
{:error, %Changeset{}} {:error, %Changeset{}}
""" """
@spec reset_user_password(User.t(), map()) :: {:ok, User.t()} | {:error, Changeset.t(User.t())} @spec reset_user_password(User.t(), attrs :: map()) ::
{:ok, User.t()} | {:error, User.changeset()}
def reset_user_password(user, attrs) do def reset_user_password(user, attrs) do
Multi.new() Multi.new()
|> Multi.update(:user, User.password_changeset(user, attrs)) |> Multi.update(:user, User.password_changeset(user, attrs))

View File

@ -39,7 +39,7 @@ defmodule Cannery.Accounts.User do
password: String.t(), password: String.t(),
hashed_password: String.t(), hashed_password: String.t(),
confirmed_at: NaiveDateTime.t(), confirmed_at: NaiveDateTime.t(),
role: atom(), role: role(),
locale: String.t() | nil, locale: String.t() | nil,
invites: [Invite.t()], invites: [Invite.t()],
inserted_at: NaiveDateTime.t(), inserted_at: NaiveDateTime.t(),
@ -47,6 +47,8 @@ defmodule Cannery.Accounts.User do
} }
@type new_user :: %User{} @type new_user :: %User{}
@type id :: UUID.t() @type id :: UUID.t()
@type changeset :: Changeset.t(t() | new_user())
@type role :: :admin | :user | String.t()
@doc """ @doc """
A user changeset for registration. A user changeset for registration.
@ -65,26 +67,24 @@ defmodule Cannery.Accounts.User do
validations on a LiveView form), this option can be set to `false`. validations on a LiveView form), this option can be set to `false`.
Defaults to `true`. Defaults to `true`.
""" """
@spec registration_changeset(t() | new_user(), attrs :: map()) :: Changeset.t(t() | new_user()) @spec registration_changeset(attrs :: map()) :: changeset()
@spec registration_changeset(t() | new_user(), attrs :: map(), opts :: keyword()) :: @spec registration_changeset(attrs :: map(), opts :: keyword()) :: changeset()
Changeset.t(t() | new_user()) def registration_changeset(attrs, opts \\ []) do
def registration_changeset(user, attrs, opts \\ []) do %User{}
user |> cast(attrs, [:email, :password, :locale])
|> cast(attrs, [:email, :password, :role, :locale])
|> validate_email() |> validate_email()
|> validate_password(opts) |> validate_password(opts)
end end
@doc """ @doc """
A user changeset for role. A user changeset for role.
""" """
@spec role_changeset(t(), role :: atom()) :: Changeset.t(t()) @spec role_changeset(t() | new_user() | changeset(), role()) :: changeset()
def role_changeset(user, role) do def role_changeset(user, role) do
user |> cast(%{"role" => role}, [:role]) user |> cast(%{"role" => role}, [:role])
end end
@spec validate_email(Changeset.t(t() | new_user())) :: Changeset.t(t() | new_user()) @spec validate_email(changeset()) :: changeset()
defp validate_email(changeset) do defp validate_email(changeset) do
changeset changeset
|> validate_required([:email]) |> validate_required([:email])
@ -96,8 +96,8 @@ defmodule Cannery.Accounts.User do
|> unique_constraint(:email) |> unique_constraint(:email)
end end
@spec validate_password(Changeset.t(t() | new_user()), opts :: keyword()) :: @spec validate_password(changeset(), opts :: keyword()) ::
Changeset.t(t() | new_user()) changeset()
defp validate_password(changeset, opts) do defp validate_password(changeset, opts) do
changeset changeset
|> validate_required([:password]) |> validate_required([:password])
@ -108,8 +108,7 @@ defmodule Cannery.Accounts.User do
|> maybe_hash_password(opts) |> maybe_hash_password(opts)
end end
@spec maybe_hash_password(Changeset.t(t() | new_user()), opts :: keyword()) :: @spec maybe_hash_password(changeset(), opts :: keyword()) :: changeset()
Changeset.t(t() | new_user())
defp maybe_hash_password(changeset, opts) do defp maybe_hash_password(changeset, opts) do
hash_password? = Keyword.get(opts, :hash_password, true) hash_password? = Keyword.get(opts, :hash_password, true)
password = get_change(changeset, :password) password = get_change(changeset, :password)
@ -128,7 +127,7 @@ defmodule Cannery.Accounts.User do
It requires the email to change otherwise an error is added. It requires the email to change otherwise an error is added.
""" """
@spec email_changeset(t(), attrs :: map()) :: Changeset.t(t()) @spec email_changeset(t(), attrs :: map()) :: changeset()
def email_changeset(user, attrs) do def email_changeset(user, attrs) do
user user
|> cast(attrs, [:email]) |> cast(attrs, [:email])
@ -151,8 +150,8 @@ defmodule Cannery.Accounts.User do
validations on a LiveView form), this option can be set to `false`. validations on a LiveView form), this option can be set to `false`.
Defaults to `true`. Defaults to `true`.
""" """
@spec password_changeset(t(), attrs :: map()) :: Changeset.t(t()) @spec password_changeset(t(), attrs :: map()) :: changeset()
@spec password_changeset(t(), attrs :: map(), opts :: keyword()) :: Changeset.t(t()) @spec password_changeset(t(), attrs :: map(), opts :: keyword()) :: changeset()
def password_changeset(user, attrs, opts \\ []) do def password_changeset(user, attrs, opts \\ []) do
user user
|> cast(attrs, [:password]) |> cast(attrs, [:password])
@ -163,7 +162,7 @@ defmodule Cannery.Accounts.User do
@doc """ @doc """
Confirms the account by setting `confirmed_at`. Confirms the account by setting `confirmed_at`.
""" """
@spec confirm_changeset(t() | Changeset.t(t())) :: Changeset.t(t()) @spec confirm_changeset(t() | changeset()) :: changeset()
def confirm_changeset(user_or_changeset) do def confirm_changeset(user_or_changeset) do
now = NaiveDateTime.utc_now() |> NaiveDateTime.truncate(:second) now = NaiveDateTime.utc_now() |> NaiveDateTime.truncate(:second)
user_or_changeset |> change(confirmed_at: now) user_or_changeset |> change(confirmed_at: now)
@ -189,7 +188,7 @@ defmodule Cannery.Accounts.User do
@doc """ @doc """
Validates the current password otherwise adds an error to the changeset. Validates the current password otherwise adds an error to the changeset.
""" """
@spec validate_current_password(Changeset.t(t()), String.t()) :: Changeset.t(t()) @spec validate_current_password(changeset(), String.t()) :: changeset()
def validate_current_password(changeset, password) do def validate_current_password(changeset, password) do
if valid_password?(changeset.data, password), if valid_password?(changeset.data, password),
do: changeset, do: changeset,
@ -199,7 +198,7 @@ defmodule Cannery.Accounts.User do
@doc """ @doc """
A changeset for changing the user's locale A changeset for changing the user's locale
""" """
@spec locale_changeset(t() | Changeset.t(t()), locale :: String.t() | nil) :: Changeset.t(t()) @spec locale_changeset(t() | changeset(), locale :: String.t() | nil) :: changeset()
def locale_changeset(user_or_changeset, locale) do def locale_changeset(user_or_changeset, locale) do
user_or_changeset user_or_changeset
|> cast(%{"locale" => locale}, [:locale]) |> cast(%{"locale" => locale}, [:locale])

View File

@ -5,7 +5,7 @@ defmodule Cannery.ActivityLog do
import Ecto.Query, warn: false import Ecto.Query, warn: false
alias Cannery.{Accounts.User, ActivityLog.ShotGroup, Ammo.AmmoGroup, Repo} alias Cannery.{Accounts.User, ActivityLog.ShotGroup, Ammo.AmmoGroup, Repo}
alias Ecto.{Changeset, Multi} alias Ecto.Multi
@doc """ @doc """
Returns the list of shot_groups. Returns the list of shot_groups.
@ -15,10 +15,50 @@ defmodule Cannery.ActivityLog do
iex> list_shot_groups(%User{id: 123}) iex> list_shot_groups(%User{id: 123})
[%ShotGroup{}, ...] [%ShotGroup{}, ...]
iex> list_shot_groups("cool", %User{id: 123})
[%ShotGroup{notes: "My cool shot group"}, ...]
""" """
@spec list_shot_groups(User.t()) :: [ShotGroup.t()] @spec list_shot_groups(User.t()) :: [ShotGroup.t()]
def list_shot_groups(%User{id: user_id}) do @spec list_shot_groups(search :: nil | String.t(), User.t()) :: [ShotGroup.t()]
Repo.all(from(sg in ShotGroup, where: sg.user_id == ^user_id)) def list_shot_groups(search \\ nil, user)
def list_shot_groups(search, %{id: user_id}) when search |> is_nil() or search == "",
do: Repo.all(from sg in ShotGroup, where: sg.user_id == ^user_id)
def list_shot_groups(search, %{id: user_id}) when search |> is_binary() do
trimmed_search = String.trim(search)
Repo.all(
from sg in ShotGroup,
left_join: ag in assoc(sg, :ammo_group),
left_join: at in assoc(ag, :ammo_type),
where: sg.user_id == ^user_id,
where:
fragment(
"? @@ websearch_to_tsquery('english', ?)",
sg.search,
^trimmed_search
) or
fragment(
"? @@ websearch_to_tsquery('english', ?)",
ag.search,
^trimmed_search
) or
fragment(
"? @@ websearch_to_tsquery('english', ?)",
at.search,
^trimmed_search
),
order_by: {
:desc,
fragment(
"ts_rank_cd(?, websearch_to_tsquery('english', ?), 4)",
sg.search,
^trimmed_search
)
}
)
end end
@doc """ @doc """
@ -58,7 +98,7 @@ defmodule Cannery.ActivityLog do
""" """
@spec create_shot_group(attrs :: map(), User.t(), AmmoGroup.t()) :: @spec create_shot_group(attrs :: map(), User.t(), AmmoGroup.t()) ::
{:ok, ShotGroup.t()} | {:error, Changeset.t(ShotGroup.t()) | nil} {:ok, ShotGroup.t()} | {:error, ShotGroup.changeset() | nil}
def create_shot_group(attrs, user, ammo_group) do def create_shot_group(attrs, user, ammo_group) do
Multi.new() Multi.new()
|> Multi.insert( |> Multi.insert(
@ -99,7 +139,7 @@ defmodule Cannery.ActivityLog do
""" """
@spec update_shot_group(ShotGroup.t(), attrs :: map(), User.t()) :: @spec update_shot_group(ShotGroup.t(), attrs :: map(), User.t()) ::
{:ok, ShotGroup.t()} | {:error, Changeset.t(ShotGroup.t()) | nil} {:ok, ShotGroup.t()} | {:error, ShotGroup.changeset() | nil}
def update_shot_group( def update_shot_group(
%ShotGroup{count: count, user_id: user_id} = shot_group, %ShotGroup{count: count, user_id: user_id} = shot_group,
attrs, attrs,
@ -149,7 +189,7 @@ defmodule Cannery.ActivityLog do
""" """
@spec delete_shot_group(ShotGroup.t(), User.t()) :: @spec delete_shot_group(ShotGroup.t(), User.t()) ::
{:ok, ShotGroup.t()} | {:error, Changeset.t(ShotGroup.t())} {:ok, ShotGroup.t()} | {:error, ShotGroup.changeset()}
def delete_shot_group( def delete_shot_group(
%ShotGroup{user_id: user_id} = shot_group, %ShotGroup{user_id: user_id} = shot_group,
%User{id: user_id} %User{id: user_id}

View File

@ -44,6 +44,7 @@ defmodule Cannery.ActivityLog.ShotGroup do
} }
@type new_shot_group :: %ShotGroup{} @type new_shot_group :: %ShotGroup{}
@type id :: UUID.t() @type id :: UUID.t()
@type changeset :: Changeset.t(t() | new_shot_group())
@doc false @doc false
@spec create_changeset( @spec create_changeset(
@ -51,8 +52,7 @@ defmodule Cannery.ActivityLog.ShotGroup do
User.t() | any(), User.t() | any(),
AmmoGroup.t() | any(), AmmoGroup.t() | any(),
attrs :: map() attrs :: map()
) :: ) :: changeset()
Changeset.t(new_shot_group())
def create_changeset( def create_changeset(
shot_group, shot_group,
%User{id: user_id}, %User{id: user_id},
@ -74,7 +74,7 @@ defmodule Cannery.ActivityLog.ShotGroup do
|> cast(attrs, [:count, :notes, :date]) |> cast(attrs, [:count, :notes, :date])
|> validate_number(:count, greater_than: 0) |> validate_number(:count, greater_than: 0)
|> validate_required([:count, :ammo_group_id, :user_id]) |> validate_required([:count, :ammo_group_id, :user_id])
|> add_error(:invalid, dgettext("errors", "Please select a valid user and ammo group")) |> add_error(:invalid, dgettext("errors", "Please select a valid user and ammo pack"))
end end
defp validate_create_shot_group_count(changeset, %AmmoGroup{count: ammo_group_count}) do defp validate_create_shot_group_count(changeset, %AmmoGroup{count: ammo_group_count}) do
@ -87,8 +87,7 @@ defmodule Cannery.ActivityLog.ShotGroup do
end end
@doc false @doc false
@spec update_changeset(t() | new_shot_group(), User.t(), attrs :: map()) :: @spec update_changeset(t() | new_shot_group(), User.t(), attrs :: map()) :: changeset()
Changeset.t(t() | new_shot_group())
def update_changeset( def update_changeset(
%ShotGroup{user_id: user_id} = shot_group, %ShotGroup{user_id: user_id} = shot_group,
%User{id: user_id} = user, %User{id: user_id} = user,

View File

@ -20,11 +20,38 @@ defmodule Cannery.Ammo do
iex> list_ammo_types(%User{id: 123}) iex> list_ammo_types(%User{id: 123})
[%AmmoType{}, ...] [%AmmoType{}, ...]
iex> list_ammo_types("cool", %User{id: 123})
[%AmmoType{name: "My cool ammo type"}, ...]
""" """
@spec list_ammo_types(User.t()) :: [AmmoType.t()] @spec list_ammo_types(User.t()) :: [AmmoType.t()]
def list_ammo_types(%User{id: user_id}), @spec list_ammo_types(search :: nil | String.t(), User.t()) :: [AmmoType.t()]
def list_ammo_types(search \\ nil, user)
def list_ammo_types(search, %{id: user_id}) when search |> is_nil() or search == "",
do: Repo.all(from at in AmmoType, where: at.user_id == ^user_id, order_by: at.name) do: Repo.all(from at in AmmoType, where: at.user_id == ^user_id, order_by: at.name)
def list_ammo_types(search, %{id: user_id}) when search |> is_binary() do
trimmed_search = String.trim(search)
Repo.all(
from at in AmmoType,
where: at.user_id == ^user_id,
where:
fragment(
"search @@ websearch_to_tsquery('english', ?)",
^trimmed_search
),
order_by: {
:desc,
fragment(
"ts_rank_cd(search, websearch_to_tsquery('english', ?), 4)",
^trimmed_search
)
}
)
end
@doc """ @doc """
Returns a count of ammo_types. Returns a count of ammo_types.
@ -182,7 +209,7 @@ defmodule Cannery.Ammo do
""" """
@spec create_ammo_type(attrs :: map(), User.t()) :: @spec create_ammo_type(attrs :: map(), User.t()) ::
{:ok, AmmoType.t()} | {:error, Changeset.t(AmmoType.new_ammo_type())} {:ok, AmmoType.t()} | {:error, AmmoType.changeset()}
def create_ammo_type(attrs \\ %{}, %User{} = user), def create_ammo_type(attrs \\ %{}, %User{} = user),
do: %AmmoType{} |> AmmoType.create_changeset(user, attrs) |> Repo.insert() do: %AmmoType{} |> AmmoType.create_changeset(user, attrs) |> Repo.insert()
@ -199,7 +226,7 @@ defmodule Cannery.Ammo do
""" """
@spec update_ammo_type(AmmoType.t(), attrs :: map(), User.t()) :: @spec update_ammo_type(AmmoType.t(), attrs :: map(), User.t()) ::
{:ok, AmmoType.t()} | {:error, Changeset.t(AmmoType.t())} {:ok, AmmoType.t()} | {:error, AmmoType.changeset()}
def update_ammo_type(%AmmoType{user_id: user_id} = ammo_type, attrs, %User{id: user_id}), def update_ammo_type(%AmmoType{user_id: user_id} = ammo_type, attrs, %User{id: user_id}),
do: ammo_type |> AmmoType.update_changeset(attrs) |> Repo.update() do: ammo_type |> AmmoType.update_changeset(attrs) |> Repo.update()
@ -216,7 +243,7 @@ defmodule Cannery.Ammo do
""" """
@spec delete_ammo_type(AmmoType.t(), User.t()) :: @spec delete_ammo_type(AmmoType.t(), User.t()) ::
{:ok, AmmoType.t()} | {:error, Changeset.t(AmmoType.t())} {:ok, AmmoType.t()} | {:error, AmmoType.changeset()}
def delete_ammo_type(%AmmoType{user_id: user_id} = ammo_type, %User{id: user_id}), def delete_ammo_type(%AmmoType{user_id: user_id} = ammo_type, %User{id: user_id}),
do: ammo_type |> Repo.delete() do: ammo_type |> Repo.delete()
@ -394,36 +421,86 @@ defmodule Cannery.Ammo do
end end
@doc """ @doc """
Returns the list of ammo_groups for a user. Returns the list of ammo_groups.
## Examples ## Examples
iex> list_ammo_groups(%User{id: 123}) iex> list_ammo_groups(%User{id: 123})
[%AmmoGroup{}, ...] [%AmmoGroup{}, ...]
iex> list_ammo_groups("cool", true, %User{id: 123})
[%AmmoGroup{notes: "My cool ammo group"}, ...]
""" """
@spec list_ammo_groups(User.t()) :: [AmmoGroup.t()] @spec list_ammo_groups(User.t()) :: [AmmoGroup.t()]
@spec list_ammo_groups(User.t(), include_empty :: boolean()) :: [AmmoGroup.t()] @spec list_ammo_groups(search :: nil | String.t(), User.t()) :: [AmmoGroup.t()]
def list_ammo_groups(user, include_empty \\ false) @spec list_ammo_groups(search :: nil | String.t(), include_empty :: boolean(), User.t()) ::
[AmmoGroup.t()]
def list_ammo_groups(%User{id: user_id}, true = _include_empty) do def list_ammo_groups(search \\ nil, include_empty \\ false, %{id: user_id}) do
Repo.all( from(
from ag in AmmoGroup, ag in AmmoGroup,
left_join: sg in assoc(ag, :shot_groups), as: :ag,
where: ag.user_id == ^user_id, left_join: sg in assoc(ag, :shot_groups),
preload: [shot_groups: sg], as: :sg,
order_by: ag.id join: at in assoc(ag, :ammo_type),
as: :at,
join: c in assoc(ag, :container),
as: :c,
left_join: t in assoc(c, :tags),
as: :t,
where: ag.user_id == ^user_id,
preload: [shot_groups: sg, ammo_type: at, container: {c, tags: t}],
order_by: ag.id
) )
|> list_ammo_groups_include_empty(include_empty)
|> list_ammo_groups_search(search)
|> Repo.all()
end end
def list_ammo_groups(%User{id: user_id}, false = _include_empty) do defp list_ammo_groups_include_empty(query, true), do: query
Repo.all(
from ag in AmmoGroup, defp list_ammo_groups_include_empty(query, false) do
left_join: sg in assoc(ag, :shot_groups), query |> where([ag], not (ag.count == 0))
where: ag.user_id == ^user_id, end
where: not (ag.count == 0),
preload: [shot_groups: sg], defp list_ammo_groups_search(query, nil), do: query
order_by: ag.id defp list_ammo_groups_search(query, ""), do: query
defp list_ammo_groups_search(query, search) do
trimmed_search = String.trim(search)
query
|> where(
[ag: ag, at: at, c: c, t: t],
fragment(
"? @@ websearch_to_tsquery('english', ?)",
ag.search,
^trimmed_search
) or
fragment(
"? @@ websearch_to_tsquery('english', ?)",
at.search,
^trimmed_search
) or
fragment(
"? @@ websearch_to_tsquery('english', ?)",
c.search,
^trimmed_search
) or
fragment(
"? @@ websearch_to_tsquery('english', ?)",
t.search,
^trimmed_search
)
)
|> order_by(
[ag: ag],
desc:
fragment(
"ts_rank_cd(?, websearch_to_tsquery('english', ?), 4)",
ag.search,
^trimmed_search
)
) )
end end
@ -513,6 +590,28 @@ defmodule Cannery.Ammo do
round(count / (count + shot_group_sum) * 100) round(count / (count + shot_group_sum) * 100)
end end
@doc """
Gets the original count for an ammo group
"""
@spec get_original_count(AmmoGroup.t()) :: non_neg_integer()
def get_original_count(%AmmoGroup{count: count} = ammo_group) do
count + get_used_count(ammo_group)
end
@doc """
Calculates the CPR for a single ammo group
"""
@spec get_cpr(AmmoGroup.t()) :: nil | float()
def get_cpr(%AmmoGroup{price_paid: nil}), do: nil
def get_cpr(%AmmoGroup{price_paid: price_paid} = ammo_group),
do: calculate_cpr(price_paid, get_original_count(ammo_group))
@spec calculate_cpr(price_paid :: float() | nil, count :: integer()) :: float() | nil
defp calculate_cpr(nil, _count), do: nil
defp calculate_cpr(_price_paid, 0), do: nil
defp calculate_cpr(price_paid, total_count), do: price_paid / total_count
@doc """ @doc """
Creates multiple ammo_groups at once. Creates multiple ammo_groups at once.
@ -527,7 +626,7 @@ defmodule Cannery.Ammo do
""" """
@spec create_ammo_groups(attrs :: map(), multiplier :: non_neg_integer(), User.t()) :: @spec create_ammo_groups(attrs :: map(), multiplier :: non_neg_integer(), User.t()) ::
{:ok, {count :: non_neg_integer(), [AmmoGroup.t()] | nil}} {:ok, {count :: non_neg_integer(), [AmmoGroup.t()] | nil}}
| {:error, Changeset.t(AmmoGroup.new_ammo_group())} | {:error, AmmoGroup.changeset()}
def create_ammo_groups( def create_ammo_groups(
%{"ammo_type_id" => ammo_type_id, "container_id" => container_id} = attrs, %{"ammo_type_id" => ammo_type_id, "container_id" => container_id} = attrs,
multiplier, multiplier,
@ -606,7 +705,7 @@ defmodule Cannery.Ammo do
""" """
@spec update_ammo_group(AmmoGroup.t(), attrs :: map(), User.t()) :: @spec update_ammo_group(AmmoGroup.t(), attrs :: map(), User.t()) ::
{:ok, AmmoGroup.t()} | {:error, Changeset.t(AmmoGroup.t())} {:ok, AmmoGroup.t()} | {:error, AmmoGroup.changeset()}
def update_ammo_group( def update_ammo_group(
%AmmoGroup{user_id: user_id} = ammo_group, %AmmoGroup{user_id: user_id} = ammo_group,
attrs, attrs,
@ -627,7 +726,7 @@ defmodule Cannery.Ammo do
""" """
@spec delete_ammo_group(AmmoGroup.t(), User.t()) :: @spec delete_ammo_group(AmmoGroup.t(), User.t()) ::
{:ok, AmmoGroup.t()} | {:error, Changeset.t(AmmoGroup.t())} {:ok, AmmoGroup.t()} | {:error, AmmoGroup.changeset()}
def delete_ammo_group(%AmmoGroup{user_id: user_id} = ammo_group, %User{id: user_id}), def delete_ammo_group(%AmmoGroup{user_id: user_id} = ammo_group, %User{id: user_id}),
do: ammo_group |> Repo.delete() do: ammo_group |> Repo.delete()

View File

@ -30,6 +30,7 @@ defmodule Cannery.Ammo.AmmoGroup do
field :notes, :string field :notes, :string
field :price_paid, :float field :price_paid, :float
field :staged, :boolean, default: false field :staged, :boolean, default: false
field :purchased_on, :date
belongs_to :ammo_type, AmmoType belongs_to :ammo_type, AmmoType
belongs_to :container, Container belongs_to :container, Container
@ -46,6 +47,7 @@ defmodule Cannery.Ammo.AmmoGroup do
notes: String.t() | nil, notes: String.t() | nil,
price_paid: float() | nil, price_paid: float() | nil,
staged: boolean(), staged: boolean(),
purchased_on: Date.t(),
ammo_type: AmmoType.t() | nil, ammo_type: AmmoType.t() | nil,
ammo_type_id: AmmoType.id(), ammo_type_id: AmmoType.id(),
container: Container.t() | nil, container: Container.t() | nil,
@ -57,6 +59,7 @@ defmodule Cannery.Ammo.AmmoGroup do
} }
@type new_ammo_group :: %AmmoGroup{} @type new_ammo_group :: %AmmoGroup{}
@type id :: UUID.t() @type id :: UUID.t()
@type changeset :: Changeset.t(t() | new_ammo_group())
@doc false @doc false
@spec create_changeset( @spec create_changeset(
@ -65,7 +68,7 @@ defmodule Cannery.Ammo.AmmoGroup do
Container.t() | nil, Container.t() | nil,
User.t(), User.t(),
attrs :: map() attrs :: map()
) :: Changeset.t(new_ammo_group()) ) :: changeset()
def create_changeset( def create_changeset(
ammo_group, ammo_group,
%AmmoType{id: ammo_type_id}, %AmmoType{id: ammo_type_id},
@ -79,9 +82,9 @@ defmodule Cannery.Ammo.AmmoGroup do
|> change(ammo_type_id: ammo_type_id) |> change(ammo_type_id: ammo_type_id)
|> change(user_id: user_id) |> change(user_id: user_id)
|> change(container_id: container_id) |> change(container_id: container_id)
|> cast(attrs, [:count, :price_paid, :notes, :staged]) |> cast(attrs, [:count, :price_paid, :notes, :staged, :purchased_on])
|> validate_number(:count, greater_than: 0) |> validate_number(:count, greater_than: 0)
|> validate_required([:count, :staged, :ammo_type_id, :container_id, :user_id]) |> validate_required([:count, :staged, :purchased_on, :ammo_type_id, :container_id, :user_id])
end end
@doc """ @doc """
@ -95,14 +98,13 @@ defmodule Cannery.Ammo.AmmoGroup do
end end
@doc false @doc false
@spec update_changeset(t() | new_ammo_group(), attrs :: map(), User.t()) :: @spec update_changeset(t() | new_ammo_group(), attrs :: map(), User.t()) :: changeset()
Changeset.t(t() | new_ammo_group())
def update_changeset(ammo_group, attrs, user) do def update_changeset(ammo_group, attrs, user) do
ammo_group ammo_group
|> cast(attrs, [:count, :price_paid, :notes, :staged, :container_id]) |> cast(attrs, [:count, :price_paid, :notes, :staged, :purchased_on, :container_id])
|> validate_number(:count, greater_than_or_equal_to: 0) |> validate_number(:count, greater_than_or_equal_to: 0)
|> validate_container_id(user) |> validate_container_id(user)
|> validate_required([:count, :staged, :container_id]) |> validate_required([:count, :staged, :purchased_on, :container_id])
end end
defp validate_container_id(changeset, user) do defp validate_container_id(changeset, user) do
@ -119,8 +121,7 @@ defmodule Cannery.Ammo.AmmoGroup do
This range changeset is used when "using up" ammo groups, and allows for This range changeset is used when "using up" ammo groups, and allows for
updating the count to 0 updating the count to 0
""" """
@spec range_changeset(t() | new_ammo_group(), attrs :: map()) :: @spec range_changeset(t() | new_ammo_group(), attrs :: map()) :: changeset()
Changeset.t(t() | new_ammo_group())
def range_changeset(ammo_group, attrs) do def range_changeset(ammo_group, attrs) do
ammo_group ammo_group
|> cast(attrs, [:count, :staged]) |> cast(attrs, [:count, :staged])

View File

@ -102,6 +102,7 @@ defmodule Cannery.Ammo.AmmoType do
} }
@type new_ammo_type :: %AmmoType{} @type new_ammo_type :: %AmmoType{}
@type id :: UUID.t() @type id :: UUID.t()
@type changeset :: Changeset.t(t() | new_ammo_type())
@spec changeset_fields() :: [atom()] @spec changeset_fields() :: [atom()]
defp changeset_fields, defp changeset_fields,
@ -130,8 +131,7 @@ defmodule Cannery.Ammo.AmmoType do
] ]
@doc false @doc false
@spec create_changeset(new_ammo_type(), User.t(), attrs :: map()) :: @spec create_changeset(new_ammo_type(), User.t(), attrs :: map()) :: changeset()
Changeset.t(new_ammo_type())
def create_changeset(ammo_type, %User{id: user_id}, attrs) do def create_changeset(ammo_type, %User{id: user_id}, attrs) do
ammo_type ammo_type
|> change(user_id: user_id) |> change(user_id: user_id)
@ -140,8 +140,7 @@ defmodule Cannery.Ammo.AmmoType do
end end
@doc false @doc false
@spec update_changeset(t() | new_ammo_type(), attrs :: map()) :: @spec update_changeset(t() | new_ammo_type(), attrs :: map()) :: changeset()
Changeset.t(t() | new_ammo_type())
def update_changeset(ammo_type, attrs) do def update_changeset(ammo_type, attrs) do
ammo_type ammo_type
|> cast(attrs, changeset_fields()) |> cast(attrs, changeset_fields())

View File

@ -17,16 +17,55 @@ defmodule Cannery.Containers do
iex> list_containers(%User{id: 123}) iex> list_containers(%User{id: 123})
[%Container{}, ...] [%Container{}, ...]
iex> list_containers("cool", %User{id: 123})
[%Container{name: "my cool container"}, ...]
""" """
@spec list_containers(User.t()) :: [Container.t()] @spec list_containers(User.t()) :: [Container.t()]
def list_containers(%User{id: user_id}) do @spec list_containers(search :: nil | String.t(), User.t()) :: [Container.t()]
Repo.all( def list_containers(search \\ nil, %User{id: user_id}) do
from c in Container, from(c in Container,
left_join: t in assoc(c, :tags), as: :c,
left_join: ag in assoc(c, :ammo_groups), left_join: t in assoc(c, :tags),
where: c.user_id == ^user_id, as: :t,
order_by: c.name, left_join: ag in assoc(c, :ammo_groups),
preload: [tags: t, ammo_groups: ag] as: :ag,
where: c.user_id == ^user_id,
order_by: c.name,
preload: [tags: t, ammo_groups: ag]
)
|> list_containers_search(search)
|> Repo.all()
end
defp list_containers_search(query, nil), do: query
defp list_containers_search(query, ""), do: query
defp list_containers_search(query, search) do
trimmed_search = String.trim(search)
query
|> where(
[c: c, t: t],
fragment(
"? @@ websearch_to_tsquery('english', ?)",
c.search,
^trimmed_search
) or
fragment(
"? @@ websearch_to_tsquery('english', ?)",
t.search,
^trimmed_search
)
)
|> order_by(
[c: c],
desc:
fragment(
"ts_rank_cd(?, websearch_to_tsquery('english', ?), 4)",
c.search,
^trimmed_search
)
) )
end end
@ -89,7 +128,7 @@ defmodule Cannery.Containers do
""" """
@spec create_container(attrs :: map(), User.t()) :: @spec create_container(attrs :: map(), User.t()) ::
{:ok, Container.t()} | {:error, Changeset.t(Container.new_container())} {:ok, Container.t()} | {:error, Container.changeset()}
def create_container(attrs, %User{} = user) do def create_container(attrs, %User{} = user) do
%Container{} |> Container.create_changeset(user, attrs) |> Repo.insert() %Container{} |> Container.create_changeset(user, attrs) |> Repo.insert()
end end
@ -107,7 +146,7 @@ defmodule Cannery.Containers do
""" """
@spec update_container(Container.t(), User.t(), attrs :: map()) :: @spec update_container(Container.t(), User.t(), attrs :: map()) ::
{:ok, Container.t()} | {:error, Changeset.t(Container.t())} {:ok, Container.t()} | {:error, Container.changeset()}
def update_container(%Container{user_id: user_id} = container, %User{id: user_id}, attrs) do def update_container(%Container{user_id: user_id} = container, %User{id: user_id}, attrs) do
container |> Container.update_changeset(attrs) |> Repo.update() container |> Container.update_changeset(attrs) |> Repo.update()
end end
@ -125,7 +164,7 @@ defmodule Cannery.Containers do
""" """
@spec delete_container(Container.t(), User.t()) :: @spec delete_container(Container.t(), User.t()) ::
{:ok, Container.t()} | {:error, Changeset.t(Container.t())} {:ok, Container.t()} | {:error, Container.changeset()}
def delete_container(%Container{user_id: user_id} = container, %User{id: user_id}) do def delete_container(%Container{user_id: user_id} = container, %User{id: user_id}) do
Repo.one( Repo.one(
from ag in AmmoGroup, from ag in AmmoGroup,

View File

@ -49,10 +49,10 @@ defmodule Cannery.Containers.Container do
} }
@type new_container :: %Container{} @type new_container :: %Container{}
@type id :: UUID.t() @type id :: UUID.t()
@type changeset :: Changeset.t(t() | new_container())
@doc false @doc false
@spec create_changeset(new_container(), User.t(), attrs :: map()) :: @spec create_changeset(new_container(), User.t(), attrs :: map()) :: changeset()
Changeset.t(new_container())
def create_changeset(container, %User{id: user_id}, attrs) do def create_changeset(container, %User{id: user_id}, attrs) do
container container
|> change(user_id: user_id) |> change(user_id: user_id)
@ -61,8 +61,7 @@ defmodule Cannery.Containers.Container do
end end
@doc false @doc false
@spec update_changeset(t() | new_container(), attrs :: map()) :: @spec update_changeset(t() | new_container(), attrs :: map()) :: changeset()
Changeset.t(t() | new_container())
def update_changeset(container, attrs) do def update_changeset(container, attrs) do
container container
|> cast(attrs, [:name, :desc, :type, :location]) |> cast(attrs, [:name, :desc, :type, :location])

View File

@ -29,10 +29,10 @@ defmodule Cannery.Containers.ContainerTag do
} }
@type new_container_tag :: %ContainerTag{} @type new_container_tag :: %ContainerTag{}
@type id :: UUID.t() @type id :: UUID.t()
@type changeset :: Changeset.t(t() | new_container_tag())
@doc false @doc false
@spec create_changeset(new_container_tag(), Tag.t(), Container.t()) :: @spec create_changeset(new_container_tag(), Tag.t(), Container.t()) :: changeset()
Changeset.t(new_container_tag())
def create_changeset( def create_changeset(
container_tag, container_tag,
%Tag{id: tag_id, user_id: user_id}, %Tag{id: tag_id, user_id: user_id},

View File

@ -5,7 +5,6 @@ defmodule Cannery.Invites do
import Ecto.Query, warn: false import Ecto.Query, warn: false
alias Cannery.{Accounts.User, Invites.Invite, Repo} alias Cannery.{Accounts.User, Invites.Invite, Repo}
alias Ecto.Changeset
@invite_token_length 20 @invite_token_length 20
@ -99,14 +98,14 @@ defmodule Cannery.Invites do
""" """
@spec create_invite(User.t(), attrs :: map()) :: @spec create_invite(User.t(), attrs :: map()) ::
{:ok, Invite.t()} | {:error, Changeset.t(Invite.new_invite())} {:ok, Invite.t()} | {:error, Invite.changeset()}
def create_invite(%User{role: :admin} = user, attrs) do def create_invite(%User{role: :admin} = user, attrs) do
token = token =
:crypto.strong_rand_bytes(@invite_token_length) :crypto.strong_rand_bytes(@invite_token_length)
|> Base.url_encode64() |> Base.url_encode64()
|> binary_part(0, @invite_token_length) |> binary_part(0, @invite_token_length)
%Invite{} |> Invite.create_changeset(user, token, attrs) |> Repo.insert() Invite.create_changeset(user, token, attrs) |> Repo.insert()
end end
@doc """ @doc """
@ -122,7 +121,7 @@ defmodule Cannery.Invites do
""" """
@spec update_invite(Invite.t(), attrs :: map(), User.t()) :: @spec update_invite(Invite.t(), attrs :: map(), User.t()) ::
{:ok, Invite.t()} | {:error, Changeset.t(Invite.t())} {:ok, Invite.t()} | {:error, Invite.changeset()}
def update_invite(invite, attrs, %User{role: :admin}), def update_invite(invite, attrs, %User{role: :admin}),
do: invite |> Invite.update_changeset(attrs) |> Repo.update() do: invite |> Invite.update_changeset(attrs) |> Repo.update()
@ -139,7 +138,7 @@ defmodule Cannery.Invites do
""" """
@spec delete_invite(Invite.t(), User.t()) :: @spec delete_invite(Invite.t(), User.t()) ::
{:ok, Invite.t()} | {:error, Changeset.t(Invite.t())} {:ok, Invite.t()} | {:error, Invite.changeset()}
def delete_invite(invite, %User{role: :admin}), do: invite |> Repo.delete() def delete_invite(invite, %User{role: :admin}), do: invite |> Repo.delete()
@doc """ @doc """

View File

@ -36,12 +36,12 @@ defmodule Cannery.Invites.Invite do
} }
@type new_invite :: %Invite{} @type new_invite :: %Invite{}
@type id :: UUID.t() @type id :: UUID.t()
@type changeset :: Changeset.t(t() | new_invite())
@doc false @doc false
@spec create_changeset(new_invite(), User.t(), token :: binary(), attrs :: map()) :: @spec create_changeset(User.t(), token :: binary(), attrs :: map()) :: changeset()
Changeset.t(new_invite()) def create_changeset(%User{id: user_id}, token, attrs) do
def create_changeset(invite, %User{id: user_id}, token, attrs) do %Invite{}
invite
|> change(token: token, user_id: user_id) |> change(token: token, user_id: user_id)
|> cast(attrs, [:name, :uses_left, :disabled_at]) |> cast(attrs, [:name, :uses_left, :disabled_at])
|> validate_required([:name, :token, :user_id]) |> validate_required([:name, :token, :user_id])
@ -49,7 +49,7 @@ defmodule Cannery.Invites.Invite do
end end
@doc false @doc false
@spec update_changeset(t() | new_invite(), attrs :: map()) :: Changeset.t(t() | new_invite()) @spec update_changeset(t() | new_invite(), attrs :: map()) :: changeset()
def update_changeset(invite, attrs) do def update_changeset(invite, attrs) do
invite invite
|> cast(attrs, [:name, :uses_left, :disabled_at]) |> cast(attrs, [:name, :uses_left, :disabled_at])

View File

@ -6,7 +6,6 @@ defmodule Cannery.Tags do
import Ecto.Query, warn: false import Ecto.Query, warn: false
import CanneryWeb.Gettext import CanneryWeb.Gettext
alias Cannery.{Accounts.User, Repo, Tags.Tag} alias Cannery.{Accounts.User, Repo, Tags.Tag}
alias Ecto.Changeset
@doc """ @doc """
Returns the list of tags. Returns the list of tags.
@ -16,11 +15,38 @@ defmodule Cannery.Tags do
iex> list_tags(%User{id: 123}) iex> list_tags(%User{id: 123})
[%Tag{}, ...] [%Tag{}, ...]
iex> list_tags("cool", %User{id: 123})
[%Tag{name: "my cool tag"}, ...]
""" """
@spec list_tags(User.t()) :: [Tag.t()] @spec list_tags(User.t()) :: [Tag.t()]
def list_tags(%{id: user_id}), @spec list_tags(search :: nil | String.t(), User.t()) :: [Tag.t()]
def list_tags(search \\ nil, user)
def list_tags(search, %{id: user_id}) when search |> is_nil() or search == "",
do: Repo.all(from t in Tag, where: t.user_id == ^user_id, order_by: t.name) do: Repo.all(from t in Tag, where: t.user_id == ^user_id, order_by: t.name)
def list_tags(search, %{id: user_id}) when search |> is_binary() do
trimmed_search = String.trim(search)
Repo.all(
from t in Tag,
where: t.user_id == ^user_id,
where:
fragment(
"search @@ websearch_to_tsquery('english', ?)",
^trimmed_search
),
order_by: {
:desc,
fragment(
"ts_rank_cd(search, websearch_to_tsquery('english', ?), 4)",
^trimmed_search
)
}
)
end
@doc """ @doc """
Gets a single tag. Gets a single tag.
@ -73,7 +99,7 @@ defmodule Cannery.Tags do
""" """
@spec create_tag(attrs :: map(), User.t()) :: @spec create_tag(attrs :: map(), User.t()) ::
{:ok, Tag.t()} | {:error, Changeset.t(Tag.new_tag())} {:ok, Tag.t()} | {:error, Tag.changeset()}
def create_tag(attrs, %User{} = user), def create_tag(attrs, %User{} = user),
do: %Tag{} |> Tag.create_changeset(user, attrs) |> Repo.insert() do: %Tag{} |> Tag.create_changeset(user, attrs) |> Repo.insert()
@ -90,7 +116,7 @@ defmodule Cannery.Tags do
""" """
@spec update_tag(Tag.t(), attrs :: map(), User.t()) :: @spec update_tag(Tag.t(), attrs :: map(), User.t()) ::
{:ok, Tag.t()} | {:error, Changeset.t(Tag.t())} {:ok, Tag.t()} | {:error, Tag.changeset()}
def update_tag(%Tag{user_id: user_id} = tag, attrs, %User{id: user_id}), def update_tag(%Tag{user_id: user_id} = tag, attrs, %User{id: user_id}),
do: tag |> Tag.update_changeset(attrs) |> Repo.update() do: tag |> Tag.update_changeset(attrs) |> Repo.update()
@ -106,7 +132,7 @@ defmodule Cannery.Tags do
{:error, %Changeset{}} {:error, %Changeset{}}
""" """
@spec delete_tag(Tag.t(), User.t()) :: {:ok, Tag.t()} | {:error, Changeset.t(Tag.t())} @spec delete_tag(Tag.t(), User.t()) :: {:ok, Tag.t()} | {:error, Tag.changeset()}
def delete_tag(%Tag{user_id: user_id} = tag, %User{id: user_id}), do: tag |> Repo.delete() def delete_tag(%Tag{user_id: user_id} = tag, %User{id: user_id}), do: tag |> Repo.delete()
@doc """ @doc """

View File

@ -40,9 +40,10 @@ defmodule Cannery.Tags.Tag do
} }
@type new_tag() :: %Tag{} @type new_tag() :: %Tag{}
@type id() :: UUID.t() @type id() :: UUID.t()
@type changeset() :: Changeset.t(t() | new_tag())
@doc false @doc false
@spec create_changeset(new_tag(), User.t(), attrs :: map()) :: Changeset.t(new_tag()) @spec create_changeset(new_tag(), User.t(), attrs :: map()) :: changeset()
def create_changeset(tag, %User{id: user_id}, attrs) do def create_changeset(tag, %User{id: user_id}, attrs) do
tag tag
|> change(user_id: user_id) |> change(user_id: user_id)
@ -51,7 +52,7 @@ defmodule Cannery.Tags.Tag do
end end
@doc false @doc false
@spec update_changeset(t() | new_tag(), attrs :: map()) :: Changeset.t(t() | new_tag()) @spec update_changeset(t() | new_tag(), attrs :: map()) :: changeset()
def update_changeset(tag, attrs) do def update_changeset(tag, attrs) do
tag tag
|> cast(attrs, [:name, :bg_color, :text_color]) |> cast(attrs, [:name, :bg_color, :text_color])

View File

@ -104,6 +104,7 @@ defmodule CanneryWeb do
# credo:disable-for-next-line Credo.Check.Consistency.MultiAliasImportRequireUse # credo:disable-for-next-line Credo.Check.Consistency.MultiAliasImportRequireUse
import CanneryWeb.{ErrorHelpers, Gettext, LiveHelpers, ViewHelpers} import CanneryWeb.{ErrorHelpers, Gettext, LiveHelpers, ViewHelpers}
alias CanneryWeb.Endpoint
alias CanneryWeb.Router.Helpers, as: Routes alias CanneryWeb.Router.Helpers, as: Routes
end end
end end

View File

@ -42,7 +42,7 @@
) %> ) %>
<%= error_tag(f, :notes, "col-span-3") %> <%= error_tag(f, :notes, "col-span-3") %>
<%= label(f, :date, gettext("Date (UTC)"), class: "title text-lg text-primary-600") %> <%= label(f, :date, gettext("Date"), class: "title text-lg text-primary-600") %>
<%= date_input(f, :date, <%= date_input(f, :date,
class: "input input-primary col-span-2", class: "input input-primary col-span-2",
phx_update: "ignore", phx_update: "ignore",

View File

@ -17,6 +17,7 @@ defmodule CanneryWeb.Components.AmmoGroupCard do
preloads = if show_container, do: [:ammo_type, :container], else: [:ammo_type] preloads = if show_container, do: [:ammo_type, :container], else: [:ammo_type]
ammo_group = ammo_group |> Repo.preload(preloads) ammo_group = ammo_group |> Repo.preload(preloads)
assigns = assigns |> assign(:ammo_group, ammo_group) assigns = assigns |> assign(:ammo_group, ammo_group)
~H""" ~H"""
@ -35,9 +36,16 @@ defmodule CanneryWeb.Components.AmmoGroupCard do
<div class="flex flex-col justify-center items-center"> <div class="flex flex-col justify-center items-center">
<span class="rounded-lg title text-lg"> <span class="rounded-lg title text-lg">
<%= gettext("Count:") %> <%= gettext("Count:") %>
<%= if @ammo_group.count == 0, do: "Empty", else: @ammo_group.count %> <%= if @ammo_group.count == 0, do: gettext("Empty"), else: @ammo_group.count %>
</span> </span>
<%= if @ammo_group |> Ammo.get_original_count() != @ammo_group.count do %>
<span class="rounded-lg title text-lg">
<%= gettext("Original Count:") %>
<%= @ammo_group |> Ammo.get_original_count() %>
</span>
<% end %>
<%= if @ammo_group.notes do %> <%= if @ammo_group.notes do %>
<span class="rounded-lg title text-lg"> <span class="rounded-lg title text-lg">
<%= gettext("Notes:") %> <%= gettext("Notes:") %>
@ -46,14 +54,14 @@ defmodule CanneryWeb.Components.AmmoGroupCard do
<% end %> <% end %>
<span class="rounded-lg title text-lg"> <span class="rounded-lg title text-lg">
<%= gettext("Added on:") %> <%= gettext("Purchased on:") %>
<%= @ammo_group.inserted_at |> display_datetime() %> <.date date={@ammo_group.purchased_on} />
</span> </span>
<%= if @ammo_group.count == 0 do %> <%= if @ammo_group |> Ammo.get_last_used_shot_group() do %>
<span class="rounded-lg title text-lg"> <span class="rounded-lg title text-lg">
<%= gettext("Used up on:") %> <%= gettext("Last used on:") %>
<%= @ammo_group |> Ammo.get_last_used_shot_group() |> Map.get(:date) |> display_date() %> <.date date={@ammo_group |> Ammo.get_last_used_shot_group() |> Map.get(:date)} />
</span> </span>
<% end %> <% end %>
@ -64,6 +72,13 @@ defmodule CanneryWeb.Components.AmmoGroupCard do
amount: @ammo_group.price_paid |> :erlang.float_to_binary(decimals: 2) amount: @ammo_group.price_paid |> :erlang.float_to_binary(decimals: 2)
) %> ) %>
</span> </span>
<span class="rounded-lg title text-lg">
<%= gettext("CPR:") %>
<%= gettext("$%{amount}",
amount: @ammo_group |> Ammo.get_cpr() |> :erlang.float_to_binary(decimals: 2)
) %>
</span>
<% end %> <% end %>
<%= if @show_container and @ammo_group.container do %> <%= if @show_container and @ammo_group.container do %>

View File

@ -0,0 +1,234 @@
defmodule CanneryWeb.Components.AmmoGroupTableComponent do
@moduledoc """
A component that displays a list of ammo groups
"""
use CanneryWeb, :live_component
alias Cannery.{Accounts.User, Ammo, Ammo.AmmoGroup, Repo}
alias Ecto.UUID
alias Phoenix.LiveView.{Rendered, Socket}
@impl true
@spec update(
%{
required(:id) => UUID.t(),
required(:current_user) => User.t(),
required(:ammo_groups) => [AmmoGroup.t()],
optional(:ammo_type) => Rendered.t(),
optional(:range) => Rendered.t(),
optional(:container) => Rendered.t(),
optional(:actions) => Rendered.t(),
optional(any()) => any()
},
Socket.t()
) :: {:ok, Socket.t()}
def update(%{id: _id, ammo_groups: _ammo_group, current_user: _current_user} = assigns, socket) do
socket =
socket
|> assign(assigns)
|> assign_new(:ammo_type, fn -> [] end)
|> assign_new(:range, fn -> [] end)
|> assign_new(:container, fn -> [] end)
|> assign_new(:actions, fn -> [] end)
|> display_ammo_groups()
{:ok, socket}
end
defp display_ammo_groups(
%{
assigns: %{
ammo_groups: ammo_groups,
current_user: current_user,
ammo_type: ammo_type,
range: range,
container: container,
actions: actions
}
} = socket
) do
columns =
if actions == [] do
[]
else
[%{label: nil, key: :actions, sortable: false}]
end
columns = [
%{label: gettext("Purchased on"), key: :purchased_on},
%{label: gettext("Last used on"), key: :used_up_on} | columns
]
columns =
if container == [] do
columns
else
[%{label: gettext("Container"), key: :container} | columns]
end
columns =
if range == [] do
columns
else
[%{label: gettext("Range"), key: :range} | columns]
end
columns = [
%{label: gettext("Count"), key: :count},
%{label: gettext("Original Count"), key: :original_count},
%{label: gettext("Price paid"), key: :price_paid},
%{label: gettext("CPR"), key: :cpr},
%{label: gettext("% left"), key: :remaining},
%{label: gettext("Notes"), key: :notes}
| columns
]
columns =
if ammo_type == [] do
columns
else
[%{label: gettext("Ammo type"), key: :ammo_type} | columns]
end
extra_data = %{
current_user: current_user,
ammo_type: ammo_type,
columns: columns,
container: container,
actions: actions,
range: range
}
rows =
ammo_groups
|> Repo.preload([:ammo_type, :container])
|> Enum.map(fn ammo_group ->
ammo_group |> get_row_data_for_ammo_group(extra_data)
end)
socket |> assign(columns: columns, rows: rows)
end
@impl true
def render(assigns) do
~H"""
<div id={@id} class="w-full">
<.live_component
module={CanneryWeb.Components.TableComponent}
id={"table-#{@id}"}
columns={@columns}
rows={@rows}
/>
</div>
"""
end
@spec get_row_data_for_ammo_group(AmmoGroup.t(), additional_data :: map()) :: map()
defp get_row_data_for_ammo_group(ammo_group, %{columns: columns} = additional_data) do
ammo_group = ammo_group |> Repo.preload([:ammo_type, :container])
columns
|> Map.new(fn %{key: key} ->
{key, get_value_for_key(key, ammo_group, additional_data)}
end)
end
@spec get_value_for_key(atom(), AmmoGroup.t(), additional_data :: map()) ::
any() | {any(), Rendered.t()}
defp get_value_for_key(
:ammo_type,
%{ammo_type: %{name: ammo_type_name} = ammo_type},
%{ammo_type: ammo_type_block}
) do
assigns = %{ammo_type: ammo_type, ammo_type_block: ammo_type_block}
{ammo_type_name,
~H"""
<%= render_slot(@ammo_type_block, @ammo_type) %>
"""}
end
defp get_value_for_key(:price_paid, %{price_paid: nil}, _additional_data), do: {"", nil}
defp get_value_for_key(:price_paid, %{price_paid: price_paid}, _additional_data),
do: gettext("$%{amount}", amount: price_paid |> :erlang.float_to_binary(decimals: 2))
defp get_value_for_key(:purchased_on, %{purchased_on: purchased_on}, _additional_data) do
assigns = %{purchased_on: purchased_on}
{purchased_on,
~H"""
<.date date={@purchased_on} />
"""}
end
defp get_value_for_key(:used_up_on, ammo_group, _additional_data) do
last_shot_group_date =
case ammo_group |> Ammo.get_last_used_shot_group() do
%{date: last_shot_group_date} -> last_shot_group_date
_no_shot_groups -> nil
end
assigns = %{last_shot_group_date: last_shot_group_date}
{last_shot_group_date,
~H"""
<%= if @last_shot_group_date do %>
<.date date={@last_shot_group_date} />
<% else %>
<%= gettext("Never used") %>
<% end %>
"""}
end
defp get_value_for_key(:range, %{staged: staged} = ammo_group, %{range: range}) do
assigns = %{range: range, ammo_group: ammo_group}
{staged,
~H"""
<%= render_slot(@range, @ammo_group) %>
"""}
end
defp get_value_for_key(:remaining, ammo_group, _additional_data),
do: gettext("%{percentage}%", percentage: ammo_group |> Ammo.get_percentage_remaining())
defp get_value_for_key(:actions, ammo_group, %{actions: actions}) do
assigns = %{actions: actions, ammo_group: ammo_group}
~H"""
<%= render_slot(@actions, @ammo_group) %>
"""
end
defp get_value_for_key(:container, %{container: nil}, _additional_data), do: {nil, nil}
defp get_value_for_key(
:container,
%{container: %{name: container_name}} = ammo_group,
%{container: container}
) do
assigns = %{container: container, ammo_group: ammo_group}
{container_name,
~H"""
<%= render_slot(@container, @ammo_group) %>
"""}
end
defp get_value_for_key(:original_count, ammo_group, _additional_data),
do: ammo_group |> Ammo.get_original_count()
defp get_value_for_key(:cpr, %{price_paid: nil}, _additional_data),
do: gettext("No cost information")
defp get_value_for_key(:cpr, ammo_group, _additional_data) do
gettext("$%{amount}",
amount: ammo_group |> Ammo.get_cpr() |> :erlang.float_to_binary(decimals: 2)
)
end
defp get_value_for_key(:count, %{count: count}, _additional_data),
do: if(count == 0, do: gettext("Empty"), else: count)
defp get_value_for_key(key, ammo_group, _additional_data), do: ammo_group |> Map.get(key)
end

View File

@ -0,0 +1,209 @@
defmodule CanneryWeb.Components.AmmoTypeTableComponent do
@moduledoc """
A component that displays a list of ammo type
"""
use CanneryWeb, :live_component
alias Cannery.{Accounts.User, Ammo, Ammo.AmmoType}
alias Ecto.UUID
alias Phoenix.LiveView.{Rendered, Socket}
@impl true
@spec update(
%{
required(:id) => UUID.t(),
required(:current_user) => User.t(),
optional(:show_used) => boolean(),
optional(:ammo_types) => [AmmoType.t()],
optional(:actions) => Rendered.t(),
optional(any()) => any()
},
Socket.t()
) :: {:ok, Socket.t()}
def update(%{id: _id, ammo_types: _ammo_types, current_user: _current_user} = assigns, socket) do
socket =
socket
|> assign(assigns)
|> assign_new(:show_used, fn -> false end)
|> assign_new(:actions, fn -> [] end)
|> display_ammo_types()
{:ok, socket}
end
defp display_ammo_types(
%{
assigns: %{
ammo_types: ammo_types,
current_user: current_user,
show_used: show_used,
actions: actions
}
} = socket
) do
columns =
[
%{label: gettext("Name"), key: :name, type: :name},
%{label: gettext("Bullet type"), key: :bullet_type, type: :string},
%{label: gettext("Bullet core"), key: :bullet_core, type: :string},
%{label: gettext("Cartridge"), key: :cartridge, type: :string},
%{label: gettext("Caliber"), key: :caliber, type: :string},
%{label: gettext("Case material"), key: :case_material, type: :string},
%{label: gettext("Jacket type"), key: :jacket_type, type: :string},
%{label: gettext("Muzzle velocity"), key: :muzzle_velocity, type: :string},
%{label: gettext("Powder type"), key: :powder_type, type: :string},
%{
label: gettext("Powder grains per charge"),
key: :powder_grains_per_charge,
type: :string
},
%{label: gettext("Grains"), key: :grains, type: :string},
%{label: gettext("Pressure"), key: :pressure, type: :string},
%{label: gettext("Primer type"), key: :primer_type, type: :string},
%{label: gettext("Firing type"), key: :firing_type, type: :string},
%{label: gettext("Tracer"), key: :tracer, type: :boolean},
%{label: gettext("Incendiary"), key: :incendiary, type: :boolean},
%{label: gettext("Blank"), key: :blank, type: :boolean},
%{label: gettext("Corrosive"), key: :corrosive, type: :boolean},
%{label: gettext("Manufacturer"), key: :manufacturer, type: :string},
%{label: gettext("UPC"), key: "upc", type: :string}
]
|> Enum.filter(fn %{key: key, type: type} ->
# remove columns if all values match defaults
default_value = if type == :boolean, do: false, else: nil
ammo_types
|> Enum.any?(fn ammo_type ->
not (ammo_type |> Map.get(key) == default_value)
end)
end)
|> Kernel.++([
%{label: gettext("Rounds"), key: :round_count, type: :round_count}
])
|> Kernel.++(
if show_used do
[
%{
label: gettext("Used rounds"),
key: :used_round_count,
type: :used_round_count
},
%{
label: gettext("Total ever rounds"),
key: :historical_round_count,
type: :historical_round_count
}
]
else
[]
end
)
|> Kernel.++([%{label: gettext("Packs"), key: :ammo_count, type: :ammo_count}])
|> Kernel.++(
if show_used do
[
%{
label: gettext("Used packs"),
key: :used_ammo_count,
type: :used_ammo_count
},
%{
label: gettext("Total ever packs"),
key: :historical_ammo_count,
type: :historical_ammo_count
}
]
else
[]
end
)
|> Kernel.++([
%{label: gettext("Average CPR"), key: :avg_price_paid, type: :avg_price_paid},
%{label: nil, key: "actions", type: :actions, sortable: false}
])
extra_data = %{actions: actions, current_user: current_user}
rows =
ammo_types
|> Enum.map(fn ammo_type ->
ammo_type |> get_ammo_type_values(columns, extra_data)
end)
socket |> assign(columns: columns, rows: rows)
end
@impl true
def render(assigns) do
~H"""
<div id={@id} class="w-full">
<.live_component
module={CanneryWeb.Components.TableComponent}
id={"table-#{@id}"}
columns={@columns}
rows={@rows}
/>
</div>
"""
end
defp get_ammo_type_values(ammo_type, columns, extra_data) do
columns
|> Map.new(fn %{key: key, type: type} ->
{key, get_ammo_type_value(type, key, ammo_type, extra_data)}
end)
end
defp get_ammo_type_value(:boolean, key, ammo_type, _other_data),
do: ammo_type |> Map.get(key) |> humanize()
defp get_ammo_type_value(:round_count, _key, ammo_type, %{current_user: current_user}),
do: ammo_type |> Ammo.get_round_count_for_ammo_type(current_user)
defp get_ammo_type_value(:historical_round_count, _key, ammo_type, %{current_user: current_user}),
do: ammo_type |> Ammo.get_historical_count_for_ammo_type(current_user)
defp get_ammo_type_value(:used_round_count, _key, ammo_type, %{current_user: current_user}),
do: ammo_type |> Ammo.get_used_count_for_ammo_type(current_user)
defp get_ammo_type_value(:historical_ammo_count, _key, ammo_type, %{current_user: current_user}),
do: ammo_type |> Ammo.get_ammo_groups_count_for_type(current_user, true)
defp get_ammo_type_value(:used_ammo_count, _key, ammo_type, %{current_user: current_user}),
do: ammo_type |> Ammo.get_used_ammo_groups_count_for_type(current_user)
defp get_ammo_type_value(:ammo_count, _key, ammo_type, %{current_user: current_user}),
do: ammo_type |> Ammo.get_ammo_groups_count_for_type(current_user)
defp get_ammo_type_value(:avg_price_paid, _key, ammo_type, %{current_user: current_user}) do
case ammo_type |> Ammo.get_average_cost_for_ammo_type!(current_user) do
nil -> gettext("No cost information")
count -> gettext("$%{amount}", amount: count |> :erlang.float_to_binary(decimals: 2))
end
end
defp get_ammo_type_value(:name, _key, ammo_type, _other_data) 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}"}
>
<%= @ammo_type.name %>
</.link>
"""
end
defp get_ammo_type_value(:actions, _key, ammo_type, %{actions: actions}) do
assigns = %{actions: actions, ammo_type: ammo_type}
~H"""
<%= render_slot(@actions, @ammo_type) %>
"""
end
defp get_ammo_type_value(nil, _key, _ammo_type, _other_data), do: nil
defp get_ammo_type_value(_other, key, ammo_type, _other_data), do: ammo_type |> Map.get(key)
end

View File

@ -23,7 +23,7 @@ defmodule CanneryWeb.Components.ContainerCard do
~H""" ~H"""
<div <div
id={"container-#{@container.id}"} id={"container-#{@container.id}"}
class="overflow-hidden max-w-full mx-4 my-2 px-8 py-4 flex flex-col justify-center items-center space-y-4 class="overflow-hidden max-w-full mx-4 mb-4 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 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"
> >

View File

@ -0,0 +1,158 @@
defmodule CanneryWeb.Components.ContainerTableComponent do
@moduledoc """
A component that displays a list of containers
"""
use CanneryWeb, :live_component
alias Cannery.{Accounts.User, Containers, Containers.Container, Repo}
alias CanneryWeb.Components.TagCard
alias Ecto.UUID
alias Phoenix.LiveView.{Rendered, Socket}
@impl true
@spec update(
%{
required(:id) => UUID.t(),
required(:current_user) => User.t(),
optional(:containers) => [Container.t()],
optional(:tag_actions) => Rendered.t(),
optional(:actions) => Rendered.t(),
optional(any()) => any()
},
Socket.t()
) :: {:ok, Socket.t()}
def update(%{id: _id, containers: _containers, current_user: _current_user} = assigns, socket) do
socket =
socket
|> assign(assigns)
|> assign_new(:tag_actions, fn -> [] end)
|> assign_new(:actions, fn -> [] end)
|> display_containers()
{:ok, socket}
end
defp display_containers(
%{
assigns: %{
containers: containers,
current_user: current_user,
tag_actions: tag_actions,
actions: actions
}
} = socket
) do
columns =
[
%{label: gettext("Name"), key: :name, type: :string},
%{label: gettext("Description"), key: :desc, type: :string},
%{label: gettext("Location"), key: :location, type: :string},
%{label: gettext("Type"), key: :type, type: :string},
%{label: gettext("Packs"), key: :packs, type: :integer},
%{label: gettext("Rounds"), key: :rounds, type: :string},
%{label: gettext("Tags"), key: :tags, type: :tags},
%{label: nil, key: :actions, sortable: false, type: :actions}
]
|> Enum.filter(fn %{key: key, type: type} ->
# remove columns if all values match defaults
default_value =
case type do
:boolean -> false
_other_type -> nil
end
containers
|> Enum.any?(fn container ->
type in [:tags, :actions] or not (container |> Map.get(key) == default_value)
end)
end)
extra_data = %{
current_user: current_user,
tag_actions: tag_actions,
actions: actions
}
rows =
containers
|> Enum.map(fn container ->
container |> get_row_data_for_container(columns, extra_data)
end)
socket
|> assign(
columns: columns,
rows: rows
)
end
@impl true
def render(assigns) do
~H"""
<div id={@id} class="w-full">
<.live_component
module={CanneryWeb.Components.TableComponent}
id={"table-#{@id}"}
columns={@columns}
rows={@rows}
/>
</div>
"""
end
@spec get_row_data_for_container(Container.t(), columns :: [map()], extra_data :: map) :: map()
defp get_row_data_for_container(container, columns, extra_data) do
container = container |> Repo.preload([:ammo_groups, :tags])
columns
|> Map.new(fn %{key: key} -> {key, get_value_for_key(key, container, extra_data)} end)
end
@spec get_value_for_key(atom(), Container.t(), extra_data :: map) :: any()
defp get_value_for_key(:name, %{id: id, name: container_name}, _extra_data) do
assigns = %{id: id, container_name: container_name}
{container_name,
~H"""
<div class="flex flex-wrap justify-center items-center">
<.link navigate={Routes.container_show_path(Endpoint, :show, @id)} class="link">
<%= @container_name %>
</.link>
</div>
"""}
end
defp get_value_for_key(:packs, container, _extra_data) do
container |> Containers.get_container_ammo_group_count!()
end
defp get_value_for_key(:rounds, container, _extra_data) do
container |> Containers.get_container_rounds!()
end
defp get_value_for_key(:tags, container, %{tag_actions: tag_actions}) do
assigns = %{tag_actions: tag_actions, container: container}
{container.tags |> Enum.map(fn %{name: name} -> name end),
~H"""
<div class="flex flex-wrap justify-center items-center">
<%= unless @container.tags |> Enum.empty?() do %>
<%= for tag <- @container.tags do %>
<TagCard.simple_tag_card tag={tag} />
<% end %>
<% end %>
<%= render_slot(@tag_actions, @container) %>
</div>
"""}
end
defp get_value_for_key(:actions, container, %{actions: actions}) do
assigns = %{actions: actions, container: container}
~H"""
<%= render_slot(@actions, @container) %>
"""
end
defp get_value_for_key(key, container, _extra_data), do: container |> Map.get(key)
end

View File

@ -15,17 +15,26 @@ defmodule CanneryWeb.Components.InviteCard do
assigns = assigns |> assign_new(:code_actions, fn -> [] end) assigns = assigns |> assign_new(:code_actions, fn -> [] end)
~H""" ~H"""
<div class="mx-4 my-2 px-8 py-4 flex flex-col justify-center items-center space-y-4 <div
id={"invite-#{@invite.id}"}
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 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"> <h1 class="title text-xl">
<%= @invite.name %> <%= @invite.name %>
</h1> </h1>
<%= if @invite.disabled_at |> is_nil() do %> <%= if @invite.disabled_at |> is_nil() do %>
<h2 class="title text-md"> <h2 class="title text-md">
<%= gettext("Uses Left:") %> <%= if @invite.uses_left do %>
<%= @invite.uses_left || "Unlimited" %> <%= gettext(
"Uses Left: %{uses_left}",
uses_left: @invite.uses_left
) %>
<% else %>
<%= gettext("Uses Left: Unlimited") %>
<% end %>
</h2> </h2>
<% else %> <% else %>
<h2 class="title text-md"> <h2 class="title text-md">
@ -33,14 +42,17 @@ defmodule CanneryWeb.Components.InviteCard do
</h2> </h2>
<% end %> <% end %>
<.qr_code
content={Routes.user_registration_url(Endpoint, :new, invite: @invite.token)}
filename={@invite.name}
/>
<div class="flex flex-row flex-wrap justify-center items-center"> <div class="flex flex-row flex-wrap justify-center items-center">
<code <code
id={"code-#{@invite.id}"} 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" class="mx-2 my-1 text-xs px-4 py-2 rounded-lg text-center break-all text-gray-100 bg-primary-800"
> phx-no-format
<%= Routes.user_registration_url(Endpoint, :new, invite: @invite.token) %> ><%= Routes.user_registration_url(Endpoint, :new, invite: @invite.token) %></code>
</code>
<%= render_slot(@code_actions) %> <%= render_slot(@code_actions) %>
</div> </div>

View File

@ -106,7 +106,7 @@ defmodule CanneryWeb.Components.MoveAmmoGroupComponent do
containers containers
|> Enum.map(fn container -> |> Enum.map(fn container ->
columns columns
|> Enum.into(%{}, fn %{key: key} -> {key, get_row_value_by_key(key, container, assigns)} end) |> Map.new(fn %{key: key} -> {key, get_row_value_by_key(key, container, assigns)} end)
end) end)
end end

View File

@ -0,0 +1,121 @@
defmodule CanneryWeb.Components.ShotGroupTableComponent do
@moduledoc """
A component that displays a list of shot groups
"""
use CanneryWeb, :live_component
alias Cannery.{Accounts.User, ActivityLog.ShotGroup, Repo}
alias Ecto.UUID
alias Phoenix.LiveView.{Rendered, Socket}
@impl true
@spec update(
%{
required(:id) => UUID.t(),
required(:current_user) => User.t(),
optional(:shot_groups) => [ShotGroup.t()],
optional(:actions) => Rendered.t(),
optional(any()) => any()
},
Socket.t()
) :: {:ok, Socket.t()}
def update(%{id: _id, shot_groups: _shot_groups, current_user: _current_user} = assigns, socket) do
socket =
socket
|> assign(assigns)
|> assign_new(:actions, fn -> [] end)
|> display_shot_groups()
{:ok, socket}
end
defp display_shot_groups(
%{
assigns: %{
shot_groups: shot_groups,
current_user: current_user,
actions: actions
}
} = socket
) do
columns = [
%{label: gettext("Ammo"), key: :name},
%{label: gettext("Rounds shot"), key: :count},
%{label: gettext("Notes"), key: :notes},
%{label: gettext("Date"), key: :date},
%{label: nil, key: :actions, sortable: false}
]
extra_data = %{current_user: current_user, actions: actions}
rows =
shot_groups
|> Enum.map(fn shot_group ->
shot_group |> get_row_data_for_shot_group(columns, extra_data)
end)
socket
|> assign(
columns: columns,
rows: rows
)
end
@impl true
def render(assigns) do
~H"""
<div id={@id} class="w-full">
<.live_component
module={CanneryWeb.Components.TableComponent}
id={"table-#{@id}"}
columns={@columns}
rows={@rows}
initial_key={:date}
initial_sort_mode={:desc}
/>
</div>
"""
end
@spec get_row_data_for_shot_group(ShotGroup.t(), columns :: [map()], extra_data :: map()) ::
map()
defp get_row_data_for_shot_group(shot_group, columns, extra_data) do
shot_group = shot_group |> Repo.preload(ammo_group: :ammo_type)
columns
|> Map.new(fn %{key: key} ->
{key, get_row_value(key, shot_group, extra_data)}
end)
end
defp get_row_value(
:name,
%{ammo_group: %{ammo_type: %{name: ammo_type_name} = ammo_group}},
_extra_data
) do
assigns = %{ammo_group: ammo_group, ammo_type_name: ammo_type_name}
name_block = ~H"""
<.link navigate={Routes.ammo_group_show_path(Endpoint, :show, @ammo_group)} class="link">
<%= @ammo_type_name %>
</.link>
"""
{ammo_type_name, name_block}
end
defp get_row_value(:date, %{date: _date} = assigns, _extra_data) do
~H"""
<.date date={@date} />
"""
end
defp get_row_value(:actions, shot_group, %{actions: actions}) do
assigns = %{actions: actions, shot_group: shot_group}
~H"""
<%= render_slot(@actions, @shot_group) %>
"""
end
defp get_row_value(key, shot_group, _extra_data), do: shot_group |> Map.get(key)
end

View File

@ -21,6 +21,7 @@ defmodule CanneryWeb.Components.TableComponent do
use CanneryWeb, :live_component use CanneryWeb, :live_component
alias Phoenix.LiveView.Socket alias Phoenix.LiveView.Socket
require Integer
@impl true @impl true
@spec update( @spec update(
@ -30,6 +31,8 @@ defmodule CanneryWeb.Components.TableComponent do
required(:label) => String.t() | nil, required(:label) => String.t() | nil,
required(:key) => atom() | nil, required(:key) => atom() | nil,
optional(:class) => String.t(), optional(:class) => String.t(),
optional(:row_class) => String.t(),
optional(:alternate_row_class) => String.t(),
optional(:sortable) => false optional(:sortable) => false
}), }),
required(:rows) => required(:rows) =>
@ -57,7 +60,7 @@ defmodule CanneryWeb.Components.TableComponent do
:asc :asc
end end
rows = rows |> Enum.sort_by(fn row -> row |> Map.get(initial_key) end, initial_sort_mode) rows = rows |> sort_by_custom_sort_value_or_value(initial_key, initial_sort_mode)
socket = socket =
socket socket
@ -68,6 +71,8 @@ defmodule CanneryWeb.Components.TableComponent do
last_sort_key: initial_key, last_sort_key: initial_key,
sort_mode: initial_sort_mode sort_mode: initial_sort_mode
) )
|> assign_new(:row_class, fn -> "bg-white" end)
|> assign_new(:alternate_row_class, fn -> "bg-gray-200" end)
{:ok, socket} {:ok, socket}
end end

View File

@ -1,31 +1,32 @@
<div id={@id} class="w-full overflow-x-auto border border-gray-600 rounded-lg shadow-lg bg-black"> <div id={@id} class="w-full overflow-x-auto border border-gray-600 rounded-lg shadow-lg bg-white">
<table class="min-w-full table-auto text-center bg-white"> <table class="min-w-full table-auto text-center bg-white">
<thead class="border-b border-primary-600"> <thead class="border-b border-primary-600">
<tr> <tr>
<%= for %{key: key, label: label} = column <- @columns do %> <%= for %{key: key, label: label} = column <- @columns do %>
<%= if column |> Map.get(:sortable, true) do %> <%= if column |> Map.get(:sortable, true) do %>
<th class={"p-2 #{column[:class]}"}> <th class={["p-2", column[:class]]}>
<span <span
class="cursor-pointer" class="cursor-pointer flex justify-center items-center space-x-2"
phx-click="sort_by" phx-click="sort_by"
phx-value-sort-key={key} phx-value-sort-key={key}
phx-target={@myself} phx-target={@myself}
> >
<span class="underline"><%= label %></span> <i class="w-0 float-right fas fa-sm fa-chevron-up opacity-0"></i>
<span class={if @last_sort_key == key, do: "underline"}><%= label %></span>
<%= if @last_sort_key == key do %> <%= if @last_sort_key == key do %>
<%= case @sort_mode do %> <%= case @sort_mode do %>
<% :asc -> %> <% :asc -> %>
<i class="fas fa-sm fa-chevron-down"></i> <i class="w-0 float-right fas fa-sm fa-chevron-down"></i>
<% :desc -> %> <% :desc -> %>
<i class="fas fa-sm fa-chevron-up"></i> <i class="w-0 float-right fas fa-sm fa-chevron-up"></i>
<% end %> <% end %>
<% else %> <% else %>
<i class="fas fa-sm fa-chevron-up opacity-0"></i> <i class="w-0 float-right fas fa-sm fa-chevron-up opacity-0"></i>
<% end %> <% end %>
</span> </span>
</th> </th>
<% else %> <% else %>
<th class={"p-2 #{column[:class]}"}> <th class={["p-2 cursor-not-allowed", column[:class]]}>
<%= label %> <%= label %>
</th> </th>
<% end %> <% end %>
@ -33,10 +34,10 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<%= for values <- @rows do %> <%= for {values, i} <- @rows |> Enum.with_index() do %>
<tr> <tr class={if i |> Integer.is_even(), do: @row_class, else: @alternate_row_class}>
<%= for %{key: key} = value <- @columns do %> <%= for %{key: key} = value <- @columns do %>
<td class={"p-2 #{value[:class]}"}> <td class={["p-2", value[:class]]}>
<%= case values |> Map.get(key) do %> <%= case values |> Map.get(key) do %>
<% {_custom_sort_value, value} -> %> <% {_custom_sort_value, value} -> %>
<%= value %> <%= value %>

View File

@ -13,7 +13,7 @@ defmodule CanneryWeb.Components.TagCard do
~H""" ~H"""
<div <div
id={"tag-#{@tag.id}"} id={"tag-#{@tag.id}"}
class="mx-4 my-2 px-8 py-4 space-x-4 flex justify-center items-center class="mx-4 mb-4 px-8 py-4 space-x-4 flex justify-center items-center
border border-gray-400 rounded-lg shadow-lg hover:shadow-md 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"
> >

View File

@ -23,16 +23,23 @@ defmodule CanneryWeb.Components.UserCard do
<h3 class="px-4 py-2 rounded-lg title text-lg"> <h3 class="px-4 py-2 rounded-lg title text-lg">
<p> <p>
<%= if @user.confirmed_at |> is_nil() do %> <%= if @user.confirmed_at do %>
Email unconfirmed <%= gettext(
"User was confirmed at%{confirmed_datetime}",
confirmed_datetime: ""
) %>
<.datetime datetime={@user.confirmed_at} />
<% else %> <% else %>
User was confirmed at <%= @user.confirmed_at |> display_datetime() %> <%= gettext("Email unconfirmed") %>
<% end %> <% end %>
</p> </p>
<p> <p>
<%= gettext("User registered on") %> <%= gettext(
<%= @user.inserted_at |> display_datetime() %> "User registered on%{registered_datetime}",
registered_datetime: ""
) %>
<.datetime datetime={@user.inserted_at} />
</p> </p>
</h3> </h3>

View File

@ -23,9 +23,11 @@ defmodule CanneryWeb.ExportController do
end) end)
ammo_groups = ammo_groups =
Ammo.list_ammo_groups(current_user, true) Ammo.list_ammo_groups(nil, true, current_user)
|> Enum.map(fn ammo_group -> |> Enum.map(fn ammo_group ->
cpr = ammo_group |> Ammo.get_cpr()
used_count = ammo_group |> Ammo.get_used_count() used_count = ammo_group |> Ammo.get_used_count()
original_count = ammo_group |> Ammo.get_original_count()
percentage_remaining = ammo_group |> Ammo.get_percentage_remaining() percentage_remaining = ammo_group |> Ammo.get_percentage_remaining()
ammo_group ammo_group
@ -33,7 +35,9 @@ defmodule CanneryWeb.ExportController do
|> Jason.decode!() |> Jason.decode!()
|> Map.merge(%{ |> Map.merge(%{
"used_count" => used_count, "used_count" => used_count,
"percentage_remaining" => percentage_remaining "percentage_remaining" => percentage_remaining,
"original_count" => original_count,
"cpr" => cpr
}) })
end) end)

View File

@ -2,7 +2,6 @@ defmodule CanneryWeb.UserRegistrationController do
use CanneryWeb, :controller use CanneryWeb, :controller
import CanneryWeb.Gettext import CanneryWeb.Gettext
alias Cannery.{Accounts, Invites} alias Cannery.{Accounts, Invites}
alias Cannery.Accounts.User
alias CanneryWeb.{Endpoint, HomeLive} alias CanneryWeb.{Endpoint, HomeLive}
def new(conn, %{"invite" => invite_token}) do def new(conn, %{"invite" => invite_token}) do
@ -30,7 +29,7 @@ defmodule CanneryWeb.UserRegistrationController do
# renders new user registration page # renders new user registration page
defp render_new(conn, invite \\ nil) do defp render_new(conn, invite \\ nil) do
render(conn, "new.html", render(conn, "new.html",
changeset: Accounts.change_user_registration(%User{}), changeset: Accounts.change_user_registration(),
invite: invite, invite: invite,
page_title: gettext("Register") page_title: gettext("Register")
) )

View File

@ -38,6 +38,14 @@
) %> ) %>
<%= error_tag(f, :price_paid, "col-span-3 text-center") %> <%= error_tag(f, :price_paid, "col-span-3 text-center") %>
<%= label(f, :purchased_on, gettext("Purchased on"), class: "title text-lg text-primary-600") %>
<%= date_input(f, :purchased_on,
class: "input input-primary col-span-2",
phx_update: "ignore",
value: @changeset |> Changeset.get_field(:purchased_on) || Date.utc_today()
) %>
<%= error_tag(f, :purchased_on, "col-span-3 text-center") %>
<%= label(f, :notes, gettext("Notes"), class: "title text-lg text-primary-600") %> <%= label(f, :notes, gettext("Notes"), class: "title text-lg text-primary-600") %>
<%= textarea(f, :notes, <%= textarea(f, :notes,
class: "text-center col-span-2 input input-primary", class: "text-center col-span-2 input input-primary",

View File

@ -4,12 +4,15 @@ defmodule CanneryWeb.AmmoGroupLive.Index do
""" """
use CanneryWeb, :live_view use CanneryWeb, :live_view
alias Cannery.{Ammo, Ammo.AmmoGroup, Containers, Repo} alias Cannery.{Ammo, Ammo.AmmoGroup, Containers}
alias CanneryWeb.Endpoint
@impl true @impl true
def mount(%{"search" => search}, _session, socket) do
{:ok, socket |> assign(show_used: false, search: search) |> display_ammo_groups()}
end
def mount(_params, _session, socket) do def mount(_params, _session, socket) do
{:ok, socket |> assign(show_used: false)} {:ok, socket |> assign(show_used: false, search: nil) |> display_ammo_groups()}
end end
@impl true @impl true
@ -23,45 +26,67 @@ defmodule CanneryWeb.AmmoGroupLive.Index do
%{"id" => id} %{"id" => id}
) do ) do
socket socket
|> assign(:page_title, gettext("Record shots")) |> assign(
|> assign(:ammo_group, Ammo.get_ammo_group!(id, current_user)) page_title: gettext("Record shots"),
ammo_group: Ammo.get_ammo_group!(id, current_user)
)
end end
defp apply_action(%{assigns: %{current_user: current_user}} = socket, :move, %{"id" => id}) do defp apply_action(%{assigns: %{current_user: current_user}} = socket, :move, %{"id" => id}) do
socket socket
|> assign(:page_title, gettext("Move Ammo group")) |> assign(
|> assign(:ammo_group, Ammo.get_ammo_group!(id, current_user)) page_title: gettext("Move ammo"),
ammo_group: Ammo.get_ammo_group!(id, current_user)
)
end end
defp apply_action(%{assigns: %{current_user: current_user}} = socket, :edit, %{"id" => id}) do defp apply_action(%{assigns: %{current_user: current_user}} = socket, :edit, %{"id" => id}) do
socket socket
|> assign(:page_title, gettext("Edit Ammo group")) |> assign(
|> assign(:ammo_group, Ammo.get_ammo_group!(id, current_user)) page_title: gettext("Edit ammo"),
ammo_group: Ammo.get_ammo_group!(id, current_user)
)
end end
defp apply_action(%{assigns: %{current_user: current_user}} = socket, :clone, %{"id" => id}) do defp apply_action(%{assigns: %{current_user: current_user}} = socket, :clone, %{"id" => id}) do
socket socket
|> assign(:page_title, dgettext("actions", "Add Ammo")) |> assign(
|> assign(:ammo_group, %{Ammo.get_ammo_group!(id, current_user) | id: nil}) page_title: dgettext("actions", "Add Ammo"),
ammo_group: %{Ammo.get_ammo_group!(id, current_user) | id: nil}
)
end end
defp apply_action(socket, :new, _params) do defp apply_action(socket, :new, _params) do
socket socket
|> assign(:page_title, dgettext("actions", "Add Ammo")) |> assign(
|> assign(:ammo_group, %AmmoGroup{}) page_title: dgettext("actions", "Add Ammo"),
ammo_group: %AmmoGroup{}
)
end end
defp apply_action(socket, :index, _params) do defp apply_action(socket, :index, _params) do
socket socket
|> assign(:page_title, gettext("Ammo groups")) |> assign(
|> assign(:ammo_group, nil) page_title: gettext("Ammo"),
search: nil,
ammo_group: nil
)
end
defp apply_action(socket, :search, %{"search" => search}) do
socket
|> assign(
page_title: gettext("Ammo"),
search: search,
ammo_group: nil
)
end end
@impl true @impl true
def handle_event("delete", %{"id" => id}, %{assigns: %{current_user: current_user}} = socket) do def handle_event("delete", %{"id" => id}, %{assigns: %{current_user: current_user}} = socket) do
Ammo.get_ammo_group!(id, current_user) |> Ammo.delete_ammo_group!(current_user) Ammo.get_ammo_group!(id, current_user) |> Ammo.delete_ammo_group!(current_user)
prompt = dgettext("prompts", "Ammo group deleted succesfully") prompt = dgettext("prompts", "Ammo deleted succesfully")
{:noreply, socket |> put_flash(:info, prompt) |> display_ammo_groups()} {:noreply, socket |> put_flash(:info, prompt) |> display_ammo_groups()}
end end
@ -85,193 +110,30 @@ defmodule CanneryWeb.AmmoGroupLive.Index do
{:noreply, socket |> assign(:show_used, !show_used) |> display_ammo_groups()} {:noreply, socket |> assign(:show_used, !show_used) |> display_ammo_groups()}
end end
defp display_ammo_groups( @impl true
%{assigns: %{current_user: current_user, show_used: show_used}} = socket def handle_event("search", %{"search" => %{"search_term" => ""}}, socket) do
) do {:noreply, socket |> push_patch(to: Routes.ammo_group_index_path(Endpoint, :index))}
ammo_groups = end
Ammo.list_ammo_groups(current_user, show_used)
|> Repo.preload([:ammo_type, :container], force: true)
def handle_event("search", %{"search" => %{"search_term" => search_term}}, socket) do
socket =
socket |> push_patch(to: Routes.ammo_group_index_path(Endpoint, :search, search_term))
{:noreply, socket}
end
defp display_ammo_groups(
%{assigns: %{search: search, current_user: current_user, show_used: show_used}} = socket
) do
ammo_groups = Ammo.list_ammo_groups(search, show_used, current_user)
ammo_types_count = Ammo.get_ammo_types_count!(current_user) ammo_types_count = Ammo.get_ammo_types_count!(current_user)
containers_count = Containers.get_containers_count!(current_user) containers_count = Containers.get_containers_count!(current_user)
columns = [
%{label: gettext("Ammo type"), key: :ammo_type},
%{label: gettext("Count"), key: :count},
%{label: gettext("Price paid"), key: :price_paid},
%{label: gettext("% left"), key: :remaining},
%{label: gettext("Range"), key: :range},
%{label: gettext("Container"), key: :container},
%{label: gettext("Added on"), key: :added_on}
]
columns =
if show_used do
columns ++ [%{label: gettext("Used up on"), key: :used_up_on}]
else
columns
end
columns = columns ++ [%{label: nil, key: :actions, sortable: false}]
rows =
ammo_groups
|> Enum.map(fn ammo_group -> ammo_group |> get_row_data_for_ammo_group(columns) end)
socket socket
|> assign( |> assign(
ammo_groups: ammo_groups, ammo_groups: ammo_groups,
ammo_types_count: ammo_types_count, ammo_types_count: ammo_types_count,
containers_count: containers_count, containers_count: containers_count
columns: columns,
rows: rows
) )
end end
@spec get_row_data_for_ammo_group(AmmoGroup.t(), [map()]) :: [map()]
defp get_row_data_for_ammo_group(ammo_group, columns) do
ammo_group = ammo_group |> Repo.preload([:ammo_type, :container])
columns
|> Enum.into(%{}, fn %{key: key} -> {key, get_value_for_key(key, ammo_group)} end)
end
@spec get_value_for_key(atom(), AmmoGroup.t()) :: any()
defp get_value_for_key(:ammo_type, %{ammo_type: ammo_type}) do
assigns = %{ammo_type: ammo_type}
{ammo_type.name,
~H"""
<.link navigate={Routes.ammo_type_show_path(Endpoint, :show, @ammo_type)} class="link">
<%= @ammo_type.name %>
</.link>
"""}
end
defp get_value_for_key(:price_paid, %{price_paid: nil}), do: {"a", nil}
defp get_value_for_key(:price_paid, %{price_paid: price_paid}),
do: gettext("$%{amount}", amount: price_paid |> :erlang.float_to_binary(decimals: 2))
defp get_value_for_key(:added_on, %{inserted_at: inserted_at}) do
assigns = %{inserted_at: inserted_at}
{inserted_at,
~H"""
<%= @inserted_at |> display_datetime() %>
"""}
end
defp get_value_for_key(:used_up_on, ammo_group) do
last_shot_group_date =
case ammo_group |> Ammo.get_last_used_shot_group() do
%{date: last_shot_group_date} -> last_shot_group_date
_no_shot_groups -> nil
end
assigns = %{last_shot_group_date: last_shot_group_date}
{last_shot_group_date,
~H"""
<%= @last_shot_group_date |> display_date() %>
"""}
end
defp get_value_for_key(:range, %{staged: staged} = ammo_group) do
assigns = %{ammo_group: ammo_group}
{staged,
~H"""
<div class="min-w-20 py-2 px-4 h-full flex flew-wrap justify-center items-center">
<button
type="button"
class="mx-2 my-1 text-sm btn btn-primary"
phx-click="toggle_staged"
phx-value-ammo_group_id={@ammo_group.id}
>
<%= if @ammo_group.staged, do: gettext("Unstage"), else: gettext("Stage") %>
</button>
<.link
patch={Routes.ammo_group_index_path(Endpoint, :add_shot_group, @ammo_group)}
class="mx-2 my-1 text-sm btn btn-primary"
>
<%= dgettext("actions", "Record shots") %>
</.link>
</div>
"""}
end
defp get_value_for_key(:remaining, ammo_group),
do: gettext("%{percentage}%", percentage: ammo_group |> Ammo.get_percentage_remaining())
defp get_value_for_key(:actions, ammo_group) do
assigns = %{ammo_group: ammo_group}
~H"""
<div class="py-2 px-4 h-full space-x-4 flex justify-center items-center">
<.link
navigate={Routes.ammo_group_show_path(Endpoint, :show, @ammo_group)}
class="text-primary-600 link"
data-qa={"view-#{@ammo_group.id}"}
>
<i class="fa-fw fa-lg fas fa-eye"></i>
</.link>
<.link
patch={Routes.ammo_group_index_path(Endpoint, :edit, @ammo_group)}
class="text-primary-600 link"
data-qa={"edit-#{@ammo_group.id}"}
>
<i class="fa-fw fa-lg fas fa-edit"></i>
</.link>
<.link
patch={Routes.ammo_group_index_path(Endpoint, :clone, @ammo_group)}
class="text-primary-600 link"
data-qa={"clone-#{@ammo_group.id}"}
>
<i class="fa-fw fa-lg fas fa-copy"></i>
</.link>
<.link
href="#"
class="text-primary-600 link"
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}"}
>
<i class="fa-fw fa-lg fas fa-trash"></i>
</.link>
</div>
"""
end
defp get_value_for_key(:container, %{container: nil}), do: {nil, nil}
defp get_value_for_key(:container, %{container: %{name: container_name}} = ammo_group) do
assigns = %{ammo_group: ammo_group}
{container_name,
~H"""
<div class="min-w-20 py-2 px-4 h-full flex flew-wrap justify-center items-center">
<.link
navigate={Routes.container_show_path(Endpoint, :show, @ammo_group.container)}
class="mx-2 my-1 link"
>
<%= @ammo_group.container.name %>
</.link>
<.link
patch={Routes.ammo_group_index_path(Endpoint, :move, @ammo_group)}
class="mx-2 my-1 text-sm btn btn-primary"
>
<%= gettext("Move ammo") %>
</.link>
</div>
"""}
end
defp get_value_for_key(key, ammo_group), do: ammo_group |> Map.get(key)
end end

View File

@ -3,7 +3,7 @@
<%= gettext("Ammo") %> <%= gettext("Ammo") %>
</h1> </h1>
<%= if @ammo_groups |> Enum.empty?() do %> <%= if @ammo_groups |> Enum.empty?() and @search |> is_nil() do %>
<h2 class="title text-xl text-primary-600"> <h2 class="title text-xl text-primary-600">
<%= gettext("No Ammo") %> <%= gettext("No Ammo") %>
<%= display_emoji("😔") %> <%= display_emoji("😔") %>
@ -31,7 +31,7 @@
<%= dgettext("actions", "add an ammo type first") %> <%= dgettext("actions", "add an ammo type first") %>
</.link> </.link>
</div> </div>
<% @ammo_groups |> Enum.empty?() -> %> <% @ammo_groups |> Enum.empty?() and @search |> is_nil() -> %>
<.link patch={Routes.ammo_group_index_path(Endpoint, :new)} class="btn btn-primary"> <.link patch={Routes.ammo_group_index_path(Endpoint, :new)} class="btn btn-primary">
<%= dgettext("actions", "Add your first box!") %> <%= dgettext("actions", "Add your first box!") %>
</.link> </.link>
@ -41,22 +41,122 @@
</.link> </.link>
<% end %> <% end %>
<%= unless @ammo_groups |> Enum.empty?() do %> <div class="w-full flex flex-col sm:flex-row justify-center items-center space-y-4 sm:space-y-0 sm:space-x-4 max-w-xl">
<div class="flex flex-col justify-center items-center"> <.form
<.toggle_button action="toggle_show_used" value={@show_used}> :let={f}
<span class="title text-lg text-primary-600"> for={:search}
<%= gettext("Show used") %> phx-change="search"
</span> phx-submit="search"
</.toggle_button> class="grow self-stretch flex flex-col items-stretch"
</div> data-qa="ammo_group_search"
>
<%= text_input(f, :search_term,
class: "input input-primary",
value: @search,
phx_debounce: 300,
placeholder: gettext("Search ammo")
) %>
</.form>
<.toggle_button action="toggle_show_used" value={@show_used}>
<span class="title text-lg text-primary-600">
<%= gettext("Show used") %>
</span>
</.toggle_button>
</div>
<%= if @ammo_groups |> Enum.empty?() do %>
<h2 class="title text-xl text-primary-600">
<%= gettext("No Ammo") %>
<%= display_emoji("😔") %>
</h2>
<% else %>
<.live_component <.live_component
module={CanneryWeb.Components.TableComponent} module={CanneryWeb.Components.AmmoGroupTableComponent}
id="ammo_groups_index_table" id="ammo-group-index-table"
action={@live_action} ammo_groups={@ammo_groups}
columns={@columns} current_user={@current_user}
rows={@rows} >
/> <:ammo_type :let={%{name: ammo_type_name} = ammo_type}>
<.link navigate={Routes.ammo_type_show_path(Endpoint, :show, ammo_type)} class="link">
<%= ammo_type_name %>
</.link>
</:ammo_type>
<:range :let={ammo_group}>
<div class="min-w-20 py-2 px-4 h-full flex flew-wrap justify-center items-center">
<button
type="button"
class="mx-2 my-1 text-sm btn btn-primary"
phx-click="toggle_staged"
phx-value-ammo_group_id={ammo_group.id}
>
<%= if ammo_group.staged, do: gettext("Unstage"), else: gettext("Stage") %>
</button>
<.link
patch={Routes.ammo_group_index_path(Endpoint, :add_shot_group, ammo_group)}
class="mx-2 my-1 text-sm btn btn-primary"
>
<%= dgettext("actions", "Record shots") %>
</.link>
</div>
</:range>
<:container :let={%{container: %{name: container_name} = container} = ammo_group}>
<div class="min-w-20 py-2 px-4 h-full flex flew-wrap justify-center items-center">
<.link
navigate={Routes.container_show_path(Endpoint, :show, container)}
class="mx-2 my-1 link"
>
<%= container_name %>
</.link>
<.link
patch={Routes.ammo_group_index_path(Endpoint, :move, ammo_group)}
class="mx-2 my-1 text-sm btn btn-primary"
>
<%= gettext("Move ammo") %>
</.link>
</div>
</:container>
<:actions :let={ammo_group}>
<div class="py-2 px-4 h-full space-x-4 flex justify-center items-center">
<.link
navigate={Routes.ammo_group_show_path(Endpoint, :show, ammo_group)}
class="text-primary-600 link"
data-qa={"view-#{ammo_group.id}"}
>
<i class="fa-fw fa-lg fas fa-eye"></i>
</.link>
<.link
patch={Routes.ammo_group_index_path(Endpoint, :edit, ammo_group)}
class="text-primary-600 link"
data-qa={"edit-#{ammo_group.id}"}
>
<i class="fa-fw fa-lg fas fa-edit"></i>
</.link>
<.link
patch={Routes.ammo_group_index_path(Endpoint, :clone, ammo_group)}
class="text-primary-600 link"
data-qa={"clone-#{ammo_group.id}"}
>
<i class="fa-fw fa-lg fas fa-copy"></i>
</.link>
<.link
href="#"
class="text-primary-600 link"
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}"}
>
<i class="fa-fw fa-lg fas fa-trash"></i>
</.link>
</div>
</:actions>
</.live_component>
<% end %> <% end %>
</div> </div>

View File

@ -30,7 +30,12 @@ defmodule CanneryWeb.AmmoGroupLive.Show do
@impl true @impl true
def handle_params(%{"id" => id}, _url, %{assigns: %{live_action: live_action}} = socket) do def handle_params(%{"id" => id}, _url, %{assigns: %{live_action: live_action}} = socket) do
{:noreply, socket |> assign(page_title: page_title(live_action)) |> display_ammo_group(id)} socket =
socket
|> assign(page_title: page_title(live_action))
|> display_ammo_group(id)
{:noreply, socket}
end end
defp page_title(:add_shot_group), do: gettext("Record Shots") defp page_title(:add_shot_group), do: gettext("Record Shots")
@ -69,14 +74,14 @@ defmodule CanneryWeb.AmmoGroupLive.Show do
def handle_event( def handle_event(
"delete_shot_group", "delete_shot_group",
%{"id" => id}, %{"id" => id},
%{assigns: %{ammo_group: ammo_group, current_user: current_user}} = socket %{assigns: %{ammo_group: %{id: ammo_group_id}, current_user: current_user}} = socket
) do ) do
{:ok, _} = {:ok, _} =
ActivityLog.get_shot_group!(id, current_user) ActivityLog.get_shot_group!(id, current_user)
|> ActivityLog.delete_shot_group(current_user) |> ActivityLog.delete_shot_group(current_user)
prompt = dgettext("prompts", "Shot records deleted succesfully") prompt = dgettext("prompts", "Shot records deleted succesfully")
{:noreply, socket |> put_flash(:info, prompt) |> display_ammo_group(ammo_group)} {:noreply, socket |> put_flash(:info, prompt) |> display_ammo_group(ammo_group_id)}
end end
@spec display_ammo_group(Socket.t(), AmmoGroup.t() | AmmoGroup.id()) :: Socket.t() @spec display_ammo_group(Socket.t(), AmmoGroup.t() | AmmoGroup.id()) :: Socket.t()
@ -102,16 +107,21 @@ defmodule CanneryWeb.AmmoGroupLive.Show do
defp display_ammo_group(%{assigns: %{current_user: current_user}} = socket, id), defp display_ammo_group(%{assigns: %{current_user: current_user}} = socket, id),
do: display_ammo_group(socket, Ammo.get_ammo_group!(id, current_user)) do: display_ammo_group(socket, Ammo.get_ammo_group!(id, current_user))
@spec get_table_row_for_shot_group(AmmoGroup.t(), ShotGroup.t(), [map()]) :: [map()] @spec get_table_row_for_shot_group(AmmoGroup.t(), ShotGroup.t(), [map()]) :: map()
defp get_table_row_for_shot_group(ammo_group, %{date: date} = shot_group, columns) do defp get_table_row_for_shot_group(ammo_group, %{date: date} = shot_group, columns) do
assigns = %{ammo_group: ammo_group, shot_group: shot_group} assigns = %{ammo_group: ammo_group, shot_group: shot_group}
columns columns
|> Enum.into(%{}, fn %{key: key} -> |> Map.new(fn %{key: key} ->
value = value =
case key do case key do
:date -> :date ->
{date, date |> display_date()} assigns = %{date: date}
{date,
~H"""
<.date date={@date} />
"""}
:actions -> :actions ->
~H""" ~H"""

View File

@ -11,7 +11,7 @@
<span class="rounded-lg title text-lg"> <span class="rounded-lg title text-lg">
<%= gettext("Original count:") %> <%= gettext("Original count:") %>
<%= @ammo_group.count + Ammo.get_used_count(@ammo_group) %> <%= Ammo.get_original_count(@ammo_group) %>
</span> </span>
<span class="rounded-lg title text-lg"> <span class="rounded-lg title text-lg">
@ -27,8 +27,8 @@
<% end %> <% end %>
<span class="rounded-lg title text-lg"> <span class="rounded-lg title text-lg">
<%= gettext("Added on:") %> <%= gettext("Purchased on:") %>
<%= @ammo_group.inserted_at |> display_datetime() %> <.date date={@ammo_group.purchased_on} />
</span> </span>
<%= if @ammo_group.price_paid do %> <%= if @ammo_group.price_paid do %>

View File

@ -4,13 +4,15 @@ defmodule CanneryWeb.AmmoTypeLive.Index do
""" """
use CanneryWeb, :live_view use CanneryWeb, :live_view
alias Cannery.{Ammo, Ammo.AmmoType} alias Cannery.{Ammo, Ammo.AmmoType}
alias CanneryWeb.Endpoint
@impl true @impl true
def mount(%{"search" => search}, _session, socket) do
{:ok, socket |> assign(show_used: false, search: search) |> list_ammo_types()}
end
def mount(_params, _session, socket) do def mount(_params, _session, socket) do
{:ok, socket |> assign(:show_used, false) |> list_ammo_types()} {:ok, socket |> assign(show_used: false, search: nil) |> list_ammo_types()}
end end
@impl true @impl true
@ -19,25 +21,49 @@ defmodule CanneryWeb.AmmoTypeLive.Index do
end end
defp apply_action(%{assigns: %{current_user: current_user}} = socket, :edit, %{"id" => id}) do defp apply_action(%{assigns: %{current_user: current_user}} = socket, :edit, %{"id" => id}) do
%{name: ammo_type_name} = ammo_type = Ammo.get_ammo_type!(id, current_user)
socket socket
|> assign(:page_title, gettext("Edit Ammo type")) |> assign(
|> assign(:ammo_type, Ammo.get_ammo_type!(id, current_user)) page_title: gettext("Edit %{ammo_type_name}", ammo_type_name: ammo_type_name),
ammo_type: ammo_type
)
end end
defp apply_action(%{assigns: %{current_user: current_user}} = socket, :clone, %{"id" => id}) do defp apply_action(%{assigns: %{current_user: current_user}} = socket, :clone, %{"id" => id}) do
socket socket
|> assign(:page_title, gettext("New Ammo type")) |> assign(
|> assign(:ammo_type, %{Ammo.get_ammo_type!(id, current_user) | id: nil}) page_title: gettext("New Ammo type"),
ammo_type: %{Ammo.get_ammo_type!(id, current_user) | id: nil}
)
end end
defp apply_action(socket, :new, _params) do defp apply_action(socket, :new, _params) do
socket socket
|> assign(:page_title, gettext("New Ammo type")) |> assign(
|> assign(:ammo_type, %AmmoType{}) page_title: gettext("New Ammo type"),
ammo_type: %AmmoType{}
)
end end
defp apply_action(socket, :index, _params) do defp apply_action(socket, :index, _params) do
socket |> assign(:page_title, gettext("Ammo types")) |> assign(:ammo_type, nil) socket
|> assign(
page_title: gettext("Catalog"),
search: nil,
ammo_type: nil
)
|> list_ammo_types()
end
defp apply_action(socket, :search, %{"search" => search}) do
socket
|> assign(
page_title: gettext("Catalog"),
search: search,
ammo_type: nil
)
|> list_ammo_types()
end end
@impl true @impl true
@ -54,196 +80,17 @@ defmodule CanneryWeb.AmmoTypeLive.Index do
{:noreply, socket |> assign(:show_used, !show_used) |> list_ammo_types()} {:noreply, socket |> assign(:show_used, !show_used) |> list_ammo_types()}
end end
defp list_ammo_types(%{assigns: %{current_user: current_user, show_used: show_used}} = socket) do @impl true
ammo_types = Ammo.list_ammo_types(current_user) def handle_event("search", %{"search" => %{"search_term" => ""}}, socket) do
{:noreply, socket |> push_patch(to: Routes.ammo_type_index_path(Endpoint, :index))}
columns =
[
%{label: gettext("Name"), key: :name, type: :name},
%{label: gettext("Bullet type"), key: :bullet_type, type: :string},
%{label: gettext("Bullet core"), key: :bullet_core, type: :string},
%{label: gettext("Cartridge"), key: :cartridge, type: :string},
%{label: gettext("Caliber"), key: :caliber, type: :string},
%{label: gettext("Case material"), key: :case_material, type: :string},
%{label: gettext("Jacket type"), key: :jacket_type, type: :string},
%{label: gettext("Muzzle velocity"), key: :muzzle_velocity, type: :string},
%{label: gettext("Powder type"), key: :powder_type, type: :string},
%{
label: gettext("Powder grains per charge"),
key: :powder_grains_per_charge,
type: :string
},
%{label: gettext("Grains"), key: :grains, type: :string},
%{label: gettext("Pressure"), key: :pressure, type: :string},
%{label: gettext("Primer type"), key: :primer_type, type: :string},
%{label: gettext("Firing type"), key: :firing_type, type: :string},
%{label: gettext("Tracer"), key: :tracer, type: :boolean},
%{label: gettext("Incendiary"), key: :incendiary, type: :boolean},
%{label: gettext("Blank"), key: :blank, type: :boolean},
%{label: gettext("Corrosive"), key: :corrosive, type: :boolean},
%{label: gettext("Manufacturer"), key: :manufacturer, type: :string},
%{label: gettext("UPC"), key: "upc", type: :string}
]
|> Enum.filter(fn %{key: key, type: type} ->
# remove columns if all values match defaults
default_value = if type == :boolean, do: false, else: nil
ammo_types
|> Enum.any?(fn ammo_type ->
not (ammo_type |> Map.get(key) == default_value)
end)
end)
|> Kernel.++([
%{label: gettext("Rounds"), key: :round_count, type: :round_count}
])
|> Kernel.++(
if show_used do
[
%{
label: gettext("Used rounds"),
key: :used_round_count,
type: :used_round_count
},
%{
label: gettext("Total ever rounds"),
key: :historical_round_count,
type: :historical_round_count
}
]
else
[]
end
)
|> Kernel.++([%{label: gettext("Packs"), key: :ammo_count, type: :ammo_count}])
|> Kernel.++(
if show_used do
[
%{
label: gettext("Used packs"),
key: :used_ammo_count,
type: :used_ammo_count
},
%{
label: gettext("Total ever packs"),
key: :historical_ammo_count,
type: :historical_ammo_count
}
]
else
[]
end
)
|> Kernel.++([
%{label: gettext("Average Price paid"), key: :avg_price_paid, type: :avg_price_paid},
%{label: nil, key: "actions", type: :actions, sortable: false}
])
rows =
ammo_types
|> Enum.map(fn ammo_type -> ammo_type |> get_ammo_type_values(columns, current_user) end)
socket |> assign(columns: columns, rows: rows)
end end
defp get_ammo_type_values(ammo_type, columns, current_user) do def handle_event("search", %{"search" => %{"search_term" => search_term}}, socket) do
columns {:noreply,
|> Enum.into(%{}, fn %{key: key, type: type} -> socket |> push_patch(to: Routes.ammo_type_index_path(Endpoint, :search, search_term))}
{key, get_ammo_type_value(type, key, ammo_type, current_user)}
end)
end end
defp get_ammo_type_value(:boolean, key, ammo_type, _current_user), defp list_ammo_types(%{assigns: %{search: search, current_user: current_user}} = socket) do
do: ammo_type |> Map.get(key) |> humanize() socket |> assign(ammo_types: Ammo.list_ammo_types(search, current_user))
defp get_ammo_type_value(:round_count, _key, ammo_type, current_user),
do: ammo_type |> Ammo.get_round_count_for_ammo_type(current_user)
defp get_ammo_type_value(:historical_round_count, _key, ammo_type, current_user),
do: ammo_type |> Ammo.get_historical_count_for_ammo_type(current_user)
defp get_ammo_type_value(:used_round_count, _key, ammo_type, current_user),
do: ammo_type |> Ammo.get_used_count_for_ammo_type(current_user)
defp get_ammo_type_value(:historical_ammo_count, _key, ammo_type, current_user),
do: ammo_type |> Ammo.get_ammo_groups_count_for_type(current_user, true)
defp get_ammo_type_value(:used_ammo_count, _key, ammo_type, current_user),
do: ammo_type |> Ammo.get_used_ammo_groups_count_for_type(current_user)
defp get_ammo_type_value(:ammo_count, _key, ammo_type, current_user),
do: ammo_type |> Ammo.get_ammo_groups_count_for_type(current_user)
defp get_ammo_type_value(:avg_price_paid, _key, ammo_type, current_user) do
case ammo_type |> Ammo.get_average_cost_for_ammo_type!(current_user) do
nil -> gettext("No cost information")
count -> gettext("$%{amount}", amount: count |> :erlang.float_to_binary(decimals: 2))
end
end end
defp get_ammo_type_value(:name, _key, ammo_type, _current_user) 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}"}
>
<%= @ammo_type.name %>
</.link>
"""
end
defp get_ammo_type_value(:actions, _key, ammo_type, _current_user) do
assigns = %{ammo_type: ammo_type}
~H"""
<div class="px-4 py-2 space-x-4 flex justify-center items-center">
<.link
navigate={Routes.ammo_type_show_path(Endpoint, :show, @ammo_type)}
class="text-primary-600 link"
data-qa={"view-#{@ammo_type.id}"}
>
<i class="fa-fw fa-lg fas fa-eye"></i>
</.link>
<.link
patch={Routes.ammo_type_index_path(Endpoint, :edit, @ammo_type)}
class="text-primary-600 link"
data-qa={"edit-#{@ammo_type.id}"}
>
<i class="fa-fw fa-lg fas fa-edit"></i>
</.link>
<.link
patch={Routes.ammo_type_index_path(Endpoint, :clone, @ammo_type)}
class="text-primary-600 link"
data-qa={"clone-#{@ammo_type.id}"}
>
<i class="fa-fw fa-lg fas fa-copy"></i>
</.link>
<.link
href="#"
class="text-primary-600 link"
phx-click="delete"
phx-value-id={@ammo_type.id}
data-confirm={
dgettext(
"prompts",
"Are you sure you want to delete %{name}? This will delete all %{name} type ammo as well!",
name: @ammo_type.name
)
}
data-qa={"delete-#{@ammo_type.id}"}
>
<i class="fa-lg fas fa-trash"></i>
</.link>
</div>
"""
end
defp get_ammo_type_value(nil, _key, _ammo_type, _current_user), do: nil
defp get_ammo_type_value(_other, key, ammo_type, _current_user), do: ammo_type |> Map.get(key)
end end

View File

@ -3,9 +3,9 @@
<%= gettext("Catalog") %> <%= gettext("Catalog") %>
</h1> </h1>
<%= if @rows |> Enum.empty?() do %> <%= if @ammo_types |> Enum.empty?() and @search |> is_nil() do %>
<h2 class="title text-xl text-primary-600"> <h2 class="title text-xl text-primary-600">
<%= gettext("No Ammo Types") %> <%= gettext("No Ammo types") %>
<%= display_emoji("😔") %> <%= display_emoji("😔") %>
</h2> </h2>
@ -17,7 +17,23 @@
<%= dgettext("actions", "New Ammo type") %> <%= dgettext("actions", "New Ammo type") %>
</.link> </.link>
<div class="flex flex-col justify-center items-center"> <div class="w-full flex flex-col sm:flex-row justify-center items-center space-y-4 sm:space-y-0 sm:space-x-4 max-w-xl">
<.form
:let={f}
for={:search}
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",
value: @search,
phx_debounce: 300,
placeholder: gettext("Search catalog")
) %>
</.form>
<.toggle_button action="toggle_show_used" value={@show_used}> <.toggle_button action="toggle_show_used" value={@show_used}>
<span class="title text-lg text-primary-600"> <span class="title text-lg text-primary-600">
<%= gettext("Show used") %> <%= gettext("Show used") %>
@ -25,13 +41,66 @@
</.toggle_button> </.toggle_button>
</div> </div>
<.live_component <%= if @ammo_types |> Enum.empty?() do %>
module={CanneryWeb.Components.TableComponent} <h2 class="title text-xl text-primary-600">
id="ammo_types_index_table" <%= gettext("No Ammo types") %>
action={@live_action} <%= display_emoji("😔") %>
columns={@columns} </h2>
rows={@rows} <% else %>
/> <.live_component
module={CanneryWeb.Components.AmmoTypeTableComponent}
id="ammo_types_index_table"
action={@live_action}
ammo_types={@ammo_types}
current_user={@current_user}
show_used={@show_used}
>
<:actions :let={ammo_type}>
<div class="px-4 py-2 space-x-4 flex justify-center items-center">
<.link
navigate={Routes.ammo_type_show_path(Endpoint, :show, ammo_type)}
class="text-primary-600 link"
data-qa={"view-#{ammo_type.id}"}
>
<i class="fa-fw fa-lg fas fa-eye"></i>
</.link>
<.link
patch={Routes.ammo_type_index_path(Endpoint, :edit, ammo_type)}
class="text-primary-600 link"
data-qa={"edit-#{ammo_type.id}"}
>
<i class="fa-fw fa-lg fas fa-edit"></i>
</.link>
<.link
patch={Routes.ammo_type_index_path(Endpoint, :clone, ammo_type)}
class="text-primary-600 link"
data-qa={"clone-#{ammo_type.id}"}
>
<i class="fa-fw fa-lg fas fa-copy"></i>
</.link>
<.link
href="#"
class="text-primary-600 link"
phx-click="delete"
phx-value-id={ammo_type.id}
data-confirm={
dgettext(
"prompts",
"Are you sure you want to delete %{name}? This will delete all %{name} type ammo as well!",
name: ammo_type.name
)
}
data-qa={"delete-#{ammo_type.id}"}
>
<i class="fa-lg fas fa-trash"></i>
</.link>
</div>
</:actions>
</.live_component>
<% end %>
<% end %> <% end %>
</div> </div>

View File

@ -5,16 +5,43 @@ defmodule CanneryWeb.AmmoTypeLive.Show do
use CanneryWeb, :live_view use CanneryWeb, :live_view
import CanneryWeb.Components.AmmoGroupCard import CanneryWeb.Components.AmmoGroupCard
alias Cannery.Ammo alias Cannery.{Ammo, Ammo.AmmoType}
alias CanneryWeb.Endpoint alias CanneryWeb.Endpoint
@impl true @fields_list [
def mount(_params, _session, socket), do: {:ok, socket |> assign(show_used: false)} %{label: gettext("Bullet type:"), key: :bullet_type, type: :string},
%{label: gettext("Bullet core:"), key: :bullet_core, type: :string},
%{label: gettext("Cartridge:"), key: :cartridge, type: :string},
%{label: gettext("Caliber:"), key: :caliber, type: :string},
%{label: gettext("Case material:"), key: :case_material, type: :string},
%{label: gettext("Jacket type:"), key: :jacket_type, type: :string},
%{label: gettext("Muzzle velocity:"), key: :muzzle_velocity, type: :string},
%{label: gettext("Powder type:"), key: :powder_type, type: :string},
%{label: gettext("Powder grains per charge:"), key: :powder_grains_per_charge, type: :string},
%{label: gettext("Grains:"), key: :grains, type: :string},
%{label: gettext("Pressure:"), key: :pressure, type: :string},
%{label: gettext("Primer type:"), key: :primer_type, type: :string},
%{label: gettext("Firing type:"), key: :firing_type, type: :string},
%{label: gettext("Tracer:"), key: :tracer, type: :boolean},
%{label: gettext("Incendiary:"), key: :incendiary, type: :boolean},
%{label: gettext("Blank:"), key: :blank, type: :boolean},
%{label: gettext("Corrosive:"), key: :corrosive, type: :boolean},
%{label: gettext("Manufacturer:"), key: :manufacturer, type: :string},
%{label: gettext("UPC:"), key: :upc, type: :string}
]
@impl true @impl true
def handle_params(%{"id" => id}, _params, %{assigns: %{current_user: current_user}} = socket) do def mount(_params, _session, %{assigns: %{live_action: live_action}} = socket),
ammo_type = Ammo.get_ammo_type!(id, current_user) do: {:ok, socket |> assign(show_used: false, view_table: live_action == :table)}
{:noreply, socket |> display_ammo_type(ammo_type)}
@impl true
def handle_params(%{"id" => id}, _params, %{assigns: %{live_action: live_action}} = socket) do
socket =
socket
|> assign(view_table: live_action == :table)
|> display_ammo_type(id)
{:noreply, socket}
end end
@impl true @impl true
@ -36,29 +63,59 @@ defmodule CanneryWeb.AmmoTypeLive.Show do
{:noreply, socket |> assign(:show_used, !show_used) |> display_ammo_type()} {:noreply, socket |> assign(:show_used, !show_used) |> display_ammo_type()}
end end
@impl true
def handle_event(
"toggle_table",
_params,
%{assigns: %{view_table: view_table, ammo_type: ammo_type}} = socket
) do
new_path =
if view_table,
do: Routes.ammo_type_show_path(Endpoint, :show, ammo_type),
else: Routes.ammo_type_show_path(Endpoint, :table, ammo_type)
{:noreply, socket |> push_patch(to: new_path)}
end
defp display_ammo_type( defp display_ammo_type(
%{ %{assigns: %{live_action: live_action, current_user: current_user, show_used: show_used}} =
assigns: %{ socket,
live_action: live_action, %AmmoType{} = ammo_type
current_user: current_user,
show_used: show_used
}
} = socket,
ammo_type
) do ) do
fields_to_display =
@fields_list
|> Enum.any?(fn %{key: field, type: type} ->
default_value =
case type do
:boolean -> false
_other_type -> nil
end
ammo_type |> Map.get(field) != default_value
end)
socket socket
|> assign( |> assign(
page_title: page_title(live_action), page_title: page_title(live_action, ammo_type),
ammo_type: ammo_type, ammo_type: ammo_type,
ammo_groups: ammo_type |> Ammo.list_ammo_groups_for_type(current_user, show_used), ammo_groups: ammo_type |> Ammo.list_ammo_groups_for_type(current_user, show_used),
avg_cost_per_round: ammo_type |> Ammo.get_average_cost_for_ammo_type!(current_user) avg_cost_per_round: ammo_type |> Ammo.get_average_cost_for_ammo_type!(current_user),
fields_list: @fields_list,
fields_to_display: fields_to_display
) )
end end
defp display_ammo_type(%{assigns: %{current_user: current_user}} = socket, ammo_type_id) do
socket |> display_ammo_type(Ammo.get_ammo_type!(ammo_type_id, current_user))
end
defp display_ammo_type(%{assigns: %{ammo_type: ammo_type}} = socket) do defp display_ammo_type(%{assigns: %{ammo_type: ammo_type}} = socket) do
socket |> display_ammo_type(ammo_type) socket |> display_ammo_type(ammo_type)
end end
defp page_title(:show), do: gettext("Show Ammo type") defp page_title(action, %{name: ammo_type_name}) when action in [:show, :table],
defp page_title(:edit), do: gettext("Edit Ammo type") do: ammo_type_name
defp page_title(:edit, %{name: ammo_type_name}),
do: gettext("Edit %{ammo_type_name}", ammo_type_name: ammo_type_name)
end end

View File

@ -39,44 +39,30 @@
<hr class="hr" /> <hr class="hr" />
<div class="grid sm:grid-cols-2 gap-4 text-center justify-center items-center"> <%= if @fields_to_display do %>
<%= for {field_name, field, type} <- [ <div class="grid sm:grid-cols-2 gap-4 text-center justify-center items-center">
{gettext("Bullet type"), :bullet_type, :string}, <%= for %{label: label, key: key, type: type} <- @fields_list do %>
{gettext("Bullet core"), :bullet_core, :string}, <%= if @ammo_type |> Map.get(key) do %>
{gettext("Cartridge"), :cartridge, :string}, <h3 class="title text-lg">
{gettext("Caliber"), :caliber, :string}, <%= label %>
{gettext("Case material"), :case_material, :string}, </h3>
{gettext("Jacket type"), :jacket_type, :string},
{gettext("Muzzle velocity"), :muzzle_velocity, :string},
{gettext("Powder type"), :powder_type, :string},
{gettext("Powder grains per charge"), :powder_grains_per_charge, :string},
{gettext("Grains"), :grains, :string},
{gettext("Pressure"), :pressure, :string},
{gettext("Primer type"), :primer_type, :string},
{gettext("Firing type"), :firing_type, :string},
{gettext("Tracer"), :tracer, :boolean},
{gettext("Incendiary"), :incendiary, :boolean},
{gettext("Blank"), :blank, :boolean},
{gettext("Corrosive"), :corrosive, :boolean},
{gettext("Manufacturer"), :manufacturer, :string},
{gettext("UPC"), :upc, :string}
] do %>
<%= if @ammo_type |> Map.get(field) do %>
<h3 class="title text-lg">
<%= field_name %>:
</h3>
<span class="text-primary-600"> <span class="text-primary-600">
<%= case type do %> <%= case type do %>
<% :boolean -> %> <% :boolean -> %>
<%= @ammo_type |> Map.get(field) |> humanize() %> <%= @ammo_type |> Map.get(key) |> humanize() %>
<% _ -> %> <% _ -> %>
<%= @ammo_type |> Map.get(field) %> <%= @ammo_type |> Map.get(key) %>
<% end %> <% end %>
</span> </span>
<% end %>
<% end %> <% end %>
<% end %> </div>
<hr class="hr" />
<% end %>
<div class="grid sm:grid-cols-2 gap-4 text-center justify-center items-center">
<h3 class="title text-lg"> <h3 class="title text-lg">
<%= gettext("Rounds:") %> <%= gettext("Rounds:") %>
</h3> </h3>
@ -100,7 +86,11 @@
<span class="text-primary-600"> <span class="text-primary-600">
<%= @ammo_type |> Ammo.get_historical_count_for_ammo_type(@current_user) %> <%= @ammo_type |> Ammo.get_historical_count_for_ammo_type(@current_user) %>
</span> </span>
</div>
<hr class="hr" />
<div class="grid sm:grid-cols-2 gap-4 text-center justify-center items-center">
<h3 class="title text-lg"> <h3 class="title text-lg">
<%= gettext("Packs:") %> <%= gettext("Packs:") %>
</h3> </h3>
@ -124,18 +114,22 @@
<span class="text-primary-600"> <span class="text-primary-600">
<%= @ammo_type |> Ammo.get_ammo_groups_count_for_type(@current_user, true) %> <%= @ammo_type |> Ammo.get_ammo_groups_count_for_type(@current_user, true) %>
</span> </span>
</div>
<hr class="hr" />
<div class="grid sm:grid-cols-2 gap-4 text-center justify-center items-center">
<h3 class="title text-lg"> <h3 class="title text-lg">
<%= gettext("Added on:") %> <%= gettext("Added on:") %>
</h3> </h3>
<span class="text-primary-600"> <span class="text-primary-600">
<%= @ammo_type.inserted_at |> display_datetime() %> <.datetime datetime={@ammo_type.inserted_at} />
</span> </span>
<%= if @avg_cost_per_round do %> <%= if @avg_cost_per_round do %>
<h3 class="title text-lg"> <h3 class="title text-lg">
<%= gettext("Average Price paid") %>: <%= gettext("Average CPR") %>:
</h3> </h3>
<span class="text-primary-600"> <span class="text-primary-600">
@ -152,26 +146,50 @@
<hr class="hr" /> <hr class="hr" />
<div class="flex flex-col justify-center items-center"> <div class="flex justify-center items-center space-x-4">
<.toggle_button action="toggle_show_used" value={@show_used}> <.toggle_button action="toggle_show_used" value={@show_used}>
<span class="title text-lg text-primary-600"> <span class="title text-lg text-primary-600">
<%= gettext("Show used") %> <%= gettext("Show used") %>
</span> </span>
</.toggle_button> </.toggle_button>
<.toggle_button action="toggle_table" value={@view_table}>
<span class="title text-lg text-primary-600">
<%= gettext("View as table") %>
</span>
</.toggle_button>
</div> </div>
<div> <div class="w-full p-4">
<%= if @ammo_groups |> Enum.empty?() do %> <%= if @ammo_groups |> Enum.empty?() do %>
<h2 class="mx-8 my-4 title text-lg text-primary-600"> <h2 class="px-4 title text-lg text-primary-600">
<%= gettext("No ammo for this type") %> <%= gettext("No ammo for this type") %>
<%= display_emoji("😔") %> <%= display_emoji("😔") %>
</h2> </h2>
<% else %> <% else %>
<div class="flex flex-wrap justify-center items-center"> <%= if @view_table do %>
<%= for ammo_group <- @ammo_groups do %> <.live_component
<.ammo_group_card ammo_group={ammo_group} show_container={true} /> module={CanneryWeb.Components.AmmoGroupTableComponent}
<% end %> id="ammo-type-show-table"
</div> ammo_groups={@ammo_groups}
current_user={@current_user}
>
<:container :let={%{container: %{name: container_name} = container}}>
<.link
navigate={Routes.container_show_path(Endpoint, :show, container)}
class="mx-2 my-1 link"
>
<%= container_name %>
</.link>
</:container>
</.live_component>
<% else %>
<div class="flex flex-wrap justify-center items-stretch">
<%= for ammo_group <- @ammo_groups do %>
<.ammo_group_card ammo_group={ammo_group} show_container={true} />
<% end %>
</div>
<% end %>
<% end %> <% end %>
</div> </div>
</div> </div>

View File

@ -6,11 +6,16 @@ defmodule CanneryWeb.ContainerLive.Index do
use CanneryWeb, :live_view use CanneryWeb, :live_view
import CanneryWeb.Components.ContainerCard import CanneryWeb.Components.ContainerCard
alias Cannery.{Containers, Containers.Container, Repo} alias Cannery.{Containers, Containers.Container, Repo}
alias CanneryWeb.{Components.TagCard, Endpoint}
alias Ecto.Changeset alias Ecto.Changeset
@impl true @impl true
def mount(_params, _session, socket), do: {:ok, socket |> assign(view_table: false)} def mount(%{"search" => search}, _session, socket) do
{:ok, socket |> assign(view_table: true, search: search) |> display_containers()}
end
def mount(_params, _session, socket) do
{:ok, socket |> assign(view_table: true, search: nil) |> display_containers()}
end
@impl true @impl true
def handle_params(params, _url, %{assigns: %{live_action: live_action}} = socket) do def handle_params(params, _url, %{assigns: %{live_action: live_action}} = socket) do
@ -21,7 +26,7 @@ defmodule CanneryWeb.ContainerLive.Index do
%{name: container_name} = %{name: container_name} =
container = container =
Containers.get_container!(id, current_user) Containers.get_container!(id, current_user)
|> Repo.preload([:tags, :ammo_groups], force: true) |> Repo.preload([:tags, :ammo_groups])
socket socket
|> assign(page_title: gettext("Edit %{name}", name: container_name), container: container) |> assign(page_title: gettext("Edit %{name}", name: container_name), container: container)
@ -42,19 +47,18 @@ defmodule CanneryWeb.ContainerLive.Index do
socket socket
|> assign( |> assign(
page_title: gettext("Containers"), page_title: gettext("Containers"),
container: nil container: nil,
search: nil
) )
|> display_containers()
end end
defp apply_action(socket, :table, _params) do defp apply_action(socket, :search, %{"search" => search}) do
socket socket
|> assign( |> assign(
page_title: gettext("Containers"), page_title: gettext("Containers"),
container: nil, container: nil,
view_table: true search: search
) )
|> display_containers()
end end
defp apply_action(%{assigns: %{current_user: current_user}} = socket, :edit_tags, %{"id" => id}) do defp apply_action(%{assigns: %{current_user: current_user}} = socket, :edit_tags, %{"id" => id}) do
@ -104,133 +108,24 @@ defmodule CanneryWeb.ContainerLive.Index do
@impl true @impl true
def handle_event("toggle_table", _params, %{assigns: %{view_table: view_table}} = socket) do def handle_event("toggle_table", _params, %{assigns: %{view_table: view_table}} = socket) do
new_path = {:noreply, socket |> assign(:view_table, !view_table) |> display_containers()}
if view_table,
do: Routes.container_index_path(Endpoint, :index),
else: Routes.container_index_path(Endpoint, :table)
{:noreply, socket |> assign(view_table: !view_table) |> push_patch(to: new_path)}
end end
defp display_containers(%{assigns: %{current_user: current_user}} = socket) do @impl true
def handle_event("search", %{"search" => %{"search_term" => ""}}, socket) do
{:noreply, socket |> push_patch(to: Routes.container_index_path(Endpoint, :index))}
end
def handle_event("search", %{"search" => %{"search_term" => search_term}}, socket) do
{:noreply,
socket |> push_patch(to: Routes.container_index_path(Endpoint, :search, search_term))}
end
defp display_containers(%{assigns: %{search: search, current_user: current_user}} = socket) do
containers = containers =
Containers.list_containers(current_user) |> Repo.preload([:tags, :ammo_groups], force: true) Containers.list_containers(search, current_user)
|> Repo.preload([:tags, :ammo_groups])
columns = socket |> assign(:containers, containers)
[
%{label: gettext("Name"), key: :name, type: :string},
%{label: gettext("Description"), key: :desc, type: :string},
%{label: gettext("Location"), key: :location, type: :string},
%{label: gettext("Type"), key: :type, type: :string},
%{label: gettext("Packs"), key: :packs, type: :integer},
%{label: gettext("Rounds"), key: :rounds, type: :string},
%{label: gettext("Tags"), key: :tags, type: :tags},
%{label: nil, key: :actions, sortable: false, type: :actions}
]
|> Enum.filter(fn %{key: key, type: type} ->
# remove columns if all values match defaults
default_value =
case type do
:boolean -> false
_other_type -> nil
end
containers
|> Enum.any?(fn container ->
type in [:tags, :actions] or not (container |> Map.get(key) == default_value)
end)
end)
rows =
containers
|> Enum.map(fn container -> container |> get_row_data_for_container(columns) end)
socket
|> assign(
containers: containers,
columns: columns,
rows: rows
)
end end
@spec get_row_data_for_container(Container.t(), [map()]) :: [map()]
defp get_row_data_for_container(container, columns) do
container = container |> Repo.preload([:ammo_groups, :tags])
columns
|> Enum.into(%{}, fn %{key: key} -> {key, get_value_for_key(key, container)} end)
end
@spec get_value_for_key(atom(), Container.t()) :: any()
defp get_value_for_key(:packs, container) do
container |> Containers.get_container_ammo_group_count!()
end
defp get_value_for_key(:rounds, container) do
container |> Containers.get_container_rounds!()
end
defp get_value_for_key(:tags, container) do
assigns = %{container: container}
{container.tags |> Enum.map(fn %{name: name} -> name end),
~H"""
<div class="flex flex-wrap justify-center items-center">
<%= unless @container.tags |> Enum.empty?() do %>
<%= for tag <- @container.tags do %>
<TagCard.simple_tag_card tag={tag} />
<% end %>
<% end %>
<div class="mx-4 my-2">
<.link
patch={Routes.container_index_path(Endpoint, :edit_tags, @container)}
class="text-primary-600 link"
>
<i class="fa-fw fa-lg fas fa-tags"></i>
</.link>
</div>
</div>
"""}
end
defp get_value_for_key(:actions, container) do
assigns = %{container: container}
~H"""
<.link
patch={Routes.container_index_path(Endpoint, :edit, @container)}
class="text-primary-600 link"
data-qa={"edit-#{@container.id}"}
>
<i class="fa-fw fa-lg fas fa-edit"></i>
</.link>
<.link
patch={Routes.container_index_path(Endpoint, :clone, @container)}
class="text-primary-600 link"
data-qa={"clone-#{@container.id}"}
>
<i class="fa-fw fa-lg fas fa-copy"></i>
</.link>
<.link
href="#"
class="text-primary-600 link"
phx-click="delete"
phx-value-id={@container.id}
data-confirm={
dgettext("prompts", "Are you sure you want to delete %{name}?", name: @container.name)
}
data-qa={"delete-#{@container.id}"}
>
<i class="fa-fw fa-lg fas fa-trash"></i>
</.link>
"""
end
defp get_value_for_key(key, container), do: container |> Map.get(key)
def return_to(true = _view_table), do: Routes.container_index_path(Endpoint, :table)
def return_to(false = _view_table), do: Routes.container_index_path(Endpoint, :index)
end end

View File

@ -3,7 +3,7 @@
<%= gettext("Containers") %> <%= gettext("Containers") %>
</h1> </h1>
<%= if @containers |> Enum.empty?() do %> <%= if @containers |> Enum.empty?() and @search |> is_nil() do %>
<h2 class="title text-xl text-primary-600"> <h2 class="title text-xl text-primary-600">
<%= gettext("No containers") %> <%= gettext("No containers") %>
<%= display_emoji("😔") %> <%= display_emoji("😔") %>
@ -17,7 +17,23 @@
<%= dgettext("actions", "New Container") %> <%= dgettext("actions", "New Container") %>
</.link> </.link>
<div class="flex flex-col justify-center items-center"> <div class="w-full flex flex-col sm:flex-row justify-center items-center space-y-4 sm:space-y-0 sm:space-x-4 max-w-xl">
<.form
:let={f}
for={:search}
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",
value: @search,
phx_debounce: 300,
placeholder: gettext("Search containers")
) %>
</.form>
<.toggle_button action="toggle_table" value={@view_table}> <.toggle_button action="toggle_table" value={@view_table}>
<span class="title text-lg text-primary-600"> <span class="title text-lg text-primary-600">
<%= gettext("View as table") %> <%= gettext("View as table") %>
@ -26,28 +42,31 @@
</div> </div>
<% end %> <% end %>
<div class="max-w-full flex flex-row flex-wrap justify-center items-center"> <%= if @containers |> Enum.empty?() do %>
<h2 class="title text-xl text-primary-600">
<%= gettext("No containers") %>
<%= display_emoji("😔") %>
</h2>
<% else %>
<%= if @view_table do %> <%= if @view_table do %>
<.live_component <.live_component
module={CanneryWeb.Components.TableComponent} module={CanneryWeb.Components.ContainerTableComponent}
id="containers_index_table" id="containers_index_table"
action={@live_action} action={@live_action}
columns={@columns} containers={@containers}
rows={@rows} current_user={@current_user}
/> >
<% else %> <:tag_actions :let={container}>
<%= for container <- @containers do %> <div class="mx-4 my-2">
<.container_card container={container}> <.link
<:tag_actions> patch={Routes.container_index_path(Endpoint, :edit_tags, container)}
<div class="mx-4 my-2"> class="text-primary-600 link"
<.link >
patch={Routes.container_index_path(Endpoint, :edit_tags, container)} <i class="fa-fw fa-lg fas fa-tags"></i>
class="text-primary-600 link" </.link>
> </div>
<i class="fa-fw fa-lg fas fa-tags"></i> </:tag_actions>
</.link> <:actions :let={container}>
</div>
</:tag_actions>
<.link <.link
patch={Routes.container_index_path(Endpoint, :edit, container)} patch={Routes.container_index_path(Endpoint, :edit, container)}
class="text-primary-600 link" class="text-primary-600 link"
@ -76,28 +95,75 @@
> >
<i class="fa-fw fa-lg fas fa-trash"></i> <i class="fa-fw fa-lg fas fa-trash"></i>
</.link> </.link>
</.container_card> </:actions>
<% end %> </.live_component>
<% else %>
<div class="w-full flex flex-row flex-wrap justify-center items-stretch">
<%= for container <- @containers do %>
<.container_card container={container}>
<:tag_actions>
<div class="mx-4 my-2">
<.link
patch={Routes.container_index_path(Endpoint, :edit_tags, container)}
class="text-primary-600 link"
>
<i class="fa-fw fa-lg fas fa-tags"></i>
</.link>
</div>
</:tag_actions>
<.link
patch={Routes.container_index_path(Endpoint, :edit, container)}
class="text-primary-600 link"
data-qa={"edit-#{container.id}"}
>
<i class="fa-fw fa-lg fas fa-edit"></i>
</.link>
<.link
patch={Routes.container_index_path(Endpoint, :clone, container)}
class="text-primary-600 link"
data-qa={"clone-#{container.id}"}
>
<i class="fa-fw fa-lg fas fa-copy"></i>
</.link>
<.link
href="#"
class="text-primary-600 link"
phx-click="delete"
phx-value-id={container.id}
data-confirm={
dgettext("prompts", "Are you sure you want to delete %{name}?",
name: container.name
)
}
data-qa={"delete-#{container.id}"}
>
<i class="fa-fw fa-lg fas fa-trash"></i>
</.link>
</.container_card>
<% end %>
</div>
<% end %> <% end %>
</div> <% end %>
</div> </div>
<%= if @live_action in [:new, :edit, :clone] do %> <%= if @live_action in [:new, :edit, :clone] do %>
<.modal return_to={return_to(@view_table)}> <.modal return_to={Routes.container_index_path(Endpoint, :index)}>
<.live_component <.live_component
module={CanneryWeb.ContainerLive.FormComponent} module={CanneryWeb.ContainerLive.FormComponent}
id={@container.id || :new} id={@container.id || :new}
title={@page_title} title={@page_title}
action={@live_action} action={@live_action}
container={@container} container={@container}
return_to={return_to(@view_table)} return_to={Routes.container_index_path(Endpoint, :index)}
current_user={@current_user} current_user={@current_user}
/> />
</.modal> </.modal>
<% end %> <% end %>
<%= if @live_action == :edit_tags do %> <%= if @live_action == :edit_tags do %>
<.modal return_to={return_to(@view_table)}> <.modal return_to={Routes.container_index_path(Endpoint, :index)}>
<.live_component <.live_component
module={CanneryWeb.ContainerLive.EditTagsComponent} module={CanneryWeb.ContainerLive.EditTagsComponent}
id={@container.id} id={@container.id}

View File

@ -11,15 +11,17 @@ defmodule CanneryWeb.ContainerLive.Show do
alias Phoenix.LiveView.Socket alias Phoenix.LiveView.Socket
@impl true @impl true
def mount(_params, _session, socket), do: {:ok, socket |> assign(show_used: false)} def mount(_params, _session, socket),
do: {:ok, socket |> assign(show_used: false, view_table: true)}
@impl true @impl true
def handle_params( def handle_params(%{"id" => id}, _session, %{assigns: %{current_user: current_user}} = socket) do
%{"id" => id}, socket =
_session, socket
%{assigns: %{current_user: current_user}} = socket |> assign(view_table: true)
) do |> render_container(id, current_user)
{:noreply, socket |> render_container(id, current_user)}
{:noreply, socket}
end end
@impl true @impl true
@ -87,6 +89,11 @@ defmodule CanneryWeb.ContainerLive.Show do
{:noreply, socket |> assign(:show_used, !show_used) |> render_container()} {:noreply, socket |> assign(:show_used, !show_used) |> render_container()}
end end
@impl true
def handle_event("toggle_table", _params, %{assigns: %{view_table: view_table}} = socket) do
{:noreply, socket |> assign(:view_table, !view_table) |> render_container()}
end
@spec render_container(Socket.t(), Container.id(), User.t()) :: Socket.t() @spec render_container(Socket.t(), Container.id(), User.t()) :: Socket.t()
defp render_container( defp render_container(
%{assigns: %{live_action: live_action, show_used: show_used}} = socket, %{assigns: %{live_action: live_action, show_used: show_used}} = socket,
@ -102,7 +109,7 @@ defmodule CanneryWeb.ContainerLive.Show do
page_title = page_title =
case live_action do case live_action do
:show -> gettext("Show %{name}", name: container_name) action when action in [:show, :table] -> container_name
:edit -> gettext("Edit %{name}", name: container_name) :edit -> gettext("Edit %{name}", name: container_name)
:edit_tags -> gettext("Edit %{name} tags", name: container_name) :edit_tags -> gettext("Edit %{name} tags", name: container_name)
end end

View File

@ -24,12 +24,20 @@
<%= unless @ammo_groups |> Enum.empty?() do %> <%= unless @ammo_groups |> Enum.empty?() do %>
<span class="rounded-lg title text-lg"> <span class="rounded-lg title text-lg">
<%= gettext("Packs:") %> <%= if @show_used do %>
<%= gettext("Total packs:") %>
<% else %>
<%= gettext("Packs:") %>
<% end %>
<%= Enum.count(@ammo_groups) %> <%= Enum.count(@ammo_groups) %>
</span> </span>
<span class="rounded-lg title text-lg"> <span class="rounded-lg title text-lg">
<%= gettext("Rounds:") %> <%= if @show_used do %>
<%= gettext("Total rounds:") %>
<% else %>
<%= gettext("Rounds:") %>
<% end %>
<%= @container |> Containers.get_container_rounds!() %> <%= @container |> Containers.get_container_rounds!() %>
</span> </span>
<% end %> <% end %>
@ -91,25 +99,46 @@
<hr class="mb-4 hr" /> <hr class="mb-4 hr" />
<div class="flex flex-col justify-center items-center"> <div class="flex justify-center items-center space-x-4">
<.toggle_button action="toggle_show_used" value={@show_used}> <.toggle_button action="toggle_show_used" value={@show_used}>
<span class="title text-lg text-primary-600"> <span class="title text-lg text-primary-600">
<%= dgettext("actions", "Show used") %> <%= gettext("Show used") %>
</span>
</.toggle_button>
<.toggle_button action="toggle_table" value={@view_table}>
<span class="title text-lg text-primary-600">
<%= gettext("View as table") %>
</span> </span>
</.toggle_button> </.toggle_button>
</div> </div>
<div> <div class="w-full p-4">
<%= if @ammo_groups |> Enum.empty?() do %> <%= if @ammo_groups |> Enum.empty?() do %>
<h2 class="mx-8 my-4 title text-lg text-primary-600"> <h2 class="mx-4 title text-lg text-primary-600 text-center">
<%= gettext("No ammo in this container") %> <%= gettext("No ammo in this container") %>
</h2> </h2>
<% else %> <% else %>
<div class="flex flex-wrap justify-center items-center"> <%= if @view_table do %>
<%= for ammo_group <- @ammo_groups do %> <.live_component
<.ammo_group_card ammo_group={ammo_group} /> module={CanneryWeb.Components.AmmoGroupTableComponent}
<% end %> id="ammo-type-show-table"
</div> ammo_groups={@ammo_groups}
current_user={@current_user}
>
<:ammo_type :let={%{name: ammo_type_name} = ammo_type}>
<.link navigate={Routes.ammo_type_show_path(Endpoint, :show, ammo_type)} class="link">
<%= ammo_type_name %>
</.link>
</:ammo_type>
</.live_component>
<% else %>
<div class="flex flex-wrap justify-center items-stretch">
<%= for ammo_group <- @ammo_groups do %>
<.ammo_group_card ammo_group={ammo_group} />
<% end %>
</div>
<% end %>
<% end %> <% end %>
</div> </div>
</div> </div>

View File

@ -7,32 +7,15 @@ defmodule CanneryWeb.HomeLive do
alias Cannery.Accounts alias Cannery.Accounts
alias CanneryWeb.Endpoint alias CanneryWeb.Endpoint
@version Mix.Project.config()[:version]
@impl true @impl true
def mount(_params, _session, socket) do def mount(_params, _session, socket) do
admins = Accounts.list_users_by_role(:admin) admins = Accounts.list_users_by_role(:admin)
socket = socket |> assign(page_title: "Home", query: "", results: %{}, admins: admins) socket = socket |> assign(page_title: gettext("Home"), admins: admins, version: @version)
{:ok, socket} {:ok, socket}
end end
@impl true
def handle_event("suggest", %{"q" => query}, socket) do
{:noreply, socket |> assign(results: search(query), query: query)}
end
@impl true
def handle_event("search", %{"q" => query}, socket) do
case search(query) do
%{^query => vsn} ->
{:noreply, redirect(socket, external: "https://hexdocs.pm/#{query}/#{vsn}")}
_no_query ->
{:noreply,
socket
|> put_flash(:error, "No dependencies found matching \"#{query}\"")
|> assign(results: %{}, query: query)}
end
end
@impl true @impl true
def render(assigns) do def render(assigns) do
~H""" ~H"""
@ -138,7 +121,9 @@ defmodule CanneryWeb.HomeLive do
target="_blank" target="_blank"
rel="noopener noreferrer" rel="noopener noreferrer"
> >
<p>0.6.0</p> <p>
<%= @version %>
</p>
<i class="fas fa-md fa-info-circle"></i> <i class="fas fa-md fa-info-circle"></i>
</.link> </.link>
</li> </li>
@ -188,16 +173,4 @@ defmodule CanneryWeb.HomeLive do
</div> </div>
""" """
end end
defp search(query) do
if not CanneryWeb.Endpoint.config(:code_reloader) do
raise "action disabled when not in development"
end
for {app, desc, vsn} <- Application.started_applications(),
app = to_string(app),
String.starts_with?(app, query) and not List.starts_with?(desc, ~c"ERTS"),
into: %{},
do: {app, vsn}
end
end end

View File

@ -38,7 +38,7 @@ defmodule CanneryWeb.InviteLive.FormComponent do
changeset = changeset =
case action do case action do
:new -> invite |> Invite.create_changeset(user, "example_token", invite_params) :new -> Invite.create_changeset(user, "example_token", invite_params)
:edit -> invite |> Invite.update_changeset(invite_params) :edit -> invite |> Invite.update_changeset(invite_params)
end end

View File

@ -18,7 +18,7 @@
</.link> </.link>
<% end %> <% end %>
<div class="w-full flex flex-row flex-wrap justify-center items-center"> <div class="w-full flex flex-row flex-wrap justify-center items-stretch">
<%= for invite <- @invites do %> <%= for invite <- @invites do %>
<.invite_card invite={invite}> <.invite_card invite={invite}>
<:code_actions> <:code_actions>
@ -91,7 +91,7 @@
<%= gettext("Admins") %> <%= gettext("Admins") %>
</h1> </h1>
<div class="w-full flex flex-row flex-wrap justify-center items-center"> <div class="w-full flex flex-row flex-wrap justify-center items-stretch">
<%= for admin <- @admins do %> <%= for admin <- @admins do %>
<.user_card user={admin}> <.user_card user={admin}>
<.link <.link
@ -121,7 +121,7 @@
<%= gettext("Users") %> <%= gettext("Users") %>
</h1> </h1>
<div class="w-full flex flex-row flex-wrap justify-center items-center"> <div class="w-full flex flex-row flex-wrap justify-center items-stretch">
<%= for user <- @users do %> <%= for user <- @users do %>
<.user_card user={user}> <.user_card user={user}>
<.link <.link

View File

@ -72,10 +72,57 @@ defmodule CanneryWeb.LiveHelpers do
""" """
end end
def hide_modal(js \\ %JS{}) do defp hide_modal(js \\ %JS{}) do
js js
|> JS.hide(to: "#modal", transition: "fade-out") |> JS.hide(to: "#modal", transition: "fade-out")
|> JS.hide(to: "#modal-bg", transition: "fade-out") |> JS.hide(to: "#modal-bg", transition: "fade-out")
|> JS.hide(to: "#modal-content", transition: "fade-out-scale") |> JS.hide(to: "#modal-content", transition: "fade-out-scale")
end end
@doc """
A toggle button element that can be directed to a liveview or a
live_component's `handle_event/3`.
## Examples
<.toggle_button action="my_liveview_action" value={@some_value}>
<span>Toggle me!</span>
</.toggle_button>
<.toggle_button action="my_live_component_action" target={@myself} value={@some_value}>
<span>Whatever you want</span>
</.toggle_button>
"""
def toggle_button(assigns) do
assigns = assigns |> assign_new(:id, fn -> assigns.action end)
~H"""
<label for={@id} class="inline-flex relative items-center cursor-pointer">
<input
id={@id}
type="checkbox"
value={@value}
checked={@value}
class="sr-only peer"
data-qa={@id}
{
if assigns |> Map.has_key?(:target),
do: %{"phx-click" => @action, "phx-value-value" => @value, "phx-target" => @target},
else: %{"phx-click" => @action, "phx-value-value" => @value}
}
/>
<div class="w-11 h-6 bg-gray-300 rounded-full peer
peer-focus:ring-4 peer-focus:ring-teal-300 dark:peer-focus:ring-teal-800
peer-checked:bg-gray-600
peer-checked:after:translate-x-full peer-checked:after:border-white
after:content-[''] after:absolute after:top-1 after:left-[2px] after:bg-white after:border-gray-300
after:border after:rounded-full after:h-5 after:w-5
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">
<%= render_slot(@inner_block) %>
</span>
</label>
"""
end
end end

View File

@ -33,7 +33,7 @@
) %> ) %>
<%= error_tag(f, :notes, "col-span-3") %> <%= error_tag(f, :notes, "col-span-3") %>
<%= label(f, :date, gettext("Date (UTC)"), class: "title text-lg text-primary-600") %> <%= label(f, :date, gettext("Date"), class: "title text-lg text-primary-600") %>
<%= date_input(f, :date, class: "input input-primary col-span-2") %> <%= date_input(f, :date, class: "input input-primary col-span-2") %>
<%= error_tag(f, :notes, "col-span-3") %> <%= error_tag(f, :notes, "col-span-3") %>

View File

@ -10,7 +10,13 @@ defmodule CanneryWeb.RangeLive.Index do
alias Phoenix.LiveView.Socket alias Phoenix.LiveView.Socket
@impl true @impl true
def mount(_params, _session, socket), do: {:ok, socket |> display_shot_groups()} def mount(%{"search" => search}, _session, socket) do
{:ok, socket |> assign(search: search) |> display_shot_groups()}
end
def mount(_params, _session, socket) do
{:ok, socket |> assign(search: nil) |> display_shot_groups()}
end
@impl true @impl true
def handle_params(params, _url, %{assigns: %{live_action: live_action}} = socket) do def handle_params(params, _url, %{assigns: %{live_action: live_action}} = socket) do
@ -23,26 +29,46 @@ defmodule CanneryWeb.RangeLive.Index do
%{"id" => id} %{"id" => id}
) do ) do
socket socket
|> assign(:page_title, gettext("Record Shots")) |> assign(
|> assign(:ammo_group, Ammo.get_ammo_group!(id, current_user)) page_title: gettext("Record Shots"),
ammo_group: Ammo.get_ammo_group!(id, current_user)
)
end end
defp apply_action(%{assigns: %{current_user: current_user}} = socket, :edit, %{"id" => id}) do defp apply_action(%{assigns: %{current_user: current_user}} = socket, :edit, %{"id" => id}) do
socket socket
|> assign(:page_title, gettext("Edit Shot Records")) |> assign(
|> assign(:shot_group, ActivityLog.get_shot_group!(id, current_user)) page_title: gettext("Edit Shot Records"),
shot_group: ActivityLog.get_shot_group!(id, current_user)
)
end end
defp apply_action(socket, :new, _params) do defp apply_action(socket, :new, _params) do
socket socket
|> assign(:page_title, gettext("New Shot Records")) |> assign(
|> assign(:shot_group, %ShotGroup{}) page_title: gettext("New Shot Records"),
shot_group: %ShotGroup{}
)
end end
defp apply_action(socket, :index, _params) do defp apply_action(socket, :index, _params) do
socket socket
|> assign(:page_title, gettext("Shot Records")) |> assign(
|> assign(:shot_group, nil) page_title: gettext("Shot Records"),
search: nil,
shot_group: nil
)
|> display_shot_groups()
end
defp apply_action(socket, :search, %{"search" => search}) do
socket
|> assign(
page_title: gettext("Shot Records"),
search: search,
shot_group: nil
)
|> display_shot_groups()
end end
@impl true @impl true
@ -55,6 +81,7 @@ defmodule CanneryWeb.RangeLive.Index do
{:noreply, socket |> put_flash(:info, prompt) |> display_shot_groups()} {:noreply, socket |> put_flash(:info, prompt) |> display_shot_groups()}
end end
@impl true
def handle_event( def handle_event(
"toggle_staged", "toggle_staged",
%{"ammo_group_id" => ammo_group_id}, %{"ammo_group_id" => ammo_group_id},
@ -69,131 +96,46 @@ defmodule CanneryWeb.RangeLive.Index do
{:noreply, socket |> put_flash(:info, prompt) |> display_shot_groups()} {:noreply, socket |> put_flash(:info, prompt) |> display_shot_groups()}
end end
@impl true
def handle_event("search", %{"search" => %{"search_term" => ""}}, socket) do
{:noreply, socket |> push_patch(to: Routes.range_index_path(Endpoint, :index))}
end
def handle_event("search", %{"search" => %{"search_term" => search_term}}, socket) do
{:noreply, socket |> push_patch(to: Routes.range_index_path(Endpoint, :search, search_term))}
end
@spec display_shot_groups(Socket.t()) :: Socket.t() @spec display_shot_groups(Socket.t()) :: Socket.t()
defp display_shot_groups(%{assigns: %{current_user: current_user}} = socket) do defp display_shot_groups(%{assigns: %{search: search, current_user: current_user}} = socket) do
shot_groups = shot_groups =
ActivityLog.list_shot_groups(current_user) |> Repo.preload(ammo_group: :ammo_type) ActivityLog.list_shot_groups(search, current_user)
|> Repo.preload(ammo_group: :ammo_type)
ammo_groups = Ammo.list_staged_ammo_groups(current_user) ammo_groups = Ammo.list_staged_ammo_groups(current_user)
chart_data = shot_groups |> get_chart_data_for_shot_group()
columns = [
%{label: gettext("Ammo"), key: :name},
%{label: gettext("Rounds shot"), key: :count},
%{label: gettext("Notes"), key: :notes},
%{label: gettext("Date"), key: :date},
%{label: nil, key: :actions, sortable: false}
]
rows =
shot_groups
|> Enum.map(fn shot_group -> shot_group |> get_row_data_for_shot_group(columns) end)
chart_data =
shot_groups
|> Enum.map(fn shot_group ->
shot_group
|> get_chart_data_for_shot_group([:name, :count, :notes, :date])
end)
|> Enum.sort_by(fn %{date: date} -> date end, Date)
socket socket
|> assign( |> assign(
ammo_groups: ammo_groups, ammo_groups: ammo_groups,
columns: columns,
rows: rows,
chart_data: chart_data, chart_data: chart_data,
shot_groups: shot_groups shot_groups: shot_groups
) )
end end
@spec get_chart_data_for_shot_group(ShotGroup.t(), keys :: [atom()]) :: map() @spec get_chart_data_for_shot_group([ShotGroup.t()]) :: [map()]
defp get_chart_data_for_shot_group(shot_group, keys) do defp get_chart_data_for_shot_group(shot_groups) do
shot_group = shot_group |> Repo.preload(ammo_group: :ammo_type) shot_groups
|> Repo.preload(ammo_group: :ammo_type)
|> Enum.group_by(fn %{date: date} -> date end, fn %{count: count} -> count end)
|> Enum.map(fn {date, rounds} ->
sum = Enum.sum(rounds)
labels = %{
if shot_group.notes do date: date,
[gettext("Notes: %{notes}", notes: shot_group.notes)] count: sum,
else label: gettext("Rounds shot: %{count}", count: sum)
[] }
end
labels = [
gettext(
"Name: %{name}",
name: shot_group.ammo_group.ammo_type.name
),
gettext(
"Rounds shot: %{count}",
count: shot_group.count
)
| labels
]
keys
|> Map.new(fn key ->
value =
case key do
:name -> shot_group.ammo_group.ammo_type.name
key -> shot_group |> Map.get(key)
end
{key, value}
end)
|> Map.put(:labels, labels)
end
@spec get_row_data_for_shot_group(ShotGroup.t(), [map()]) :: map()
defp get_row_data_for_shot_group(%{date: date} = shot_group, columns) do
shot_group = shot_group |> Repo.preload(ammo_group: :ammo_type)
assigns = %{shot_group: shot_group}
columns
|> Map.new(fn %{key: key} ->
value =
case key do
:name ->
{shot_group.ammo_group.ammo_type.name,
~H"""
<.link
navigate={Routes.ammo_group_show_path(Endpoint, :show, @shot_group.ammo_group)}
class="link"
>
<%= @shot_group.ammo_group.ammo_type.name %>
</.link>
"""}
:date ->
date |> display_date()
:actions ->
~H"""
<div class="px-4 py-2 space-x-4 flex justify-center items-center">
<.link
patch={Routes.range_index_path(Endpoint, :edit, @shot_group)}
class="text-primary-600 link"
data-qa={"edit-#{@shot_group.id}"}
>
<i class="fa-fw fa-lg fas fa-edit"></i>
</.link>
<.link
href="#"
class="text-primary-600 link"
phx-click="delete"
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}"}
>
<i class="fa-fw fa-lg fas fa-trash"></i>
</.link>
</div>
"""
key ->
shot_group |> Map.get(key)
end
{key, value}
end) end)
|> Enum.sort_by(fn %{date: date} -> date end, Date)
end end
end end

View File

@ -17,33 +17,35 @@
<%= dgettext("actions", "Stage ammo") %> <%= dgettext("actions", "Stage ammo") %>
</.link> </.link>
<%= for ammo_group <- @ammo_groups do %> <div class="w-full flex flex-row flex-wrap justify-center items-stretch">
<.ammo_group_card ammo_group={ammo_group}> <%= for ammo_group <- @ammo_groups do %>
<button <.ammo_group_card ammo_group={ammo_group}>
type="button" <button
class="btn btn-primary" type="button"
phx-click="toggle_staged" class="btn btn-primary"
phx-value-ammo_group_id={ammo_group.id} phx-click="toggle_staged"
data-confirm={"#{dgettext("prompts", "Are you sure you want to unstage this ammo?")}"} 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: dgettext("actions", "Unstage from range"), <%= if ammo_group.staged,
else: dgettext("actions", "Stage for range") %> do: dgettext("actions", "Unstage from range"),
</button> else: dgettext("actions", "Stage for range") %>
</button>
<.link <.link
patch={Routes.range_index_path(Endpoint, :add_shot_group, ammo_group)} patch={Routes.range_index_path(Endpoint, :add_shot_group, ammo_group)}
class="btn btn-primary" class="btn btn-primary"
> >
<%= dgettext("actions", "Record shots") %> <%= dgettext("actions", "Record shots") %>
</.link> </.link>
</.ammo_group_card> </.ammo_group_card>
<% end %> <% end %>
</div>
<% end %> <% end %>
<hr class="hr" /> <hr class="hr" />
<%= if @shot_groups |> Enum.empty?() do %> <%= if @shot_groups |> Enum.empty?() and @search |> is_nil() do %>
<h1 class="title text-xl text-primary-600"> <h1 class="title text-xl text-primary-600">
<%= gettext("No shots recorded") %> <%= gettext("No shots recorded") %>
<%= display_emoji("😔") %> <%= display_emoji("😔") %>
@ -59,22 +61,70 @@
phx-update="ignore" phx-update="ignore"
class="max-h-72" class="max-h-72"
data-chart-data={Jason.encode!(@chart_data)} data-chart-data={Jason.encode!(@chart_data)}
data-label={gettext("Rounds fired")} data-label={gettext("Rounds shot")}
data-color={random_color()} data-color={random_color()}
aria-label={gettext("Rounds fired chart")} aria-label={gettext("Rounds shot chart")}
role="img" role="img"
> >
<%= dgettext("errors", "Your browser does not support the canvas element.") %> <%= dgettext("errors", "Your browser does not support the canvas element.") %>
</canvas> </canvas>
<.live_component <div class="w-full flex flex-col sm:flex-row justify-center items-center space-y-4 sm:space-y-0 sm:space-x-4 max-w-xl">
module={CanneryWeb.Components.TableComponent} <.form
id="shot_groups_index_table" :let={f}
columns={@columns} for={:search}
rows={@rows} phx-change="search"
initial_key={:date} phx-submit="search"
initial_sort_mode={:desc} class="grow self-stretch flex flex-col items-stretch"
/> data-qa="shot_group_search"
>
<%= text_input(f, :search_term,
class: "input input-primary",
value: @search,
phx_debounce: 300,
placeholder: gettext("Search shot records")
) %>
</.form>
</div>
<%= if @shot_groups |> Enum.empty?() do %>
<h1 class="title text-xl text-primary-600">
<%= gettext("No shots recorded") %>
<%= display_emoji("😔") %>
</h1>
<% else %>
<.live_component
module={CanneryWeb.Components.ShotGroupTableComponent}
id="shot_groups_index_table"
shot_groups={@shot_groups}
current_user={@current_user}
>
<:actions :let={shot_group}>
<div class="px-4 py-2 space-x-4 flex justify-center items-center">
<.link
patch={Routes.range_index_path(Endpoint, :edit, shot_group)}
class="text-primary-600 link"
data-qa={"edit-#{shot_group.id}"}
>
<i class="fa-fw fa-lg fas fa-edit"></i>
</.link>
<.link
href="#"
class="text-primary-600 link"
phx-click="delete"
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}"}
>
<i class="fa-fw fa-lg fas fa-trash"></i>
</.link>
</div>
</:actions>
</.live_component>
<% end %>
<% end %> <% end %>
</div> </div>

View File

@ -9,27 +9,53 @@ defmodule CanneryWeb.TagLive.Index do
alias CanneryWeb.{Endpoint, ViewHelpers} alias CanneryWeb.{Endpoint, ViewHelpers}
@impl true @impl true
def mount(_params, _session, socket), do: {:ok, socket |> display_tags()} def mount(%{"search" => search}, _session, socket) do
{:ok, socket |> assign(:search, search) |> display_tags()}
end
def mount(_params, _session, socket) do
{:ok, socket |> assign(:search, nil) |> display_tags()}
end
@impl true @impl true
def handle_params(params, _url, %{assigns: %{live_action: live_action}} = socket) do def handle_params(params, _url, %{assigns: %{live_action: live_action}} = socket) do
{:noreply, apply_action(socket, live_action, params) |> display_tags} {:noreply, apply_action(socket, live_action, params)}
end end
defp apply_action(%{assigns: %{current_user: current_user}} = socket, :edit, %{"id" => id}) do defp apply_action(%{assigns: %{current_user: current_user}} = socket, :edit, %{"id" => id}) do
socket socket
|> assign(:page_title, gettext("Edit Tag")) |> assign(
|> assign(:tag, Tags.get_tag!(id, current_user)) page_title: gettext("Edit Tag"),
tag: Tags.get_tag!(id, current_user)
)
end end
defp apply_action(socket, :new, _params) do defp apply_action(socket, :new, _params) do
socket socket
|> assign(:page_title, gettext("New Tag")) |> assign(
|> assign(:tag, %Tag{bg_color: ViewHelpers.random_color(), text_color: "#ffffff"}) page_title: gettext("New Tag"),
tag: %Tag{bg_color: ViewHelpers.random_color(), text_color: "#ffffff"}
)
end end
defp apply_action(socket, :index, _params) do defp apply_action(socket, :index, _params) do
socket |> assign(:page_title, gettext("Tags")) |> assign(:tag, nil) socket
|> assign(
page_title: gettext("Tags"),
search: nil,
tag: nil
)
|> display_tags()
end
defp apply_action(socket, :search, %{"search" => search}) do
socket
|> assign(
page_title: gettext("Tags"),
search: search,
tag: nil
)
|> display_tags()
end end
@impl true @impl true
@ -39,7 +65,16 @@ defmodule CanneryWeb.TagLive.Index do
{:noreply, socket |> put_flash(:info, prompt) |> display_tags()} {:noreply, socket |> put_flash(:info, prompt) |> display_tags()}
end end
defp display_tags(%{assigns: %{current_user: current_user}} = socket) do @impl true
socket |> assign(tags: Tags.list_tags(current_user)) def handle_event("search", %{"search" => %{"search_term" => ""}}, socket) do
{:noreply, socket |> push_patch(to: Routes.tag_index_path(Endpoint, :index))}
end
def handle_event("search", %{"search" => %{"search_term" => search_term}}, socket) do
{:noreply, socket |> push_patch(to: Routes.tag_index_path(Endpoint, :search, search_term))}
end
defp display_tags(%{assigns: %{search: search, current_user: current_user}} = socket) do
socket |> assign(tags: Tags.list_tags(search, current_user))
end end
end end

View File

@ -5,7 +5,7 @@
<p class="title text-md text-primary-600"> <p class="title text-md text-primary-600">
<%= gettext("Tags can be added to your containers to help you organize") %> <%= gettext("Tags can be added to your containers to help you organize") %>
</p> </p>
<%= if @tags |> Enum.empty?() do %> <%= if @tags |> Enum.empty?() and @search |> is_nil() do %>
<h2 class="title text-xl text-primary-600"> <h2 class="title text-xl text-primary-600">
<%= gettext("No tags") %> <%= gettext("No tags") %>
<%= display_emoji("😔") %> <%= display_emoji("😔") %>
@ -19,32 +19,58 @@
<%= dgettext("actions", "New Tag") %> <%= dgettext("actions", "New Tag") %>
</.link> </.link>
<% end %> <% end %>
<div class="flex flex-row flex-wrap justify-center items-center">
<%= for tag <- @tags do %>
<.tag_card tag={tag}>
<.link
patch={Routes.tag_index_path(Endpoint, :edit, tag)}
class="text-primary-600 link"
data-qa={"edit-#{tag.id}"}
>
<i class="fa-fw fa-lg fas fa-edit"></i>
</.link>
<.link <div class="w-full flex flex-col sm:flex-row justify-center items-center space-y-4 sm:space-y-0 sm:space-x-4 max-w-xl">
href="#" <.form
class="text-primary-600 link" :let={f}
phx-click="delete" for={:search}
phx-value-id={tag.id} phx-change="search"
data-confirm={ phx-submit="search"
dgettext("prompts", "Are you sure you want to delete %{name}?", name: tag.name) class="grow self-stretch flex flex-col items-stretch"
} data-qa="tag_search"
data-qa={"delete-#{tag.id}"} >
> <%= text_input(f, :search_term,
<i class="fa-fw fa-lg fas fa-trash"></i> class: "input input-primary",
</.link> value: @search,
</.tag_card> phx_debounce: 300,
<% end %> placeholder: gettext("Search tags")
) %>
</.form>
</div> </div>
<%= if @tags |> Enum.empty?() do %>
<h2 class="title text-xl text-primary-600">
<%= gettext("No tags") %>
<%= display_emoji("😔") %>
</h2>
<% else %>
<div class="flex flex-row flex-wrap justify-center items-stretch">
<%= for tag <- @tags do %>
<.tag_card tag={tag}>
<.link
patch={Routes.tag_index_path(Endpoint, :edit, tag)}
class="text-primary-600 link"
data-qa={"edit-#{tag.id}"}
>
<i class="fa-fw fa-lg fas fa-edit"></i>
</.link>
<.link
href="#"
class="text-primary-600 link"
phx-click="delete"
phx-value-id={tag.id}
data-confirm={
dgettext("prompts", "Are you sure you want to delete %{name}?", name: tag.name)
}
data-qa={"delete-#{tag.id}"}
>
<i class="fa-fw fa-lg fas fa-trash"></i>
</.link>
</.tag_card>
<% end %>
</div>
<% end %>
</div> </div>
<%= if @live_action in [:new, :edit] do %> <%= if @live_action in [:new, :edit] do %>

View File

@ -11,15 +11,17 @@ defmodule CanneryWeb.Router do
plug :protect_from_forgery plug :protect_from_forgery
plug :put_secure_browser_headers plug :put_secure_browser_headers
plug :fetch_current_user plug :fetch_current_user
plug :put_user_locale, default: Application.compile_env(:gettext, :default_locale, "en_US") plug :put_user_locale
end end
defp put_user_locale(%{assigns: %{current_user: %{locale: locale}}} = conn, default: default) do defp put_user_locale(%{assigns: %{current_user: %{locale: locale}}} = conn, _opts) do
default = Application.fetch_env!(:gettext, :default_locale)
Gettext.put_locale(locale || default) Gettext.put_locale(locale || default)
conn |> put_session(:locale, locale || default) conn |> put_session(:locale, locale || default)
end end
defp put_user_locale(conn, default: default) do defp put_user_locale(conn, _opts) do
default = Application.fetch_env!(:gettext, :default_locale)
Gettext.put_locale(default) Gettext.put_locale(default)
conn |> put_session(:locale, default) conn |> put_session(:locale, default)
end end
@ -64,43 +66,48 @@ defmodule CanneryWeb.Router do
live "/tags", TagLive.Index, :index live "/tags", TagLive.Index, :index
live "/tags/new", TagLive.Index, :new live "/tags/new", TagLive.Index, :new
live "/tags/:id/edit", TagLive.Index, :edit live "/tags/edit/:id", TagLive.Index, :edit
live "/tags/search/:search", TagLive.Index, :search
live "/catalog", AmmoTypeLive.Index, :index live "/catalog", AmmoTypeLive.Index, :index
live "/catalog/new", AmmoTypeLive.Index, :new live "/catalog/new", AmmoTypeLive.Index, :new
live "/catalog/:id/clone", AmmoTypeLive.Index, :clone live "/catalog/clone/:id", AmmoTypeLive.Index, :clone
live "/catalog/:id/edit", AmmoTypeLive.Index, :edit live "/catalog/edit/:id", AmmoTypeLive.Index, :edit
live "/catalog/search/:search", AmmoTypeLive.Index, :search
live "/catalog/:id", AmmoTypeLive.Show, :show live "/type/:id", AmmoTypeLive.Show, :show
live "/catalog/:id/show/edit", AmmoTypeLive.Show, :edit live "/type/:id/edit", AmmoTypeLive.Show, :edit
live "/type/:id/table", AmmoTypeLive.Show, :table
live "/containers", ContainerLive.Index, :index live "/containers", ContainerLive.Index, :index
live "/containers/table", ContainerLive.Index, :table
live "/containers/new", ContainerLive.Index, :new live "/containers/new", ContainerLive.Index, :new
live "/containers/:id/edit", ContainerLive.Index, :edit live "/containers/edit/:id", ContainerLive.Index, :edit
live "/containers/:id/clone", ContainerLive.Index, :clone live "/containers/clone/:id", ContainerLive.Index, :clone
live "/containers/:id/edit_tags", ContainerLive.Index, :edit_tags live "/containers/edit_tags/:id", ContainerLive.Index, :edit_tags
live "/containers/search/:search", ContainerLive.Index, :search
live "/containers/:id", ContainerLive.Show, :show live "/container/:id", ContainerLive.Show, :show
live "/containers/:id/show/edit", ContainerLive.Show, :edit live "/container/edit/:id", ContainerLive.Show, :edit
live "/containers/:id/show/edit_tags", ContainerLive.Show, :edit_tags live "/container/edit_tags/:id", ContainerLive.Show, :edit_tags
live "/ammo", AmmoGroupLive.Index, :index live "/ammo", AmmoGroupLive.Index, :index
live "/ammo/new", AmmoGroupLive.Index, :new live "/ammo/new", AmmoGroupLive.Index, :new
live "/ammo/:id/edit", AmmoGroupLive.Index, :edit live "/ammo/edit/:id", AmmoGroupLive.Index, :edit
live "/ammo/:id/clone", AmmoGroupLive.Index, :clone live "/ammo/clone/:id", AmmoGroupLive.Index, :clone
live "/ammo/:id/add_shot_group", AmmoGroupLive.Index, :add_shot_group live "/ammo/add_shot_group/:id", AmmoGroupLive.Index, :add_shot_group
live "/ammo/:id/move", AmmoGroupLive.Index, :move live "/ammo/move/:id", AmmoGroupLive.Index, :move
live "/ammo/search/:search", AmmoGroupLive.Index, :search
live "/ammo/:id", AmmoGroupLive.Show, :show live "/ammo/show/:id", AmmoGroupLive.Show, :show
live "/ammo/:id/show/edit", AmmoGroupLive.Show, :edit live "/ammo/show/edit/:id", AmmoGroupLive.Show, :edit
live "/ammo/:id/show/add_shot_group", AmmoGroupLive.Show, :add_shot_group live "/ammo/show/add_shot_group/:id", AmmoGroupLive.Show, :add_shot_group
live "/ammo/:id/show/move", AmmoGroupLive.Show, :move live "/ammo/show/move/:id", AmmoGroupLive.Show, :move
live "/ammo/:id/show/:shot_group_id/edit", AmmoGroupLive.Show, :edit_shot_group live "/ammo/show/:id/edit/:shot_group_id", AmmoGroupLive.Show, :edit_shot_group
live "/range", RangeLive.Index, :index live "/range", RangeLive.Index, :index
live "/range/:id/edit", RangeLive.Index, :edit live "/range/edit/:id", RangeLive.Index, :edit
live "/range/:id/add_shot_group", RangeLive.Index, :add_shot_group live "/range/add_shot_group/:id", RangeLive.Index, :add_shot_group
live "/range/search/:search", RangeLive.Index, :search
end end
scope "/", CanneryWeb do scope "/", CanneryWeb do

View File

@ -1,4 +1,4 @@
<main class="mb-8 min-w-full"> <main class="pb-8 min-w-full">
<header> <header>
<.topbar current_user={assigns[:current_user]}></.topbar> <.topbar current_user={assigns[:current_user]}></.topbar>
@ -27,28 +27,16 @@
</div> </div>
</main> </main>
<div
id="loading"
class="fixed opacity-0 top-0 left-0 w-screen h-screen bg-white z-50
flex flex-col justify-center items-center space-y-4
transition-opacity ease-in-out duration-500"
>
<h1 class="title text-2xl title-primary-500">
<%= gettext("Loading...") %>
</h1>
<i class="fas fa-3x fa-spin fa-gear"></i>
</div>
<div <div
id="disconnect" id="disconnect"
class="fixed opacity-0 top-0 left-0 w-screen h-screen bg-white z-50 class="z-50 fixed opacity-0 bottom-12 right-12 px-8 py-4 w-max h-max
flex flex-col justify-center items-center space-y-4 border border-primary-200 shadow-lg rounded-lg bg-white
transition-opacity ease-in-out duration-500" flex justify-center items-center space-x-4
transition-opacity ease-in-out duration-500 delay-[2000ms]"
> >
<h1 class="title text-2xl title-primary-500"> <i class="fas fa-fade text-md fa-satellite-dish"></i>
<h1 class="title text-md title-primary-500">
<%= gettext("Reconnecting...") %> <%= gettext("Reconnecting...") %>
</h1> </h1>
<i class="fas fa-3x fa-fade fa-satellite-dish"></i>
</div> </div>

View File

@ -10,8 +10,8 @@
type="image/jpg" type="image/jpg"
href={Routes.static_path(@conn, "/images/cannery.svg")} href={Routes.static_path(@conn, "/images/cannery.svg")}
/> />
<.live_title suffix=" | Cannery"> <.live_title suffix={" | #{gettext("Cannery")}"}>
<%= assigns[:page_title] || "Cannery" %> <%= assigns[:page_title] || gettext("Cannery") %>
</.live_title> </.live_title>
<link phx-track-static rel="stylesheet" href={Routes.static_path(@conn, "/css/app.css")} /> <link phx-track-static rel="stylesheet" href={Routes.static_path(@conn, "/css/app.css")} />
<script <script
@ -23,7 +23,7 @@
</script> </script>
</head> </head>
<body class="m-0 p-0 w-full h-full bg-white"> <body class="m-0 p-0 w-full h-full subpixel-antialiased">
<%= @inner_content %> <%= @inner_content %>
</body> </body>
</html> </html>

View File

@ -126,7 +126,12 @@
<%= select( <%= select(
f, f,
:locale, :locale,
[{gettext("English"), "en_US"}, {gettext("German"), "de"}, {gettext("French"), "fr"}], [
{gettext("English"), "en_US"},
{gettext("German"), "de"},
{gettext("French"), "fr"},
{gettext("Spanish"), "es"}
],
class: "mx-2 my-1 min-w-md input input-primary" class: "mx-2 my-1 min-w-md input input-primary"
) %> ) %>
<%= error_tag(f, :locale) %> <%= error_tag(f, :locale) %>

View File

@ -18,7 +18,7 @@ defmodule CanneryWeb.ErrorHelpers do
~H""" ~H"""
<%= for error <- Keyword.get_values(@form.errors, @field) do %> <%= for error <- Keyword.get_values(@form.errors, @field) do %>
<span class={"invalid-feedback #{@extra_class}"} phx-feedback-for={input_name(@form, @field)}> <span class={["invalid-feedback", @extra_class]} phx-feedback-for={input_name(@form, @field)}>
<%= translate_error(error) %> <%= translate_error(error) %>
</span> </span>
<% end %> <% end %>

View File

@ -5,64 +5,62 @@ defmodule CanneryWeb.ViewHelpers do
:view` :view`
""" """
import Phoenix.Component use Phoenix.Component
@id_length 16
@doc """ @doc """
Returns a <time> element that renders the naivedatetime in the user's local Phoenix.Component for a <time> element that renders the naivedatetime in the
timezone with Alpine.js user's local timezone with Alpine.js
""" """
@spec display_datetime(NaiveDateTime.t() | nil) :: Phoenix.LiveView.Rendered.t()
def display_datetime(nil), do: ""
def display_datetime(datetime) do attr :datetime, :any, required: true, doc: "A `DateTime` struct or nil"
assigns = %{
id: :crypto.strong_rand_bytes(@id_length) |> Base.url_encode64(),
datetime: datetime |> DateTime.from_naive!("Etc/UTC") |> DateTime.to_iso8601(:extended)
}
def datetime(assigns) do
~H""" ~H"""
<time <%= if @datetime do %>
id={@id} <time
datetime={@datetime} datetime={cast_datetime(@datetime)}
x-data={"{ x-data={"{
date: datetime:
Intl.DateTimeFormat([], {dateStyle: 'short', timeStyle: 'long'}) Intl.DateTimeFormat([], {dateStyle: 'short', timeStyle: 'long'})
.format(new Date(\"#{@datetime}\")) .format(new Date(\"#{cast_datetime(@datetime)}\"))
}"} }"}
x-text="date" x-text="datetime"
> >
<%= @datetime %> <%= cast_datetime(@datetime) %>
</time> </time>
<% end %>
""" """
end end
@spec cast_datetime(NaiveDateTime.t() | nil) :: String.t()
defp cast_datetime(%NaiveDateTime{} = datetime) do
datetime |> DateTime.from_naive!("Etc/UTC") |> DateTime.to_iso8601(:extended)
end
defp cast_datetime(_datetime), do: ""
@doc """ @doc """
Returns a <date> element that renders the Date in the user's local Phoenix.Component for a <date> element that renders the Date in the user's
timezone with Alpine.js local timezone with Alpine.js
""" """
@spec display_date(Date.t() | nil) :: Phoenix.LiveView.Rendered.t()
def display_date(nil), do: ""
def display_date(date) do attr :date, :any, required: true, doc: "A `Date` struct or nil"
assigns = %{
id: :crypto.strong_rand_bytes(@id_length) |> Base.url_encode64(),
date: date |> Date.to_iso8601(:extended)
}
def date(assigns) do
~H""" ~H"""
<time <%= if @date do %>
id={@id} <time
datetime={@date} datetime={@date |> Date.to_iso8601(:extended)}
x-data={"{ x-data={"{
date: date:
Intl.DateTimeFormat([], {timeZone: 'Etc/UTC', dateStyle: 'short'}).format(new Date(\"#{@date}\")) Intl.DateTimeFormat([], {timeZone: 'Etc/UTC', dateStyle: 'short'})
}"} .format(new Date(\"#{@date |> Date.to_iso8601(:extended)}\"))
x-text="date" }"}
> x-text="date"
<%= @date %> >
</time> <%= @date |> Date.to_iso8601(:extended) %>
</time>
<% end %>
""" """
end end
@ -70,49 +68,41 @@ defmodule CanneryWeb.ViewHelpers do
Displays emoji as text emoji if SHIBAO_MODE is set to true :) Displays emoji as text emoji if SHIBAO_MODE is set to true :)
""" """
@spec display_emoji(String.t()) :: String.t() @spec display_emoji(String.t()) :: String.t()
def display_emoji("😔"), def display_emoji("😔") do
do: if Application.get_env(:cannery, CanneryWeb.ViewHelpers)[:shibao_mode], do: "q_q", else: "😔"
if(Application.get_env(:cannery, CanneryWeb.ViewHelpers)[:shibao_mode], do: "q_q", else: "😔") end
def display_emoji(other_emoji), do: other_emoji def display_emoji(other_emoji), do: other_emoji
@doc """ @doc """
A toggle button element that can be directed to a liveview or a Displays content in a QR code as a base64 encoded PNG
live_component's `handle_event/3`.
## Examples
<.toggle_button action="my_liveview_action" value={@some_value}>
<span>Toggle me!</span>
</.toggle_button>
<.toggle_button action="my_live_component_action" target={@myself} value={@some_value}>
<span>Whatever you want</span>
</.toggle_button>
""" """
def toggle_button(assigns) do @spec qr_code_image(String.t()) :: String.t()
assigns = assigns |> assign_new(:id, fn -> assigns.action end) @spec qr_code_image(String.t(), width :: non_neg_integer()) :: String.t()
def qr_code_image(content, width \\ 384) do
img_data =
content
|> EQRCode.encode()
|> EQRCode.png(width: width)
|> Base.encode64()
"data:image/png;base64," <> img_data
end
@doc """
Creates a downloadable QR Code element
"""
attr :content, :string, required: true
attr :filename, :string, default: "qrcode", doc: "filename without .png extension"
attr :image_class, :string, default: "w-64 h-max"
attr :width, :integer, default: 384, doc: "width of png to generate"
def qr_code(assigns) do
~H""" ~H"""
<label for={@id} class="inline-flex relative items-center cursor-pointer"> <a href={qr_code_image(@content)} download={@filename <> ".png"}>
<input <img class={@image_class} alt={@filename} src={qr_code_image(@content)} />
id={@id} </a>
type="checkbox"
value={@value}
checked={@value}
class="sr-only peer"
data-qa={@id}
{
if assigns |> Map.has_key?(:target),
do: %{"phx-click" => @action, "phx-value-value" => @value, "phx-target" => @target},
else: %{"phx-click" => @action, "phx-value-value" => @value}
}
/>
<div class="w-11 h-6 bg-gray-200 rounded-full peer dark:bg-gray-700 peer-focus:ring-4 peer-focus:ring-teal-300 dark:peer-focus:ring-teal-800 peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-1 after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all dark:border-gray-600 peer-checked:bg-teal-600">
</div>
<span class="ml-3 text-sm font-medium text-gray-900 dark:text-gray-300">
<%= render_slot(@inner_block) %>
</span>
</label>
""" """
end end

View File

@ -4,7 +4,7 @@ defmodule Cannery.MixProject do
def project do def project do
[ [
app: :cannery, app: :cannery,
version: "0.6.0", version: "0.8.1",
elixir: "1.14.1", elixir: "1.14.1",
elixirc_paths: elixirc_paths(Mix.env()), elixirc_paths: elixirc_paths(Mix.env()),
compilers: Mix.compilers(), compilers: Mix.compilers(),
@ -13,7 +13,7 @@ defmodule Cannery.MixProject do
deps: deps(), deps: deps(),
dialyzer: [plt_add_apps: [:ex_unit]], dialyzer: [plt_add_apps: [:ex_unit]],
consolidate_protocols: Mix.env() not in [:dev, :test], consolidate_protocols: Mix.env() not in [:dev, :test],
preferred_cli_env: [test: :test, "test.all": :test], preferred_cli_env: ["test.all": :test],
# ExDoc # ExDoc
name: "Cannery", name: "Cannery",
source_url: "https://gitea.bubbletea.dev/shibao/cannery", source_url: "https://gitea.bubbletea.dev/shibao/cannery",
@ -70,6 +70,7 @@ defmodule Cannery.MixProject do
{:jason, "~> 1.2"}, {:jason, "~> 1.2"},
{:plug_cowboy, "~> 2.5"}, {:plug_cowboy, "~> 2.5"},
{:ecto_psql_extras, "~> 0.6"}, {:ecto_psql_extras, "~> 0.6"},
{:eqrcode, "~> 0.1.10"},
{:credo, "~> 1.5", only: [:dev, :test], runtime: false}, {:credo, "~> 1.5", only: [:dev, :test], runtime: false},
{:dialyxir, "~> 1.0", only: [:dev, :test], runtime: false} {:dialyxir, "~> 1.0", only: [:dev, :test], runtime: false}
] ]

View File

@ -1,44 +1,42 @@
%{ %{
"bcrypt_elixir": {:hex, :bcrypt_elixir, "2.3.1", "5114d780459a04f2b4aeef52307de23de961b69e13a5cd98a911e39fda13f420", [:make, :mix], [{:comeonin, "~> 5.3", [hex: :comeonin, repo: "hexpm", optional: false]}, {:elixir_make, "~> 0.6", [hex: :elixir_make, repo: "hexpm", optional: false]}], "hexpm", "42182d5f46764def15bf9af83739e3bf4ad22661b1c34fc3e88558efced07279"}, "bcrypt_elixir": {:hex, :bcrypt_elixir, "2.3.1", "5114d780459a04f2b4aeef52307de23de961b69e13a5cd98a911e39fda13f420", [:make, :mix], [{:comeonin, "~> 5.3", [hex: :comeonin, repo: "hexpm", optional: false]}, {:elixir_make, "~> 0.6", [hex: :elixir_make, repo: "hexpm", optional: false]}], "hexpm", "42182d5f46764def15bf9af83739e3bf4ad22661b1c34fc3e88558efced07279"},
"bunt": {:hex, :bunt, "0.2.1", "e2d4792f7bc0ced7583ab54922808919518d0e57ee162901a16a1b6664ef3b14", [:mix], [], "hexpm", "a330bfb4245239787b15005e66ae6845c9cd524a288f0d141c148b02603777a5"}, "bunt": {:hex, :bunt, "0.2.1", "e2d4792f7bc0ced7583ab54922808919518d0e57ee162901a16a1b6664ef3b14", [:mix], [], "hexpm", "a330bfb4245239787b15005e66ae6845c9cd524a288f0d141c148b02603777a5"},
"castore": {:hex, :castore, "0.1.18", "deb5b9ab02400561b6f5708f3e7660fc35ca2d51bfc6a940d2f513f89c2975fc", [:mix], [], "hexpm", "61bbaf6452b782ef80b33cdb45701afbcf0a918a45ebe7e73f1130d661e66a06"}, "castore": {:hex, :castore, "0.1.22", "4127549e411bedd012ca3a308dede574f43819fe9394254ca55ab4895abfa1a2", [:mix], [], "hexpm", "c17576df47eb5aa1ee40cc4134316a99f5cad3e215d5c77b8dd3cfef12a22cac"},
"comeonin": {:hex, :comeonin, "5.3.3", "2c564dac95a35650e9b6acfe6d2952083d8a08e4a89b93a481acb552b325892e", [:mix], [], "hexpm", "3e38c9c2cb080828116597ca8807bb482618a315bfafd98c90bc22a821cc84df"}, "comeonin": {:hex, :comeonin, "5.3.3", "2c564dac95a35650e9b6acfe6d2952083d8a08e4a89b93a481acb552b325892e", [:mix], [], "hexpm", "3e38c9c2cb080828116597ca8807bb482618a315bfafd98c90bc22a821cc84df"},
"connection": {:hex, :connection, "1.1.0", "ff2a49c4b75b6fb3e674bfc5536451607270aac754ffd1bdfe175abe4a6d7a68", [:mix], [], "hexpm", "722c1eb0a418fbe91ba7bd59a47e28008a189d47e37e0e7bb85585a016b2869c"}, "connection": {:hex, :connection, "1.1.0", "ff2a49c4b75b6fb3e674bfc5536451607270aac754ffd1bdfe175abe4a6d7a68", [:mix], [], "hexpm", "722c1eb0a418fbe91ba7bd59a47e28008a189d47e37e0e7bb85585a016b2869c"},
"cowboy": {:hex, :cowboy, "2.9.0", "865dd8b6607e14cf03282e10e934023a1bd8be6f6bacf921a7e2a96d800cd452", [:make, :rebar3], [{:cowlib, "2.11.0", [hex: :cowlib, repo: "hexpm", optional: false]}, {:ranch, "1.8.0", [hex: :ranch, repo: "hexpm", optional: false]}], "hexpm", "2c729f934b4e1aa149aff882f57c6372c15399a20d54f65c8d67bef583021bde"}, "cowboy": {:hex, :cowboy, "2.9.0", "865dd8b6607e14cf03282e10e934023a1bd8be6f6bacf921a7e2a96d800cd452", [:make, :rebar3], [{:cowlib, "2.11.0", [hex: :cowlib, repo: "hexpm", optional: false]}, {:ranch, "1.8.0", [hex: :ranch, repo: "hexpm", optional: false]}], "hexpm", "2c729f934b4e1aa149aff882f57c6372c15399a20d54f65c8d67bef583021bde"},
"cowboy_telemetry": {:hex, :cowboy_telemetry, "0.4.0", "f239f68b588efa7707abce16a84d0d2acf3a0f50571f8bb7f56a15865aae820c", [:rebar3], [{:cowboy, "~> 2.7", [hex: :cowboy, repo: "hexpm", optional: false]}, {:telemetry, "~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "7d98bac1ee4565d31b62d59f8823dfd8356a169e7fcbb83831b8a5397404c9de"}, "cowboy_telemetry": {:hex, :cowboy_telemetry, "0.4.0", "f239f68b588efa7707abce16a84d0d2acf3a0f50571f8bb7f56a15865aae820c", [:rebar3], [{:cowboy, "~> 2.7", [hex: :cowboy, repo: "hexpm", optional: false]}, {:telemetry, "~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "7d98bac1ee4565d31b62d59f8823dfd8356a169e7fcbb83831b8a5397404c9de"},
"cowlib": {:hex, :cowlib, "2.11.0", "0b9ff9c346629256c42ebe1eeb769a83c6cb771a6ee5960bd110ab0b9b872063", [:make, :rebar3], [], "hexpm", "2b3e9da0b21c4565751a6d4901c20d1b4cc25cbb7fd50d91d2ab6dd287bc86a9"}, "cowlib": {:hex, :cowlib, "2.11.0", "0b9ff9c346629256c42ebe1eeb769a83c6cb771a6ee5960bd110ab0b9b872063", [:make, :rebar3], [], "hexpm", "2b3e9da0b21c4565751a6d4901c20d1b4cc25cbb7fd50d91d2ab6dd287bc86a9"},
"credo": {:hex, :credo, "1.6.7", "323f5734350fd23a456f2688b9430e7d517afb313fbd38671b8a4449798a7854", [:mix], [{:bunt, "~> 0.2.1", [hex: :bunt, repo: "hexpm", optional: false]}, {:file_system, "~> 0.2.8", [hex: :file_system, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "41e110bfb007f7eda7f897c10bf019ceab9a0b269ce79f015d54b0dcf4fc7dd3"}, "credo": {:hex, :credo, "1.6.7", "323f5734350fd23a456f2688b9430e7d517afb313fbd38671b8a4449798a7854", [:mix], [{:bunt, "~> 0.2.1", [hex: :bunt, repo: "hexpm", optional: false]}, {:file_system, "~> 0.2.8", [hex: :file_system, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "41e110bfb007f7eda7f897c10bf019ceab9a0b269ce79f015d54b0dcf4fc7dd3"},
"db_connection": {:hex, :db_connection, "2.4.2", "f92e79aff2375299a16bcb069a14ee8615c3414863a6fef93156aee8e86c2ff3", [:mix], [{:connection, "~> 1.0", [hex: :connection, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "4fe53ca91b99f55ea249693a0229356a08f4d1a7931d8ffa79289b145fe83668"}, "db_connection": {:hex, :db_connection, "2.4.3", "3b9aac9f27347ec65b271847e6baeb4443d8474289bd18c1d6f4de655b70c94d", [:mix], [{:connection, "~> 1.0", [hex: :connection, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "c127c15b0fa6cfb32eed07465e05da6c815b032508d4ed7c116122871df73c12"},
"decimal": {:hex, :decimal, "2.0.0", "a78296e617b0f5dd4c6caf57c714431347912ffb1d0842e998e9792b5642d697", [:mix], [], "hexpm", "34666e9c55dea81013e77d9d87370fe6cb6291d1ef32f46a1600230b1d44f577"}, "decimal": {:hex, :decimal, "2.0.0", "a78296e617b0f5dd4c6caf57c714431347912ffb1d0842e998e9792b5642d697", [:mix], [], "hexpm", "34666e9c55dea81013e77d9d87370fe6cb6291d1ef32f46a1600230b1d44f577"},
"dialyxir": {:hex, :dialyxir, "1.2.0", "58344b3e87c2e7095304c81a9ae65cb68b613e28340690dfe1a5597fd08dec37", [:mix], [{:erlex, ">= 0.2.6", [hex: :erlex, repo: "hexpm", optional: false]}], "hexpm", "61072136427a851674cab81762be4dbeae7679f85b1272b6d25c3a839aff8463"}, "dialyxir": {:hex, :dialyxir, "1.2.0", "58344b3e87c2e7095304c81a9ae65cb68b613e28340690dfe1a5597fd08dec37", [:mix], [{:erlex, ">= 0.2.6", [hex: :erlex, repo: "hexpm", optional: false]}], "hexpm", "61072136427a851674cab81762be4dbeae7679f85b1272b6d25c3a839aff8463"},
"earmark_parser": {:hex, :earmark_parser, "1.4.29", "149d50dcb3a93d9f3d6f3ecf18c918fb5a2d3c001b5d3305c926cddfbd33355b", [:mix], [], "hexpm", "4902af1b3eb139016aed210888748db8070b8125c2342ce3dcae4f38dcc63503"}, "earmark_parser": {:hex, :earmark_parser, "1.4.29", "149d50dcb3a93d9f3d6f3ecf18c918fb5a2d3c001b5d3305c926cddfbd33355b", [:mix], [], "hexpm", "4902af1b3eb139016aed210888748db8070b8125c2342ce3dcae4f38dcc63503"},
"ecto": {:hex, :ecto, "3.9.1", "67173b1687afeb68ce805ee7420b4261649d5e2deed8fe5550df23bab0bc4396", [:mix], [{:decimal, "~> 1.6 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "c80bb3d736648df790f7f92f81b36c922d9dd3203ca65be4ff01d067f54eb304"}, "ecto": {:hex, :ecto, "3.9.4", "3ee68e25dbe0c36f980f1ba5dd41ee0d3eb0873bccae8aeaf1a2647242bffa35", [:mix], [{:decimal, "~> 1.6 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "de5f988c142a3aa4ec18b85a4ec34a2390b65b24f02385c1144252ff6ff8ee75"},
"ecto_psql_extras": {:hex, :ecto_psql_extras, "0.7.4", "5d43fd088d39a158c860b17e8d210669587f63ec89ea122a4654861c8c6e2db4", [:mix], [{:ecto_sql, "~> 3.4", [hex: :ecto_sql, repo: "hexpm", optional: false]}, {:postgrex, ">= 0.15.7", [hex: :postgrex, repo: "hexpm", optional: false]}, {:table_rex, "~> 3.1.1", [hex: :table_rex, repo: "hexpm", optional: false]}], "hexpm", "311db02f1b772e3d0dc7f56a05044b5e1499d78ed6abf38885e1ca70059449e5"}, "ecto_psql_extras": {:hex, :ecto_psql_extras, "0.7.10", "e14d400930f401ca9f541b3349212634e44027d7f919bbb71224d7ac0d0e8acd", [:mix], [{:ecto_sql, "~> 3.4", [hex: :ecto_sql, repo: "hexpm", optional: false]}, {:postgrex, "~> 0.15.7 or ~> 0.16.0", [hex: :postgrex, repo: "hexpm", optional: false]}, {:table_rex, "~> 3.1.1", [hex: :table_rex, repo: "hexpm", optional: false]}], "hexpm", "505e8cd81e4f17c090be0f99e92b1b3f0fd915f98e76965130b8ccfb891e7088"},
"ecto_sql": {:hex, :ecto_sql, "3.9.0", "2bb21210a2a13317e098a420a8c1cc58b0c3421ab8e3acfa96417dab7817918c", [:mix], [{:db_connection, "~> 2.5 or ~> 2.4.1", [hex: :db_connection, repo: "hexpm", optional: false]}, {:ecto, "~> 3.9.0", [hex: :ecto, repo: "hexpm", optional: false]}, {:myxql, "~> 0.6.0", [hex: :myxql, repo: "hexpm", optional: true]}, {:postgrex, "~> 0.16.0 or ~> 1.0", [hex: :postgrex, repo: "hexpm", optional: true]}, {:tds, "~> 2.1.1 or ~> 2.2", [hex: :tds, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4.0 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "a8f3f720073b8b1ac4c978be25fa7960ed7fd44997420c304a4a2e200b596453"}, "ecto_sql": {:hex, :ecto_sql, "3.9.2", "34227501abe92dba10d9c3495ab6770e75e79b836d114c41108a4bf2ce200ad5", [:mix], [{:db_connection, "~> 2.4.1 or ~> 2.5", [hex: :db_connection, repo: "hexpm", optional: false]}, {:ecto, "~> 3.9.2", [hex: :ecto, repo: "hexpm", optional: false]}, {:myxql, "~> 0.6.0", [hex: :myxql, repo: "hexpm", optional: true]}, {:postgrex, "~> 0.16.0 or ~> 1.0", [hex: :postgrex, repo: "hexpm", optional: true]}, {:tds, "~> 2.1.1 or ~> 2.2", [hex: :tds, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4.0 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "1eb5eeb4358fdbcd42eac11c1fbd87e3affd7904e639d77903c1358b2abd3f70"},
"elixir_make": {:hex, :elixir_make, "0.6.3", "bc07d53221216838d79e03a8019d0839786703129599e9619f4ab74c8c096eac", [:mix], [], "hexpm", "f5cbd651c5678bcaabdbb7857658ee106b12509cd976c2c2fca99688e1daf716"}, "elixir_make": {:hex, :elixir_make, "0.7.3", "c37fdae1b52d2cc51069713a58c2314877c1ad40800a57efb213f77b078a460d", [:mix], [{:castore, "~> 0.1", [hex: :castore, repo: "hexpm", optional: true]}], "hexpm", "24ada3e3996adbed1fa024ca14995ef2ba3d0d17b678b0f3f2b1f66e6ce2b274"},
"eqrcode": {:hex, :eqrcode, "0.1.10", "6294fece9d68ad64eef1c3c92cf111cfd6469f4fbf230a2d4cc905a682178f3f", [:mix], [], "hexpm", "da30e373c36a0fd37ab6f58664b16029919896d6c45a68a95cc4d713e81076f1"},
"erlex": {:hex, :erlex, "0.2.6", "c7987d15e899c7a2f34f5420d2a2ea0d659682c06ac607572df55a43753aa12e", [:mix], [], "hexpm", "2ed2e25711feb44d52b17d2780eabf998452f6efda104877a3881c2f8c0c0c75"}, "erlex": {:hex, :erlex, "0.2.6", "c7987d15e899c7a2f34f5420d2a2ea0d659682c06ac607572df55a43753aa12e", [:mix], [], "hexpm", "2ed2e25711feb44d52b17d2780eabf998452f6efda104877a3881c2f8c0c0c75"},
"esbuild": {:hex, :esbuild, "0.4.0", "9f17db148aead4cf1e6e6a584214357287a93407b5fb51a031f122b61385d4c2", [:mix], [{:castore, ">= 0.0.0", [hex: :castore, repo: "hexpm", optional: false]}], "hexpm", "b61e4e6b92ffe45e4ee4755a22de6211a67c67987dc02afb35a425a0add1d447"}, "ex_doc": {:hex, :ex_doc, "0.29.1", "b1c652fa5f92ee9cf15c75271168027f92039b3877094290a75abcaac82a9f77", [:mix], [{:earmark_parser, "~> 1.4.19", [hex: :earmark_parser, repo: "hexpm", optional: false]}, {:makeup_elixir, "~> 0.14", [hex: :makeup_elixir, repo: "hexpm", optional: false]}, {:makeup_erlang, "~> 0.1", [hex: :makeup_erlang, repo: "hexpm", optional: false]}], "hexpm", "b7745fa6374a36daf484e2a2012274950e084815b936b1319aeebcf7809574f6"},
"ex_doc": {:hex, :ex_doc, "0.29.0", "4a1cb903ce746aceef9c1f9ae8a6c12b742a5461e6959b9d3b24d813ffbea146", [:mix], [{:earmark_parser, "~> 1.4.19", [hex: :earmark_parser, repo: "hexpm", optional: false]}, {:makeup_elixir, "~> 0.14", [hex: :makeup_elixir, repo: "hexpm", optional: false]}, {:makeup_erlang, "~> 0.1", [hex: :makeup_erlang, repo: "hexpm", optional: false]}], "hexpm", "f096adb8bbca677d35d278223361c7792d496b3fc0d0224c9d4bc2f651af5db1"}, "expo": {:hex, :expo, "0.3.0", "13127c1d5f653b2927f2616a4c9ace5ae372efd67c7c2693b87fd0fdc30c6feb", [:mix], [], "hexpm", "fb3cd4bf012a77bc1608915497dae2ff684a06f0fa633c7afa90c4d72b881823"},
"file_system": {:hex, :file_system, "0.2.10", "fb082005a9cd1711c05b5248710f8826b02d7d1784e7c3451f9c1231d4fc162d", [:mix], [], "hexpm", "41195edbfb562a593726eda3b3e8b103a309b733ad25f3d642ba49696bf715dc"}, "file_system": {:hex, :file_system, "0.2.10", "fb082005a9cd1711c05b5248710f8826b02d7d1784e7c3451f9c1231d4fc162d", [:mix], [], "hexpm", "41195edbfb562a593726eda3b3e8b103a309b733ad25f3d642ba49696bf715dc"},
"floki": {:hex, :floki, "0.34.0", "002d0cc194b48794d74711731db004fafeb328fe676976f160685262d43706a8", [:mix], [], "hexpm", "9c3a9f43f40dde00332a589bd9d389b90c1f518aef500364d00636acc5ebc99c"}, "floki": {:hex, :floki, "0.34.0", "002d0cc194b48794d74711731db004fafeb328fe676976f160685262d43706a8", [:mix], [], "hexpm", "9c3a9f43f40dde00332a589bd9d389b90c1f518aef500364d00636acc5ebc99c"},
"gen_smtp": {:hex, :gen_smtp, "1.2.0", "9cfc75c72a8821588b9b9fe947ae5ab2aed95a052b81237e0928633a13276fd3", [:rebar3], [{:ranch, ">= 1.8.0", [hex: :ranch, repo: "hexpm", optional: false]}], "hexpm", "5ee0375680bca8f20c4d85f58c2894441443a743355430ff33a783fe03296779"}, "gen_smtp": {:hex, :gen_smtp, "1.2.0", "9cfc75c72a8821588b9b9fe947ae5ab2aed95a052b81237e0928633a13276fd3", [:rebar3], [{:ranch, ">= 1.8.0", [hex: :ranch, repo: "hexpm", optional: false]}], "hexpm", "5ee0375680bca8f20c4d85f58c2894441443a743355430ff33a783fe03296779"},
"gettext": {:hex, :gettext, "0.20.0", "75ad71de05f2ef56991dbae224d35c68b098dd0e26918def5bb45591d5c8d429", [:mix], [], "hexpm", "1c03b177435e93a47441d7f681a7040bd2a816ece9e2666d1c9001035121eb3d"}, "gettext": {:hex, :gettext, "0.22.0", "a25d71ec21b1848957d9207b81fd61cb25161688d282d58bdafef74c2270bdc4", [:mix], [{:expo, "~> 0.3.0", [hex: :expo, repo: "hexpm", optional: false]}], "hexpm", "cb0675141576f73720c8e49b4f0fd3f2c69f0cd8c218202724d4aebab8c70ace"},
"heex_formatter": {:git, "https://github.com/feliperenan/heex_formatter.git", "dfefc9ae267fb0874c287ceb6c47dda106c59552", []},
"html_entities": {:hex, :html_entities, "0.5.2", "9e47e70598da7de2a9ff6af8758399251db6dbb7eebe2b013f2bbd2515895c3c", [:mix], [], "hexpm", "c53ba390403485615623b9531e97696f076ed415e8d8058b1dbaa28181f4fdcc"},
"hut": {:hex, :hut, "1.3.0", "71f2f054e657c03f959cf1acc43f436ea87580696528ca2a55c8afb1b06c85e7", [:"erlang.mk", :rebar, :rebar3], [], "hexpm", "7e15d28555d8a1f2b5a3a931ec120af0753e4853a4c66053db354f35bf9ab563"},
"jason": {:hex, :jason, "1.4.0", "e855647bc964a44e2f67df589ccf49105ae039d4179db7f6271dfd3843dc27e6", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "79a3791085b2a0f743ca04cec0f7be26443738779d09302e01318f97bdb82121"}, "jason": {:hex, :jason, "1.4.0", "e855647bc964a44e2f67df589ccf49105ae039d4179db7f6271dfd3843dc27e6", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "79a3791085b2a0f743ca04cec0f7be26443738779d09302e01318f97bdb82121"},
"makeup": {:hex, :makeup, "1.1.0", "6b67c8bc2882a6b6a445859952a602afc1a41c2e08379ca057c0f525366fc3ca", [:mix], [{:nimble_parsec, "~> 1.2.2 or ~> 1.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "0a45ed501f4a8897f580eabf99a2e5234ea3e75a4373c8a52824f6e873be57a6"}, "makeup": {:hex, :makeup, "1.1.0", "6b67c8bc2882a6b6a445859952a602afc1a41c2e08379ca057c0f525366fc3ca", [:mix], [{:nimble_parsec, "~> 1.2.2 or ~> 1.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "0a45ed501f4a8897f580eabf99a2e5234ea3e75a4373c8a52824f6e873be57a6"},
"makeup_elixir": {:hex, :makeup_elixir, "0.16.0", "f8c570a0d33f8039513fbccaf7108c5d750f47d8defd44088371191b76492b0b", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}, {:nimble_parsec, "~> 1.2.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "28b2cbdc13960a46ae9a8858c4bebdec3c9a6d7b4b9e7f4ed1502f8159f338e7"}, "makeup_elixir": {:hex, :makeup_elixir, "0.16.0", "f8c570a0d33f8039513fbccaf7108c5d750f47d8defd44088371191b76492b0b", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}, {:nimble_parsec, "~> 1.2.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "28b2cbdc13960a46ae9a8858c4bebdec3c9a6d7b4b9e7f4ed1502f8159f338e7"},
"makeup_erlang": {:hex, :makeup_erlang, "0.1.1", "3fcb7f09eb9d98dc4d208f49cc955a34218fc41ff6b84df7c75b3e6e533cc65f", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm", "174d0809e98a4ef0b3309256cbf97101c6ec01c4ab0b23e926a9e17df2077cbb"}, "makeup_erlang": {:hex, :makeup_erlang, "0.1.1", "3fcb7f09eb9d98dc4d208f49cc955a34218fc41ff6b84df7c75b3e6e533cc65f", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm", "174d0809e98a4ef0b3309256cbf97101c6ec01c4ab0b23e926a9e17df2077cbb"},
"mime": {:hex, :mime, "2.0.3", "3676436d3d1f7b81b5a2d2bd8405f412c677558c81b1c92be58c00562bb59095", [:mix], [], "hexpm", "27a30bf0db44d25eecba73755acf4068cbfe26a4372f9eb3e4ea3a45956bff6b"}, "mime": {:hex, :mime, "2.0.3", "3676436d3d1f7b81b5a2d2bd8405f412c677558c81b1c92be58c00562bb59095", [:mix], [], "hexpm", "27a30bf0db44d25eecba73755acf4068cbfe26a4372f9eb3e4ea3a45956bff6b"},
"nimble_parsec": {:hex, :nimble_parsec, "1.2.3", "244836e6e3f1200c7f30cb56733fd808744eca61fd182f731eac4af635cc6d0b", [:mix], [], "hexpm", "c8d789e39b9131acf7b99291e93dae60ab48ef14a7ee9d58c6964f59efb570b0"}, "nimble_parsec": {:hex, :nimble_parsec, "1.2.3", "244836e6e3f1200c7f30cb56733fd808744eca61fd182f731eac4af635cc6d0b", [:mix], [], "hexpm", "c8d789e39b9131acf7b99291e93dae60ab48ef14a7ee9d58c6964f59efb570b0"},
"oban": {:hex, :oban, "2.13.4", "b4c4f48f4c89cc01036670eefa28aa9c03d09aadd402655475b936983d597006", [:mix], [{:ecto_sql, "~> 3.6", [hex: :ecto_sql, repo: "hexpm", optional: false]}, {:jason, "~> 1.1", [hex: :jason, repo: "hexpm", optional: false]}, {:postgrex, "~> 0.16", [hex: :postgrex, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "a7d26f82b409e2d7928fbb75a17716e06ad3f783ebe9af260e3dd23abed7f124"}, "oban": {:hex, :oban, "2.13.6", "a0cb1bce3bd393770512231fb5a3695fa19fd3af10d7575bf73f837aee7abf43", [:mix], [{:ecto_sql, "~> 3.6", [hex: :ecto_sql, repo: "hexpm", optional: false]}, {:jason, "~> 1.1", [hex: :jason, repo: "hexpm", optional: false]}, {:postgrex, "~> 0.16", [hex: :postgrex, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "3c1c5eb16f377b3cbbf2ea14be24d20e3d91285af9d1ac86260b7c2af5464887"},
"phoenix": {:hex, :phoenix, "1.6.15", "0a1d96bbc10747fd83525370d691953cdb6f3ccbac61aa01b4acb012474b047d", [:mix], [{:castore, ">= 0.0.0", [hex: :castore, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:phoenix_pubsub, "~> 2.0", [hex: :phoenix_pubsub, repo: "hexpm", optional: false]}, {:phoenix_view, "~> 1.0 or ~> 2.0", [hex: :phoenix_view, repo: "hexpm", optional: false]}, {:plug, "~> 1.10", [hex: :plug, repo: "hexpm", optional: false]}, {:plug_cowboy, "~> 2.2", [hex: :plug_cowboy, repo: "hexpm", optional: true]}, {:plug_crypto, "~> 1.2", [hex: :plug_crypto, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "d70ab9fbf6b394755ea88b644d34d79d8b146e490973151f248cacd122d20672"}, "phoenix": {:hex, :phoenix, "1.6.15", "0a1d96bbc10747fd83525370d691953cdb6f3ccbac61aa01b4acb012474b047d", [:mix], [{:castore, ">= 0.0.0", [hex: :castore, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:phoenix_pubsub, "~> 2.0", [hex: :phoenix_pubsub, repo: "hexpm", optional: false]}, {:phoenix_view, "~> 1.0 or ~> 2.0", [hex: :phoenix_view, repo: "hexpm", optional: false]}, {:plug, "~> 1.10", [hex: :plug, repo: "hexpm", optional: false]}, {:plug_cowboy, "~> 2.2", [hex: :plug_cowboy, repo: "hexpm", optional: true]}, {:plug_crypto, "~> 1.2", [hex: :plug_crypto, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "d70ab9fbf6b394755ea88b644d34d79d8b146e490973151f248cacd122d20672"},
"phoenix_ecto": {:hex, :phoenix_ecto, "4.4.0", "0672ed4e4808b3fbed494dded89958e22fb882de47a97634c0b13e7b0b5f7720", [:mix], [{:ecto, "~> 3.3", [hex: :ecto, repo: "hexpm", optional: false]}, {:phoenix_html, "~> 2.14.2 or ~> 3.0", [hex: :phoenix_html, repo: "hexpm", optional: true]}, {:plug, "~> 1.9", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm", "09864e558ed31ee00bd48fcc1d4fc58ae9678c9e81649075431e69dbabb43cc1"}, "phoenix_ecto": {:hex, :phoenix_ecto, "4.4.0", "0672ed4e4808b3fbed494dded89958e22fb882de47a97634c0b13e7b0b5f7720", [:mix], [{:ecto, "~> 3.3", [hex: :ecto, repo: "hexpm", optional: false]}, {:phoenix_html, "~> 2.14.2 or ~> 3.0", [hex: :phoenix_html, repo: "hexpm", optional: true]}, {:plug, "~> 1.9", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm", "09864e558ed31ee00bd48fcc1d4fc58ae9678c9e81649075431e69dbabb43cc1"},
"phoenix_html": {:hex, :phoenix_html, "3.2.0", "1c1219d4b6cb22ac72f12f73dc5fad6c7563104d083f711c3fcd8551a1f4ae11", [:mix], [{:plug, "~> 1.5", [hex: :plug, repo: "hexpm", optional: true]}], "hexpm", "36ec97ba56d25c0136ef1992c37957e4246b649d620958a1f9fa86165f8bc54f"}, "phoenix_html": {:hex, :phoenix_html, "3.2.0", "1c1219d4b6cb22ac72f12f73dc5fad6c7563104d083f711c3fcd8551a1f4ae11", [:mix], [{:plug, "~> 1.5", [hex: :plug, repo: "hexpm", optional: true]}], "hexpm", "36ec97ba56d25c0136ef1992c37957e4246b649d620958a1f9fa86165f8bc54f"},
"phoenix_live_dashboard": {:hex, :phoenix_live_dashboard, "0.7.1", "b0bf8f3348dec4910907a2ad1453e642f6fe4d444376c1c9b26222d63c73cf97", [:mix], [{:ecto, "~> 3.6.2 or ~> 3.7", [hex: :ecto, repo: "hexpm", optional: true]}, {:ecto_mysql_extras, "~> 0.5", [hex: :ecto_mysql_extras, repo: "hexpm", optional: true]}, {:ecto_psql_extras, "~> 0.7", [hex: :ecto_psql_extras, repo: "hexpm", optional: true]}, {:mime, "~> 1.6 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:phoenix_live_view, "~> 0.18.0", [hex: :phoenix_live_view, repo: "hexpm", optional: false]}, {:telemetry_metrics, "~> 0.6 or ~> 1.0", [hex: :telemetry_metrics, repo: "hexpm", optional: false]}], "hexpm", "b6c5d744bf4b40692b1b361d3608bdfd05aeab83e17c7bc217d730f007f31abf"}, "phoenix_live_dashboard": {:hex, :phoenix_live_dashboard, "0.7.1", "b0bf8f3348dec4910907a2ad1453e642f6fe4d444376c1c9b26222d63c73cf97", [:mix], [{:ecto, "~> 3.6.2 or ~> 3.7", [hex: :ecto, repo: "hexpm", optional: true]}, {:ecto_mysql_extras, "~> 0.5", [hex: :ecto_mysql_extras, repo: "hexpm", optional: true]}, {:ecto_psql_extras, "~> 0.7", [hex: :ecto_psql_extras, repo: "hexpm", optional: true]}, {:mime, "~> 1.6 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:phoenix_live_view, "~> 0.18.0", [hex: :phoenix_live_view, repo: "hexpm", optional: false]}, {:telemetry_metrics, "~> 0.6 or ~> 1.0", [hex: :telemetry_metrics, repo: "hexpm", optional: false]}], "hexpm", "b6c5d744bf4b40692b1b361d3608bdfd05aeab83e17c7bc217d730f007f31abf"},
"phoenix_live_reload": {:hex, :phoenix_live_reload, "1.4.0", "4fe222c0be55fdc3f9c711e24955fc42a7cd9b7a2f5f406f2580a567c335a573", [:mix], [{:file_system, "~> 0.2.1 or ~> 0.3", [hex: :file_system, repo: "hexpm", optional: false]}, {:phoenix, "~> 1.4", [hex: :phoenix, repo: "hexpm", optional: false]}], "hexpm", "bebf0fc2d2113b61cb5968f585367234b7b4c21d963d691de7b4b2dc6cdaae6f"}, "phoenix_live_reload": {:hex, :phoenix_live_reload, "1.4.1", "2aff698f5e47369decde4357ba91fc9c37c6487a512b41732818f2204a8ef1d3", [:mix], [{:file_system, "~> 0.2.1 or ~> 0.3", [hex: :file_system, repo: "hexpm", optional: false]}, {:phoenix, "~> 1.4", [hex: :phoenix, repo: "hexpm", optional: false]}], "hexpm", "9bffb834e7ddf08467fe54ae58b5785507aaba6255568ae22b4d46e2bb3615ab"},
"phoenix_live_view": {:hex, :phoenix_live_view, "0.18.2", "635cf07de947235deb030cd6b776c71a3b790ab04cebf526aa8c879fe17c7784", [:mix], [{:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:phoenix, "~> 1.6 or ~> 1.7", [hex: :phoenix, repo: "hexpm", optional: false]}, {:phoenix_html, "~> 3.1", [hex: :phoenix_html, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4.2 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "da287a77327e996cc166e4c440c3ad5ab33ccdb151b91c793209b39ebbce5b75"}, "phoenix_live_view": {:hex, :phoenix_live_view, "0.18.2", "635cf07de947235deb030cd6b776c71a3b790ab04cebf526aa8c879fe17c7784", [:mix], [{:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:phoenix, "~> 1.6", [hex: :phoenix, repo: "hexpm", optional: false]}, {:phoenix_html, "~> 3.1", [hex: :phoenix_html, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4.2 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "da287a77327e996cc166e4c440c3ad5ab33ccdb151b91c793209b39ebbce5b75"},
"phoenix_pubsub": {:hex, :phoenix_pubsub, "2.1.1", "ba04e489ef03763bf28a17eb2eaddc2c20c6d217e2150a61e3298b0f4c2012b5", [:mix], [], "hexpm", "81367c6d1eea5878ad726be80808eb5a787a23dee699f96e72b1109c57cdd8d9"}, "phoenix_pubsub": {:hex, :phoenix_pubsub, "2.1.1", "ba04e489ef03763bf28a17eb2eaddc2c20c6d217e2150a61e3298b0f4c2012b5", [:mix], [], "hexpm", "81367c6d1eea5878ad726be80808eb5a787a23dee699f96e72b1109c57cdd8d9"},
"phoenix_swoosh": {:hex, :phoenix_swoosh, "1.1.0", "f8e4780705c9f254cc853f7a40e25f7198ba4d91102bcfad2226669b69766b35", [:mix], [{:finch, "~> 0.8", [hex: :finch, repo: "hexpm", optional: true]}, {:hackney, "~> 1.10", [hex: :hackney, repo: "hexpm", optional: true]}, {:phoenix, "~> 1.6", [hex: :phoenix, repo: "hexpm", optional: true]}, {:phoenix_html, "~> 3.0", [hex: :phoenix_html, repo: "hexpm", optional: true]}, {:phoenix_view, "~> 1.0 or ~> 2.0", [hex: :phoenix_view, repo: "hexpm", optional: false]}, {:swoosh, "~> 1.5", [hex: :swoosh, repo: "hexpm", optional: false]}], "hexpm", "aa82f10afd9a4b6080fdf3274dbb9432b25b210d42b4b6b55308f6e59cd87c3d"}, "phoenix_swoosh": {:hex, :phoenix_swoosh, "1.1.0", "f8e4780705c9f254cc853f7a40e25f7198ba4d91102bcfad2226669b69766b35", [:mix], [{:finch, "~> 0.8", [hex: :finch, repo: "hexpm", optional: true]}, {:hackney, "~> 1.10", [hex: :hackney, repo: "hexpm", optional: true]}, {:phoenix, "~> 1.6", [hex: :phoenix, repo: "hexpm", optional: true]}, {:phoenix_html, "~> 3.0", [hex: :phoenix_html, repo: "hexpm", optional: true]}, {:phoenix_view, "~> 1.0 or ~> 2.0", [hex: :phoenix_view, repo: "hexpm", optional: false]}, {:swoosh, "~> 1.5", [hex: :swoosh, repo: "hexpm", optional: false]}], "hexpm", "aa82f10afd9a4b6080fdf3274dbb9432b25b210d42b4b6b55308f6e59cd87c3d"},
"phoenix_view": {:hex, :phoenix_view, "1.1.2", "1b82764a065fb41051637872c7bd07ed2fdb6f5c3bd89684d4dca6e10115c95a", [:mix], [{:phoenix_html, "~> 2.14.2 or ~> 3.0", [hex: :phoenix_html, repo: "hexpm", optional: true]}], "hexpm", "7ae90ad27b09091266f6adbb61e1d2516a7c3d7062c6789d46a7554ec40f3a56"}, "phoenix_view": {:hex, :phoenix_view, "1.1.2", "1b82764a065fb41051637872c7bd07ed2fdb6f5c3bd89684d4dca6e10115c95a", [:mix], [{:phoenix_html, "~> 2.14.2 or ~> 3.0", [hex: :phoenix_html, repo: "hexpm", optional: true]}], "hexpm", "7ae90ad27b09091266f6adbb61e1d2516a7c3d7062c6789d46a7554ec40f3a56"},
@ -47,10 +45,9 @@
"plug_crypto": {:hex, :plug_crypto, "1.2.3", "8f77d13aeb32bfd9e654cb68f0af517b371fb34c56c9f2b58fe3df1235c1251a", [:mix], [], "hexpm", "b5672099c6ad5c202c45f5a403f21a3411247f164e4a8fab056e5cd8a290f4a2"}, "plug_crypto": {:hex, :plug_crypto, "1.2.3", "8f77d13aeb32bfd9e654cb68f0af517b371fb34c56c9f2b58fe3df1235c1251a", [:mix], [], "hexpm", "b5672099c6ad5c202c45f5a403f21a3411247f164e4a8fab056e5cd8a290f4a2"},
"postgrex": {:hex, :postgrex, "0.16.5", "fcc4035cc90e23933c5d69a9cd686e329469446ef7abba2cf70f08e2c4b69810", [:mix], [{:connection, "~> 1.1", [hex: :connection, repo: "hexpm", optional: false]}, {:db_connection, "~> 2.1", [hex: :db_connection, repo: "hexpm", optional: false]}, {:decimal, "~> 1.5 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:table, "~> 0.1.0", [hex: :table, repo: "hexpm", optional: true]}], "hexpm", "edead639dc6e882618c01d8fc891214c481ab9a3788dfe38dd5e37fd1d5fb2e8"}, "postgrex": {:hex, :postgrex, "0.16.5", "fcc4035cc90e23933c5d69a9cd686e329469446ef7abba2cf70f08e2c4b69810", [:mix], [{:connection, "~> 1.1", [hex: :connection, repo: "hexpm", optional: false]}, {:db_connection, "~> 2.1", [hex: :db_connection, repo: "hexpm", optional: false]}, {:decimal, "~> 1.5 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:table, "~> 0.1.0", [hex: :table, repo: "hexpm", optional: true]}], "hexpm", "edead639dc6e882618c01d8fc891214c481ab9a3788dfe38dd5e37fd1d5fb2e8"},
"ranch": {:hex, :ranch, "1.8.0", "8c7a100a139fd57f17327b6413e4167ac559fbc04ca7448e9be9057311597a1d", [:make, :rebar3], [], "hexpm", "49fbcfd3682fab1f5d109351b61257676da1a2fdbe295904176d5e521a2ddfe5"}, "ranch": {:hex, :ranch, "1.8.0", "8c7a100a139fd57f17327b6413e4167ac559fbc04ca7448e9be9057311597a1d", [:make, :rebar3], [], "hexpm", "49fbcfd3682fab1f5d109351b61257676da1a2fdbe295904176d5e521a2ddfe5"},
"set_locale": {:hex, :set_locale, "0.2.9", "33350ba3c66f1c560dffc43019eea4b573f91c5cbe3e461fe0e5395d2d6ba2c3", [:mix], [{:gettext, "~>0.14", [hex: :gettext, repo: "hexpm", optional: false]}, {:phoenix, ">1.3.0", [hex: :phoenix, repo: "hexpm", optional: false]}], "hexpm", "e46348b64b7c5d725d0c90a6524942a19b65e6ce27372ddf9a727dfb64ba236c"}, "swoosh": {:hex, :swoosh, "1.9.1", "0a5d7bf9954eb41d7e55525bc0940379982b090abbaef67cd8e1fd2ed7f8ca1a", [:mix], [{:cowboy, "~> 1.1 or ~> 2.4", [hex: :cowboy, repo: "hexpm", optional: true]}, {:ex_aws, "~> 2.1", [hex: :ex_aws, repo: "hexpm", optional: true]}, {:finch, "~> 0.6", [hex: :finch, repo: "hexpm", optional: true]}, {:gen_smtp, "~> 0.13 or ~> 1.0", [hex: :gen_smtp, repo: "hexpm", optional: true]}, {:hackney, "~> 1.9", [hex: :hackney, repo: "hexpm", optional: true]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}, {:mail, "~> 0.2", [hex: :mail, repo: "hexpm", optional: true]}, {:mime, "~> 1.1 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:plug_cowboy, ">= 1.0.0", [hex: :plug_cowboy, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4.2 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "76dffff3ffcab80f249d5937a592eaef7cc49ac6f4cdd27e622868326ed6371e"},
"swoosh": {:hex, :swoosh, "1.8.2", "af9a22ab2c0d20b266f61acca737fa11a121902de9466a39e91bacdce012101c", [:mix], [{:cowboy, "~> 1.1 or ~> 2.4", [hex: :cowboy, repo: "hexpm", optional: true]}, {:ex_aws, "~> 2.1", [hex: :ex_aws, repo: "hexpm", optional: true]}, {:finch, "~> 0.6", [hex: :finch, repo: "hexpm", optional: true]}, {:gen_smtp, "~> 0.13 or ~> 1.0", [hex: :gen_smtp, repo: "hexpm", optional: true]}, {:hackney, "~> 1.9", [hex: :hackney, repo: "hexpm", optional: true]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}, {:mail, "~> 0.2", [hex: :mail, repo: "hexpm", optional: true]}, {:mime, "~> 1.1 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:plug_cowboy, ">= 1.0.0", [hex: :plug_cowboy, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4.2 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "d058ba750eafadb6c09a84a352c14c5d1eeeda6e84945fcc95785b7f3067b7db"},
"table_rex": {:hex, :table_rex, "3.1.1", "0c67164d1714b5e806d5067c1e96ff098ba7ae79413cc075973e17c38a587caa", [:mix], [], "hexpm", "678a23aba4d670419c23c17790f9dcd635a4a89022040df7d5d772cb21012490"}, "table_rex": {:hex, :table_rex, "3.1.1", "0c67164d1714b5e806d5067c1e96ff098ba7ae79413cc075973e17c38a587caa", [:mix], [], "hexpm", "678a23aba4d670419c23c17790f9dcd635a4a89022040df7d5d772cb21012490"},
"telemetry": {:hex, :telemetry, "1.1.0", "a589817034a27eab11144ad24d5c0f9fab1f58173274b1e9bae7074af9cbee51", [:rebar3], [], "hexpm", "b727b2a1f75614774cff2d7565b64d0dfa5bd52ba517f16543e6fc7efcc0df48"}, "telemetry": {:hex, :telemetry, "1.2.1", "68fdfe8d8f05a8428483a97d7aab2f268aaff24b49e0f599faa091f1d4e7f61c", [:rebar3], [], "hexpm", "dad9ce9d8effc621708f99eac538ef1cbe05d6a874dd741de2e689c47feafed5"},
"telemetry_metrics": {:hex, :telemetry_metrics, "0.6.1", "315d9163a1d4660aedc3fee73f33f1d355dcc76c5c3ab3d59e76e3edf80eef1f", [:mix], [{:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "7be9e0871c41732c233be71e4be11b96e56177bf15dde64a8ac9ce72ac9834c6"}, "telemetry_metrics": {:hex, :telemetry_metrics, "0.6.1", "315d9163a1d4660aedc3fee73f33f1d355dcc76c5c3ab3d59e76e3edf80eef1f", [:mix], [{:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "7be9e0871c41732c233be71e4be11b96e56177bf15dde64a8ac9ce72ac9834c6"},
"telemetry_poller": {:hex, :telemetry_poller, "1.0.0", "db91bb424e07f2bb6e73926fcafbfcbcb295f0193e0a00e825e589a0a47e8453", [:rebar3], [{:telemetry, "~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "b3a24eafd66c3f42da30fc3ca7dda1e9d546c12250a2d60d7b81d264fbec4f6e"}, "telemetry_poller": {:hex, :telemetry_poller, "1.0.0", "db91bb424e07f2bb6e73926fcafbfcbcb295f0193e0a00e825e589a0a47e8453", [:rebar3], [{:telemetry, "~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "b3a24eafd66c3f42da30fc3ca7dda1e9d546c12250a2d60d7b81d264fbec4f6e"},
} }

View File

@ -10,8 +10,8 @@
msgid "" msgid ""
msgstr "" msgstr ""
#: lib/cannery_web/live/ammo_group_live/index.ex:44 #: lib/cannery_web/live/ammo_group_live/index.ex:54
#: lib/cannery_web/live/ammo_group_live/index.ex:50 #: lib/cannery_web/live/ammo_group_live/index.ex:62
#: lib/cannery_web/live/ammo_group_live/index.html.heex:40 #: lib/cannery_web/live/ammo_group_live/index.html.heex:40
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Add Ammo" msgid "Add Ammo"
@ -49,7 +49,7 @@ msgstr ""
msgid "Create Invite" msgid "Create Invite"
msgstr "" msgstr ""
#: lib/cannery_web/templates/user_settings/edit.html.heex:157 #: lib/cannery_web/templates/user_settings/edit.html.heex:162
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Delete User" msgid "Delete User"
msgstr "" msgstr ""
@ -121,7 +121,7 @@ msgid "Reset password"
msgstr "" msgstr ""
#: lib/cannery_web/components/add_shot_group_component.html.heex:53 #: lib/cannery_web/components/add_shot_group_component.html.heex:53
#: lib/cannery_web/live/ammo_group_live/form_component.html.heex:73 #: lib/cannery_web/live/ammo_group_live/form_component.html.heex:81
#: lib/cannery_web/live/ammo_type_live/form_component.html.heex:156 #: lib/cannery_web/live/ammo_type_live/form_component.html.heex:156
#: lib/cannery_web/live/container_live/form_component.html.heex:50 #: lib/cannery_web/live/container_live/form_component.html.heex:50
#: lib/cannery_web/live/invite_live/form_component.html.heex:31 #: lib/cannery_web/live/invite_live/form_component.html.heex:31
@ -136,7 +136,7 @@ msgstr ""
msgid "Send instructions to reset password" msgid "Send instructions to reset password"
msgstr "" msgstr ""
#: lib/cannery_web/live/container_live/show.html.heex:72 #: lib/cannery_web/live/container_live/show.html.heex:80
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Why not add one?" msgid "Why not add one?"
msgstr "" msgstr ""
@ -156,9 +156,9 @@ msgstr ""
msgid "Why not get some ready to shoot?" msgid "Why not get some ready to shoot?"
msgstr "" msgstr ""
#: lib/cannery_web/live/ammo_group_live/index.ex:199 #: lib/cannery_web/live/ammo_group_live/index.html.heex:100
#: lib/cannery_web/live/ammo_group_live/show.html.heex:101 #: lib/cannery_web/live/ammo_group_live/show.html.heex:101
#: lib/cannery_web/live/range_live/index.html.heex:38 #: lib/cannery_web/live/range_live/index.html.heex:39
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Record shots" msgid "Record shots"
msgstr "" msgstr ""
@ -188,7 +188,7 @@ msgstr ""
msgid "add a container first" msgid "add a container first"
msgstr "" msgstr ""
#: lib/cannery_web/live/ammo_group_live/form_component.html.heex:66 #: lib/cannery_web/live/ammo_group_live/form_component.html.heex:74
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Create" msgid "Create"
msgstr "" msgstr ""
@ -198,7 +198,7 @@ msgstr ""
msgid "Change Language" msgid "Change Language"
msgstr "" msgstr ""
#: lib/cannery_web/templates/user_settings/edit.html.heex:134 #: lib/cannery_web/templates/user_settings/edit.html.heex:139
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Change language" msgid "Change language"
msgstr "" msgstr ""
@ -233,24 +233,19 @@ msgstr ""
msgid "Set Unlimited" msgid "Set Unlimited"
msgstr "" msgstr ""
#: lib/cannery_web/live/container_live/show.html.heex:97
#, elixir-autogen, elixir-format
msgid "Show used"
msgstr ""
#: lib/cannery_web/live/ammo_group_live/show.html.heex:86 #: lib/cannery_web/live/ammo_group_live/show.html.heex:86
#: lib/cannery_web/live/range_live/index.html.heex:31 #: lib/cannery_web/live/range_live/index.html.heex:32
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Stage for range" msgid "Stage for range"
msgstr "" msgstr ""
#: lib/cannery_web/live/ammo_group_live/show.html.heex:85 #: lib/cannery_web/live/ammo_group_live/show.html.heex:85
#: lib/cannery_web/live/range_live/index.html.heex:30 #: lib/cannery_web/live/range_live/index.html.heex:31
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Unstage from range" msgid "Unstage from range"
msgstr "" msgstr ""
#: lib/cannery_web/templates/user_settings/edit.html.heex:148 #: lib/cannery_web/templates/user_settings/edit.html.heex:153
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Export Data as JSON" msgid "Export Data as JSON"
msgstr "" msgstr ""

View File

@ -23,8 +23,8 @@ msgstr ""
## Run "mix gettext.extract" to bring this file up to ## Run "mix gettext.extract" to bring this file up to
## date. Leave "msgstr"s empty as changing them here has no ## date. Leave "msgstr"s empty as changing them here has no
## effect: edit them in PO (.po) files instead. ## effect: edit them in PO (.po) files instead.
#: lib/cannery_web/live/ammo_group_live/index.ex:44 #: lib/cannery_web/live/ammo_group_live/index.ex:54
#: lib/cannery_web/live/ammo_group_live/index.ex:50 #: lib/cannery_web/live/ammo_group_live/index.ex:62
#: lib/cannery_web/live/ammo_group_live/index.html.heex:40 #: lib/cannery_web/live/ammo_group_live/index.html.heex:40
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Add Ammo" msgid "Add Ammo"
@ -62,7 +62,7 @@ msgstr "Passwort ändern"
msgid "Create Invite" msgid "Create Invite"
msgstr "Einladung erstellen" msgstr "Einladung erstellen"
#: lib/cannery_web/templates/user_settings/edit.html.heex:157 #: lib/cannery_web/templates/user_settings/edit.html.heex:162
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Delete User" msgid "Delete User"
msgstr "Benutzer löschen" msgstr "Benutzer löschen"
@ -134,7 +134,7 @@ msgid "Reset password"
msgstr "Passwort zurücksetzen" msgstr "Passwort zurücksetzen"
#: lib/cannery_web/components/add_shot_group_component.html.heex:53 #: lib/cannery_web/components/add_shot_group_component.html.heex:53
#: lib/cannery_web/live/ammo_group_live/form_component.html.heex:73 #: lib/cannery_web/live/ammo_group_live/form_component.html.heex:81
#: lib/cannery_web/live/ammo_type_live/form_component.html.heex:156 #: lib/cannery_web/live/ammo_type_live/form_component.html.heex:156
#: lib/cannery_web/live/container_live/form_component.html.heex:50 #: lib/cannery_web/live/container_live/form_component.html.heex:50
#: lib/cannery_web/live/invite_live/form_component.html.heex:31 #: lib/cannery_web/live/invite_live/form_component.html.heex:31
@ -149,7 +149,7 @@ msgstr "Speichern"
msgid "Send instructions to reset password" msgid "Send instructions to reset password"
msgstr "Anleitung zum Passwort zurücksetzen zusenden" msgstr "Anleitung zum Passwort zurücksetzen zusenden"
#: lib/cannery_web/live/container_live/show.html.heex:72 #: lib/cannery_web/live/container_live/show.html.heex:80
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Why not add one?" msgid "Why not add one?"
msgstr "Warum fügen Sie keine hinzu?" msgstr "Warum fügen Sie keine hinzu?"
@ -169,9 +169,9 @@ msgstr "Munition markieren"
msgid "Why not get some ready to shoot?" msgid "Why not get some ready to shoot?"
msgstr "Warum nicht einige für den Schießstand auswählen?" msgstr "Warum nicht einige für den Schießstand auswählen?"
#: lib/cannery_web/live/ammo_group_live/index.ex:199 #: lib/cannery_web/live/ammo_group_live/index.html.heex:100
#: lib/cannery_web/live/ammo_group_live/show.html.heex:101 #: lib/cannery_web/live/ammo_group_live/show.html.heex:101
#: lib/cannery_web/live/range_live/index.html.heex:38 #: lib/cannery_web/live/range_live/index.html.heex:39
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Record shots" msgid "Record shots"
msgstr "Schüsse dokumentieren" msgstr "Schüsse dokumentieren"
@ -201,7 +201,7 @@ msgstr "In die Zwischenablage kopieren"
msgid "add a container first" msgid "add a container first"
msgstr "Zuerst einen Behälter hinzufügen" msgstr "Zuerst einen Behälter hinzufügen"
#: lib/cannery_web/live/ammo_group_live/form_component.html.heex:66 #: lib/cannery_web/live/ammo_group_live/form_component.html.heex:74
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Create" msgid "Create"
msgstr "Erstellen" msgstr "Erstellen"
@ -211,7 +211,7 @@ msgstr "Erstellen"
msgid "Change Language" msgid "Change Language"
msgstr "Sprache wechseln" msgstr "Sprache wechseln"
#: lib/cannery_web/templates/user_settings/edit.html.heex:134 #: lib/cannery_web/templates/user_settings/edit.html.heex:139
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Change language" msgid "Change language"
msgstr "Sprache wechseln" msgstr "Sprache wechseln"
@ -246,24 +246,19 @@ msgstr ""
msgid "Set Unlimited" msgid "Set Unlimited"
msgstr "" msgstr ""
#: lib/cannery_web/live/container_live/show.html.heex:97
#, elixir-autogen, elixir-format
msgid "Show used"
msgstr ""
#: lib/cannery_web/live/ammo_group_live/show.html.heex:86 #: lib/cannery_web/live/ammo_group_live/show.html.heex:86
#: lib/cannery_web/live/range_live/index.html.heex:31 #: lib/cannery_web/live/range_live/index.html.heex:32
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Stage for range" msgid "Stage for range"
msgstr "" msgstr ""
#: lib/cannery_web/live/ammo_group_live/show.html.heex:85 #: lib/cannery_web/live/ammo_group_live/show.html.heex:85
#: lib/cannery_web/live/range_live/index.html.heex:30 #: lib/cannery_web/live/range_live/index.html.heex:31
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Unstage from range" msgid "Unstage from range"
msgstr "" msgstr ""
#: lib/cannery_web/templates/user_settings/edit.html.heex:148 #: lib/cannery_web/templates/user_settings/edit.html.heex:153
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Export Data as JSON" msgid "Export Data as JSON"
msgstr "" msgstr ""

File diff suppressed because it is too large Load Diff

View File

@ -23,18 +23,18 @@ msgstr ""
## Run "mix gettext.extract" to bring this file up to ## Run "mix gettext.extract" to bring this file up to
## date. Leave "msgstr"s empty as changing them here has no ## date. Leave "msgstr"s empty as changing them here has no
## effect: edit them in PO (.po) files instead. ## effect: edit them in PO (.po) files instead.
#: lib/cannery/containers.ex:140 #: lib/cannery/containers.ex:179
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Container must be empty before deleting" msgid "Container must be empty before deleting"
msgstr "Behälter muss vor dem Löschen leer sein" msgstr "Behälter muss vor dem Löschen leer sein"
#: lib/cannery_web/live/container_live/index.ex:88 #: lib/cannery_web/live/container_live/index.ex:92
#: lib/cannery_web/live/container_live/show.ex:71 #: lib/cannery_web/live/container_live/show.ex:73
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Could not delete %{name}: %{error}" msgid "Could not delete %{name}: %{error}"
msgstr "Konnte %{name} nicht löschen: %{error}" msgstr "Konnte %{name} nicht löschen: %{error}"
#: lib/cannery_web/live/container_live/index.ex:76 #: lib/cannery_web/live/container_live/index.ex:80
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Could not find that container" msgid "Could not find that container"
msgstr "Konnte Behälter nicht finden" msgstr "Konnte Behälter nicht finden"
@ -83,14 +83,14 @@ msgstr "Oops, etwas ist schiefgegangen. Bitte beachten Sie den Fehler unten."
msgid "Reset password link is invalid or it has expired." msgid "Reset password link is invalid or it has expired."
msgstr "Link zum Passwort zurücksetzen ist ungültig oder abgelaufen." msgstr "Link zum Passwort zurücksetzen ist ungültig oder abgelaufen."
#: lib/cannery_web/controllers/user_registration_controller.ex:25 #: lib/cannery_web/controllers/user_registration_controller.ex:24
#: lib/cannery_web/controllers/user_registration_controller.ex:56 #: lib/cannery_web/controllers/user_registration_controller.ex:55
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Sorry, public registration is disabled" msgid "Sorry, public registration is disabled"
msgstr "Entschuldigung, aber öffentliche Registrierung ist deaktiviert" msgstr "Entschuldigung, aber öffentliche Registrierung ist deaktiviert"
#: lib/cannery_web/controllers/user_registration_controller.ex:15 #: lib/cannery_web/controllers/user_registration_controller.ex:14
#: lib/cannery_web/controllers/user_registration_controller.ex:46 #: lib/cannery_web/controllers/user_registration_controller.ex:45
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Sorry, this invite was not found or expired" msgid "Sorry, this invite was not found or expired"
msgstr "" msgstr ""
@ -121,17 +121,17 @@ msgstr "Sie sind nicht berechtigt, diese Seite aufzurufen"
msgid "You are not authorized to view this page." msgid "You are not authorized to view this page."
msgstr "Sie sind nicht berechtigt, diese Seite aufzurufen." msgstr "Sie sind nicht berechtigt, diese Seite aufzurufen."
#: lib/cannery/accounts/user.ex:138 #: lib/cannery/accounts/user.ex:137
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "did not change" msgid "did not change"
msgstr "hat sich nicht geändert" msgstr "hat sich nicht geändert"
#: lib/cannery/accounts/user.ex:159 #: lib/cannery/accounts/user.ex:158
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "does not match password" msgid "does not match password"
msgstr "Passwort stimmt nicht überein" msgstr "Passwort stimmt nicht überein"
#: lib/cannery/accounts/user.ex:196 #: lib/cannery/accounts/user.ex:195
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "is not valid" msgid "is not valid"
msgstr "ist nicht gültig" msgstr "ist nicht gültig"
@ -141,7 +141,7 @@ msgstr "ist nicht gültig"
msgid "must have the @ sign and no spaces" msgid "must have the @ sign and no spaces"
msgstr "Muss ein @ Zeichen und keine Leerzeichen haben" msgstr "Muss ein @ Zeichen und keine Leerzeichen haben"
#: lib/cannery/tags.ex:40 #: lib/cannery/tags.ex:66
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Tag not found" msgid "Tag not found"
msgstr "Tag nicht gefunden" msgstr "Tag nicht gefunden"
@ -151,13 +151,13 @@ msgstr "Tag nicht gefunden"
msgid "Tag could not be added" msgid "Tag could not be added"
msgstr "Tag konnte nicht hinzugefügt werden" msgstr "Tag konnte nicht hinzugefügt werden"
#: lib/cannery/activity_log/shot_group.ex:123 #: lib/cannery/activity_log/shot_group.ex:122
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Count must be at least 1" msgid "Count must be at least 1"
msgstr "Anzahl muss mindestens 1 sein" msgstr "Anzahl muss mindestens 1 sein"
#: lib/cannery/activity_log/shot_group.ex:82 #: lib/cannery/activity_log/shot_group.ex:82
#: lib/cannery/activity_log/shot_group.ex:119 #: lib/cannery/activity_log/shot_group.ex:118
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Count must be less than %{count}" msgid "Count must be less than %{count}"
msgstr "Anzahl muss weniger als %{count} betragen" msgstr "Anzahl muss weniger als %{count} betragen"
@ -187,22 +187,22 @@ msgstr ""
"Ungültige Nummer an Kopien. Muss zwischen 1 and %{max} liegen. War " "Ungültige Nummer an Kopien. Muss zwischen 1 and %{max} liegen. War "
"%{multiplier}" "%{multiplier}"
#: lib/cannery/ammo.ex:587 #: lib/cannery/ammo.ex:686
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Invalid multiplier" msgid "Invalid multiplier"
msgstr "" msgstr ""
#: lib/cannery/ammo/ammo_group.ex:94 #: lib/cannery/ammo/ammo_group.ex:97
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Please select an ammo type and container" msgid "Please select an ammo type and container"
msgstr "" msgstr ""
#: lib/cannery/activity_log/shot_group.ex:77 #: lib/cannery_web/live/range_live/index.html.heex:69
#, elixir-autogen, elixir-format
msgid "Please select a valid user and ammo group"
msgstr ""
#: lib/cannery_web/live/range_live/index.html.heex:67
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Your browser does not support the canvas element." msgid "Your browser does not support the canvas element."
msgstr "" msgstr ""
#: lib/cannery/activity_log/shot_group.ex:77
#, elixir-autogen, elixir-format, fuzzy
msgid "Please select a valid user and ammo pack"
msgstr ""

View File

@ -31,11 +31,11 @@ msgstr ""
msgid "%{name} created successfully" msgid "%{name} created successfully"
msgstr "%{name} erfolgreich erstellt" msgstr "%{name} erfolgreich erstellt"
#: lib/cannery_web/live/ammo_type_live/index.ex:47 #: lib/cannery_web/live/ammo_type_live/index.ex:73
#: lib/cannery_web/live/ammo_type_live/show.ex:28 #: lib/cannery_web/live/ammo_type_live/show.ex:55
#: lib/cannery_web/live/invite_live/index.ex:53 #: lib/cannery_web/live/invite_live/index.ex:53
#: lib/cannery_web/live/invite_live/index.ex:133 #: lib/cannery_web/live/invite_live/index.ex:133
#: lib/cannery_web/live/tag_live/index.ex:38 #: lib/cannery_web/live/tag_live/index.ex:64
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "%{name} deleted succesfully" msgid "%{name} deleted succesfully"
msgstr "%{name} erfolgreich gelöscht" msgstr "%{name} erfolgreich gelöscht"
@ -50,8 +50,8 @@ msgstr "%{name} erfolgreich deaktiviert"
msgid "%{name} enabled succesfully" msgid "%{name} enabled succesfully"
msgstr "%{name} erfolgreich aktiviert" msgstr "%{name} erfolgreich aktiviert"
#: lib/cannery_web/live/container_live/index.ex:81 #: lib/cannery_web/live/container_live/index.ex:85
#: lib/cannery_web/live/container_live/show.ex:61 #: lib/cannery_web/live/container_live/show.ex:63
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "%{name} has been deleted" msgid "%{name} has been deleted"
msgstr "%{name} wurde gelöscht" msgstr "%{name} wurde gelöscht"
@ -74,11 +74,6 @@ msgstr "%{name} erfolgreich aktualisiert"
msgid "A link to confirm your email change has been sent to the new address." msgid "A link to confirm your email change has been sent to the new address."
msgstr "Eine Mail zum Bestätigen ihre Mailadresse wurde Ihnen zugesandt." msgstr "Eine Mail zum Bestätigen ihre Mailadresse wurde Ihnen zugesandt."
#: lib/cannery_web/live/ammo_group_live/index.ex:64
#, elixir-autogen, elixir-format
msgid "Ammo group deleted succesfully"
msgstr "Munitionsgruppe erfolgreich gelöscht"
#: lib/cannery_web/live/invite_live/index.html.heex:103 #: lib/cannery_web/live/invite_live/index.html.heex:103
#: lib/cannery_web/live/invite_live/index.html.heex:133 #: lib/cannery_web/live/invite_live/index.html.heex:133
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
@ -87,10 +82,10 @@ msgstr ""
"Sind Sie sicher, dass sie %{email} löschen möchten? Dies kann nicht " "Sind Sie sicher, dass sie %{email} löschen möchten? Dies kann nicht "
"zurückgenommen werden!" "zurückgenommen werden!"
#: lib/cannery_web/live/container_live/index.ex:223 #: lib/cannery_web/live/container_live/index.html.heex:92
#: lib/cannery_web/live/container_live/index.html.heex:73 #: lib/cannery_web/live/container_live/index.html.heex:136
#: lib/cannery_web/live/container_live/show.html.heex:51 #: lib/cannery_web/live/container_live/show.html.heex:59
#: lib/cannery_web/live/tag_live/index.html.heex:39 #: lib/cannery_web/live/tag_live/index.html.heex:64
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Are you sure you want to delete %{name}?" msgid "Are you sure you want to delete %{name}?"
msgstr "Sind Sie sicher, dass sie %{name} löschen möchten?" msgstr "Sind Sie sicher, dass sie %{name} löschen möchten?"
@ -100,13 +95,13 @@ msgstr "Sind Sie sicher, dass sie %{name} löschen möchten?"
msgid "Are you sure you want to delete the invite for %{name}?" msgid "Are you sure you want to delete the invite for %{name}?"
msgstr "Sind Sie sicher, dass sie die Einladung für %{name} löschen möchten?" msgstr "Sind Sie sicher, dass sie die Einladung für %{name} löschen möchten?"
#: lib/cannery_web/live/ammo_group_live/index.ex:242 #: lib/cannery_web/live/ammo_group_live/index.html.heex:152
#: lib/cannery_web/live/ammo_group_live/show.html.heex:75 #: lib/cannery_web/live/ammo_group_live/show.html.heex:75
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Are you sure you want to delete this ammo?" msgid "Are you sure you want to delete this ammo?"
msgstr "Sind Sie sicher, dass sie diese Munition löschen möchten?" msgstr "Sind Sie sicher, dass sie diese Munition löschen möchten?"
#: lib/cannery_web/templates/user_settings/edit.html.heex:155 #: lib/cannery_web/templates/user_settings/edit.html.heex:160
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Are you sure you want to delete your account?" msgid "Are you sure you want to delete your account?"
msgstr "Sind Sie sicher, dass sie Ihren Account löschen möchten?" msgstr "Sind Sie sicher, dass sie Ihren Account löschen möchten?"
@ -155,18 +150,18 @@ msgstr "Passwort erfolgreich zurückgesetzt."
msgid "Password updated successfully." msgid "Password updated successfully."
msgstr "Passwort erfolgreich geändert." msgstr "Passwort erfolgreich geändert."
#: lib/cannery_web/controllers/user_registration_controller.ex:74 #: lib/cannery_web/controllers/user_registration_controller.ex:73
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Please check your email to verify your account" msgid "Please check your email to verify your account"
msgstr "Bitte überprüfen Sie ihre Mailbox und bestätigen Sie das Nutzerkonto" msgstr "Bitte überprüfen Sie ihre Mailbox und bestätigen Sie das Nutzerkonto"
#: lib/cannery_web/live/home_live.ex:108 #: lib/cannery_web/live/home_live.ex:91
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Register to setup %{name}" msgid "Register to setup %{name}"
msgstr "Registrieren Sie sich, um %{name} zu bearbeiten" msgstr "Registrieren Sie sich, um %{name} zu bearbeiten"
#: lib/cannery_web/components/add_shot_group_component.html.heex:55 #: lib/cannery_web/components/add_shot_group_component.html.heex:55
#: lib/cannery_web/live/ammo_group_live/form_component.html.heex:74 #: lib/cannery_web/live/ammo_group_live/form_component.html.heex:82
#: lib/cannery_web/live/ammo_type_live/form_component.html.heex:157 #: lib/cannery_web/live/ammo_type_live/form_component.html.heex:157
#: lib/cannery_web/live/container_live/form_component.html.heex:52 #: lib/cannery_web/live/container_live/form_component.html.heex:52
#: lib/cannery_web/live/invite_live/form_component.html.heex:33 #: lib/cannery_web/live/invite_live/form_component.html.heex:33
@ -193,7 +188,7 @@ msgstr ""
msgid "%{name} added successfully" msgid "%{name} added successfully"
msgstr "%{name} erfolgreich hinzugefügt" msgstr "%{name} erfolgreich hinzugefügt"
#: lib/cannery_web/live/container_live/show.ex:37 #: lib/cannery_web/live/container_live/show.ex:39
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "%{tag_name} has been removed from %{container_name}" msgid "%{tag_name} has been removed from %{container_name}"
msgstr "%{tag_name} wurde von %{container_name} entfernt" msgstr "%{tag_name} wurde von %{container_name} entfernt"
@ -208,19 +203,19 @@ msgstr "Füge hinzu..."
msgid "Shots recorded successfully" msgid "Shots recorded successfully"
msgstr "Schüsse erfolgreich dokumentiert" msgstr "Schüsse erfolgreich dokumentiert"
#: lib/cannery_web/live/range_live/index.html.heex:27 #: lib/cannery_web/live/range_live/index.html.heex:28
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Are you sure you want to unstage this ammo?" msgid "Are you sure you want to unstage this ammo?"
msgstr "Sind sie sicher, dass Sie diese Munition demarkieren möchten?" msgstr "Sind sie sicher, dass Sie diese Munition demarkieren möchten?"
#: lib/cannery_web/live/ammo_group_live/show.ex:132 #: lib/cannery_web/live/ammo_group_live/show.ex:142
#: lib/cannery_web/live/range_live/index.ex:184 #: lib/cannery_web/live/range_live/index.html.heex:118
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Are you sure you want to delete this shot record?" msgid "Are you sure you want to delete this shot record?"
msgstr "Sind sie sicher, dass sie die Schießkladde löschen möchten?" msgstr "Sind sie sicher, dass sie die Schießkladde löschen möchten?"
#: lib/cannery_web/live/ammo_group_live/show.ex:78 #: lib/cannery_web/live/ammo_group_live/show.ex:83
#: lib/cannery_web/live/range_live/index.ex:54 #: lib/cannery_web/live/range_live/index.ex:80
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Shot records deleted succesfully" msgid "Shot records deleted succesfully"
msgstr "Schießkladde erfolgreich gelöscht" msgstr "Schießkladde erfolgreich gelöscht"
@ -256,12 +251,12 @@ msgstr "%{name} erfolgreich entfernt"
msgid "You'll need to" msgid "You'll need to"
msgstr "Sie müssen" msgstr "Sie müssen"
#: lib/cannery_web/live/ammo_group_live/form_component.html.heex:67 #: lib/cannery_web/live/ammo_group_live/form_component.html.heex:75
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Creating..." msgid "Creating..."
msgstr "Erstellen..." msgstr "Erstellen..."
#: lib/cannery_web/templates/user_settings/edit.html.heex:136 #: lib/cannery_web/templates/user_settings/edit.html.heex:141
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Are you sure you want to change your language?" msgid "Are you sure you want to change your language?"
msgstr "Möchten Sie die Sprache wechseln?" msgstr "Möchten Sie die Sprache wechseln?"
@ -271,12 +266,13 @@ msgstr "Möchten Sie die Sprache wechseln?"
msgid "Language updated successfully." msgid "Language updated successfully."
msgstr "Spracheinstellung gespeichert." msgstr "Spracheinstellung gespeichert."
#: lib/cannery_web/live/ammo_group_live/show.ex:50 #: lib/cannery_web/live/ammo_group_live/index.ex:89
#: lib/cannery_web/live/ammo_group_live/show.ex:55
#, elixir-autogen, elixir-format, fuzzy #, elixir-autogen, elixir-format, fuzzy
msgid "Ammo deleted succesfully" msgid "Ammo deleted succesfully"
msgstr "Munitionsgruppe erfolgreich gelöscht" msgstr "Munitionsgruppe erfolgreich gelöscht"
#: lib/cannery_web/live/range_live/index.ex:68 #: lib/cannery_web/live/range_live/index.ex:95
#, elixir-autogen, elixir-format, fuzzy #, elixir-autogen, elixir-format, fuzzy
msgid "Ammo unstaged succesfully" msgid "Ammo unstaged succesfully"
msgstr "Munition erfolgreich demarkiert" msgstr "Munition erfolgreich demarkiert"
@ -293,7 +289,7 @@ msgid_plural "Ammo added successfully"
msgstr[0] "Munitionsgruppe erfolgreich aktualisiert" msgstr[0] "Munitionsgruppe erfolgreich aktualisiert"
msgstr[1] "Munitionsgruppe erfolgreich aktualisiert" msgstr[1] "Munitionsgruppe erfolgreich aktualisiert"
#: lib/cannery_web/live/ammo_type_live/index.ex:232 #: lib/cannery_web/live/ammo_type_live/index.html.heex:90
#: lib/cannery_web/live/ammo_type_live/show.html.heex:28 #: lib/cannery_web/live/ammo_type_live/show.html.heex:28
#, elixir-autogen, elixir-format, fuzzy #, elixir-autogen, elixir-format, fuzzy
msgid "Are you sure you want to delete %{name}? This will delete all %{name} type ammo as well!" msgid "Are you sure you want to delete %{name}? This will delete all %{name} type ammo as well!"

File diff suppressed because it is too large Load Diff

View File

@ -9,10 +9,9 @@
msgid "" msgid ""
msgstr "" msgstr ""
"Language: en\n" "Language: en\n"
"Plural-Forms: nplurals=2\n"
#: lib/cannery_web/live/ammo_group_live/index.ex:44 #: lib/cannery_web/live/ammo_group_live/index.ex:54
#: lib/cannery_web/live/ammo_group_live/index.ex:50 #: lib/cannery_web/live/ammo_group_live/index.ex:62
#: lib/cannery_web/live/ammo_group_live/index.html.heex:40 #: lib/cannery_web/live/ammo_group_live/index.html.heex:40
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Add Ammo" msgid "Add Ammo"
@ -50,7 +49,7 @@ msgstr ""
msgid "Create Invite" msgid "Create Invite"
msgstr "" msgstr ""
#: lib/cannery_web/templates/user_settings/edit.html.heex:157 #: lib/cannery_web/templates/user_settings/edit.html.heex:162
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Delete User" msgid "Delete User"
msgstr "" msgstr ""
@ -122,7 +121,7 @@ msgid "Reset password"
msgstr "" msgstr ""
#: lib/cannery_web/components/add_shot_group_component.html.heex:53 #: lib/cannery_web/components/add_shot_group_component.html.heex:53
#: lib/cannery_web/live/ammo_group_live/form_component.html.heex:73 #: lib/cannery_web/live/ammo_group_live/form_component.html.heex:81
#: lib/cannery_web/live/ammo_type_live/form_component.html.heex:156 #: lib/cannery_web/live/ammo_type_live/form_component.html.heex:156
#: lib/cannery_web/live/container_live/form_component.html.heex:50 #: lib/cannery_web/live/container_live/form_component.html.heex:50
#: lib/cannery_web/live/invite_live/form_component.html.heex:31 #: lib/cannery_web/live/invite_live/form_component.html.heex:31
@ -137,7 +136,7 @@ msgstr ""
msgid "Send instructions to reset password" msgid "Send instructions to reset password"
msgstr "" msgstr ""
#: lib/cannery_web/live/container_live/show.html.heex:72 #: lib/cannery_web/live/container_live/show.html.heex:80
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Why not add one?" msgid "Why not add one?"
msgstr "" msgstr ""
@ -157,9 +156,9 @@ msgstr ""
msgid "Why not get some ready to shoot?" msgid "Why not get some ready to shoot?"
msgstr "" msgstr ""
#: lib/cannery_web/live/ammo_group_live/index.ex:199 #: lib/cannery_web/live/ammo_group_live/index.html.heex:100
#: lib/cannery_web/live/ammo_group_live/show.html.heex:101 #: lib/cannery_web/live/ammo_group_live/show.html.heex:101
#: lib/cannery_web/live/range_live/index.html.heex:38 #: lib/cannery_web/live/range_live/index.html.heex:39
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Record shots" msgid "Record shots"
msgstr "" msgstr ""
@ -189,7 +188,7 @@ msgstr ""
msgid "add a container first" msgid "add a container first"
msgstr "" msgstr ""
#: lib/cannery_web/live/ammo_group_live/form_component.html.heex:66 #: lib/cannery_web/live/ammo_group_live/form_component.html.heex:74
#, elixir-autogen, elixir-format, fuzzy #, elixir-autogen, elixir-format, fuzzy
msgid "Create" msgid "Create"
msgstr "" msgstr ""
@ -199,7 +198,7 @@ msgstr ""
msgid "Change Language" msgid "Change Language"
msgstr "" msgstr ""
#: lib/cannery_web/templates/user_settings/edit.html.heex:134 #: lib/cannery_web/templates/user_settings/edit.html.heex:139
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Change language" msgid "Change language"
msgstr "" msgstr ""
@ -234,24 +233,19 @@ msgstr ""
msgid "Set Unlimited" msgid "Set Unlimited"
msgstr "" msgstr ""
#: lib/cannery_web/live/container_live/show.html.heex:97
#, elixir-autogen, elixir-format
msgid "Show used"
msgstr ""
#: lib/cannery_web/live/ammo_group_live/show.html.heex:86 #: lib/cannery_web/live/ammo_group_live/show.html.heex:86
#: lib/cannery_web/live/range_live/index.html.heex:31 #: lib/cannery_web/live/range_live/index.html.heex:32
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Stage for range" msgid "Stage for range"
msgstr "" msgstr ""
#: lib/cannery_web/live/ammo_group_live/show.html.heex:85 #: lib/cannery_web/live/ammo_group_live/show.html.heex:85
#: lib/cannery_web/live/range_live/index.html.heex:30 #: lib/cannery_web/live/range_live/index.html.heex:31
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Unstage from range" msgid "Unstage from range"
msgstr "" msgstr ""
#: lib/cannery_web/templates/user_settings/edit.html.heex:148 #: lib/cannery_web/templates/user_settings/edit.html.heex:153
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Export Data as JSON" msgid "Export Data as JSON"
msgstr "" msgstr ""

File diff suppressed because it is too large Load Diff

View File

@ -9,7 +9,6 @@
msgid "" msgid ""
msgstr "" msgstr ""
"Language: en\n" "Language: en\n"
"Plural-Forms: nplurals=2\n"
#: lib/cannery/accounts/email.ex:30 #: lib/cannery/accounts/email.ex:30
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format

View File

@ -10,18 +10,18 @@ msgid ""
msgstr "" msgstr ""
"Language: en\n" "Language: en\n"
#: lib/cannery/containers.ex:140 #: lib/cannery/containers.ex:179
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Container must be empty before deleting" msgid "Container must be empty before deleting"
msgstr "" msgstr ""
#: lib/cannery_web/live/container_live/index.ex:88 #: lib/cannery_web/live/container_live/index.ex:92
#: lib/cannery_web/live/container_live/show.ex:71 #: lib/cannery_web/live/container_live/show.ex:73
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Could not delete %{name}: %{error}" msgid "Could not delete %{name}: %{error}"
msgstr "" msgstr ""
#: lib/cannery_web/live/container_live/index.ex:76 #: lib/cannery_web/live/container_live/index.ex:80
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Could not find that container" msgid "Could not find that container"
msgstr "" msgstr ""
@ -70,14 +70,14 @@ msgstr ""
msgid "Reset password link is invalid or it has expired." msgid "Reset password link is invalid or it has expired."
msgstr "" msgstr ""
#: lib/cannery_web/controllers/user_registration_controller.ex:25 #: lib/cannery_web/controllers/user_registration_controller.ex:24
#: lib/cannery_web/controllers/user_registration_controller.ex:56 #: lib/cannery_web/controllers/user_registration_controller.ex:55
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Sorry, public registration is disabled" msgid "Sorry, public registration is disabled"
msgstr "" msgstr ""
#: lib/cannery_web/controllers/user_registration_controller.ex:15 #: lib/cannery_web/controllers/user_registration_controller.ex:14
#: lib/cannery_web/controllers/user_registration_controller.ex:46 #: lib/cannery_web/controllers/user_registration_controller.ex:45
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Sorry, this invite was not found or expired" msgid "Sorry, this invite was not found or expired"
msgstr "" msgstr ""
@ -107,18 +107,18 @@ msgstr ""
msgid "You are not authorized to view this page." msgid "You are not authorized to view this page."
msgstr "" msgstr ""
#: lib/cannery/accounts/user.ex:138 #: lib/cannery/accounts/user.ex:137
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "did not change" msgid "did not change"
msgstr "" msgstr ""
#: lib/cannery/accounts/user.ex:159 #: lib/cannery/accounts/user.ex:158
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "does not match password" msgid "does not match password"
msgstr "" msgstr ""
## From Ecto.Changeset.put_change/3 ## From Ecto.Changeset.put_change/3
#: lib/cannery/accounts/user.ex:196 #: lib/cannery/accounts/user.ex:195
#, elixir-autogen, elixir-format, fuzzy #, elixir-autogen, elixir-format, fuzzy
msgid "is not valid" msgid "is not valid"
msgstr "" msgstr ""
@ -128,7 +128,7 @@ msgstr ""
msgid "must have the @ sign and no spaces" msgid "must have the @ sign and no spaces"
msgstr "" msgstr ""
#: lib/cannery/tags.ex:40 #: lib/cannery/tags.ex:66
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Tag not found" msgid "Tag not found"
msgstr "" msgstr ""
@ -138,13 +138,13 @@ msgstr ""
msgid "Tag could not be added" msgid "Tag could not be added"
msgstr "" msgstr ""
#: lib/cannery/activity_log/shot_group.ex:123 #: lib/cannery/activity_log/shot_group.ex:122
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Count must be at least 1" msgid "Count must be at least 1"
msgstr "" msgstr ""
#: lib/cannery/activity_log/shot_group.ex:82 #: lib/cannery/activity_log/shot_group.ex:82
#: lib/cannery/activity_log/shot_group.ex:119 #: lib/cannery/activity_log/shot_group.ex:118
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Count must be less than %{count}" msgid "Count must be less than %{count}"
msgstr "" msgstr ""
@ -170,22 +170,22 @@ msgstr ""
msgid "Invalid number of copies, must be between 1 and %{max}. Was %{multiplier}" msgid "Invalid number of copies, must be between 1 and %{max}. Was %{multiplier}"
msgstr "" msgstr ""
#: lib/cannery/ammo.ex:587 #: lib/cannery/ammo.ex:686
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Invalid multiplier" msgid "Invalid multiplier"
msgstr "" msgstr ""
#: lib/cannery/ammo/ammo_group.ex:94 #: lib/cannery/ammo/ammo_group.ex:97
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Please select an ammo type and container" msgid "Please select an ammo type and container"
msgstr "" msgstr ""
#: lib/cannery/activity_log/shot_group.ex:77 #: lib/cannery_web/live/range_live/index.html.heex:69
#, elixir-autogen, elixir-format
msgid "Please select a valid user and ammo group"
msgstr ""
#: lib/cannery_web/live/range_live/index.html.heex:67
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Your browser does not support the canvas element." msgid "Your browser does not support the canvas element."
msgstr "" msgstr ""
#: lib/cannery/activity_log/shot_group.ex:77
#, elixir-autogen, elixir-format, fuzzy
msgid "Please select a valid user and ammo pack"
msgstr ""

View File

@ -9,7 +9,6 @@
msgid "" msgid ""
msgstr "" msgstr ""
"Language: en\n" "Language: en\n"
"Plural-Forms: nplurals=2\n"
#: lib/cannery_web/live/ammo_type_live/form_component.ex:86 #: lib/cannery_web/live/ammo_type_live/form_component.ex:86
#: lib/cannery_web/live/container_live/form_component.ex:89 #: lib/cannery_web/live/container_live/form_component.ex:89
@ -19,11 +18,11 @@ msgstr ""
msgid "%{name} created successfully" msgid "%{name} created successfully"
msgstr "" msgstr ""
#: lib/cannery_web/live/ammo_type_live/index.ex:47 #: lib/cannery_web/live/ammo_type_live/index.ex:73
#: lib/cannery_web/live/ammo_type_live/show.ex:28 #: lib/cannery_web/live/ammo_type_live/show.ex:55
#: lib/cannery_web/live/invite_live/index.ex:53 #: lib/cannery_web/live/invite_live/index.ex:53
#: lib/cannery_web/live/invite_live/index.ex:133 #: lib/cannery_web/live/invite_live/index.ex:133
#: lib/cannery_web/live/tag_live/index.ex:38 #: lib/cannery_web/live/tag_live/index.ex:64
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "%{name} deleted succesfully" msgid "%{name} deleted succesfully"
msgstr "" msgstr ""
@ -38,8 +37,8 @@ msgstr ""
msgid "%{name} enabled succesfully" msgid "%{name} enabled succesfully"
msgstr "" msgstr ""
#: lib/cannery_web/live/container_live/index.ex:81 #: lib/cannery_web/live/container_live/index.ex:85
#: lib/cannery_web/live/container_live/show.ex:61 #: lib/cannery_web/live/container_live/show.ex:63
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "%{name} has been deleted" msgid "%{name} has been deleted"
msgstr "" msgstr ""
@ -62,21 +61,16 @@ msgstr ""
msgid "A link to confirm your email change has been sent to the new address." msgid "A link to confirm your email change has been sent to the new address."
msgstr "" msgstr ""
#: lib/cannery_web/live/ammo_group_live/index.ex:64
#, elixir-autogen, elixir-format
msgid "Ammo group deleted succesfully"
msgstr ""
#: lib/cannery_web/live/invite_live/index.html.heex:103 #: lib/cannery_web/live/invite_live/index.html.heex:103
#: lib/cannery_web/live/invite_live/index.html.heex:133 #: lib/cannery_web/live/invite_live/index.html.heex:133
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Are you sure you want to delete %{email}? This action is permanent!" msgid "Are you sure you want to delete %{email}? This action is permanent!"
msgstr "" msgstr ""
#: lib/cannery_web/live/container_live/index.ex:223 #: lib/cannery_web/live/container_live/index.html.heex:92
#: lib/cannery_web/live/container_live/index.html.heex:73 #: lib/cannery_web/live/container_live/index.html.heex:136
#: lib/cannery_web/live/container_live/show.html.heex:51 #: lib/cannery_web/live/container_live/show.html.heex:59
#: lib/cannery_web/live/tag_live/index.html.heex:39 #: lib/cannery_web/live/tag_live/index.html.heex:64
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Are you sure you want to delete %{name}?" msgid "Are you sure you want to delete %{name}?"
msgstr "" msgstr ""
@ -86,13 +80,13 @@ msgstr ""
msgid "Are you sure you want to delete the invite for %{name}?" msgid "Are you sure you want to delete the invite for %{name}?"
msgstr "" msgstr ""
#: lib/cannery_web/live/ammo_group_live/index.ex:242 #: lib/cannery_web/live/ammo_group_live/index.html.heex:152
#: lib/cannery_web/live/ammo_group_live/show.html.heex:75 #: lib/cannery_web/live/ammo_group_live/show.html.heex:75
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Are you sure you want to delete this ammo?" msgid "Are you sure you want to delete this ammo?"
msgstr "" msgstr ""
#: lib/cannery_web/templates/user_settings/edit.html.heex:155 #: lib/cannery_web/templates/user_settings/edit.html.heex:160
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Are you sure you want to delete your account?" msgid "Are you sure you want to delete your account?"
msgstr "" msgstr ""
@ -137,18 +131,18 @@ msgstr ""
msgid "Password updated successfully." msgid "Password updated successfully."
msgstr "" msgstr ""
#: lib/cannery_web/controllers/user_registration_controller.ex:74 #: lib/cannery_web/controllers/user_registration_controller.ex:73
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Please check your email to verify your account" msgid "Please check your email to verify your account"
msgstr "" msgstr ""
#: lib/cannery_web/live/home_live.ex:108 #: lib/cannery_web/live/home_live.ex:91
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Register to setup %{name}" msgid "Register to setup %{name}"
msgstr "" msgstr ""
#: lib/cannery_web/components/add_shot_group_component.html.heex:55 #: lib/cannery_web/components/add_shot_group_component.html.heex:55
#: lib/cannery_web/live/ammo_group_live/form_component.html.heex:74 #: lib/cannery_web/live/ammo_group_live/form_component.html.heex:82
#: lib/cannery_web/live/ammo_type_live/form_component.html.heex:157 #: lib/cannery_web/live/ammo_type_live/form_component.html.heex:157
#: lib/cannery_web/live/container_live/form_component.html.heex:52 #: lib/cannery_web/live/container_live/form_component.html.heex:52
#: lib/cannery_web/live/invite_live/form_component.html.heex:33 #: lib/cannery_web/live/invite_live/form_component.html.heex:33
@ -173,7 +167,7 @@ msgstr ""
msgid "%{name} added successfully" msgid "%{name} added successfully"
msgstr "" msgstr ""
#: lib/cannery_web/live/container_live/show.ex:37 #: lib/cannery_web/live/container_live/show.ex:39
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "%{tag_name} has been removed from %{container_name}" msgid "%{tag_name} has been removed from %{container_name}"
msgstr "" msgstr ""
@ -188,19 +182,19 @@ msgstr ""
msgid "Shots recorded successfully" msgid "Shots recorded successfully"
msgstr "" msgstr ""
#: lib/cannery_web/live/range_live/index.html.heex:27 #: lib/cannery_web/live/range_live/index.html.heex:28
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Are you sure you want to unstage this ammo?" msgid "Are you sure you want to unstage this ammo?"
msgstr "" msgstr ""
#: lib/cannery_web/live/ammo_group_live/show.ex:132 #: lib/cannery_web/live/ammo_group_live/show.ex:142
#: lib/cannery_web/live/range_live/index.ex:184 #: lib/cannery_web/live/range_live/index.html.heex:118
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Are you sure you want to delete this shot record?" msgid "Are you sure you want to delete this shot record?"
msgstr "" msgstr ""
#: lib/cannery_web/live/ammo_group_live/show.ex:78 #: lib/cannery_web/live/ammo_group_live/show.ex:83
#: lib/cannery_web/live/range_live/index.ex:54 #: lib/cannery_web/live/range_live/index.ex:80
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Shot records deleted succesfully" msgid "Shot records deleted succesfully"
msgstr "" msgstr ""
@ -236,12 +230,12 @@ msgstr ""
msgid "You'll need to" msgid "You'll need to"
msgstr "" msgstr ""
#: lib/cannery_web/live/ammo_group_live/form_component.html.heex:67 #: lib/cannery_web/live/ammo_group_live/form_component.html.heex:75
#, elixir-autogen, elixir-format, fuzzy #, elixir-autogen, elixir-format, fuzzy
msgid "Creating..." msgid "Creating..."
msgstr "" msgstr ""
#: lib/cannery_web/templates/user_settings/edit.html.heex:136 #: lib/cannery_web/templates/user_settings/edit.html.heex:141
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Are you sure you want to change your language?" msgid "Are you sure you want to change your language?"
msgstr "" msgstr ""
@ -251,12 +245,13 @@ msgstr ""
msgid "Language updated successfully." msgid "Language updated successfully."
msgstr "" msgstr ""
#: lib/cannery_web/live/ammo_group_live/show.ex:50 #: lib/cannery_web/live/ammo_group_live/index.ex:89
#: lib/cannery_web/live/ammo_group_live/show.ex:55
#, elixir-autogen, elixir-format, fuzzy #, elixir-autogen, elixir-format, fuzzy
msgid "Ammo deleted succesfully" msgid "Ammo deleted succesfully"
msgstr "" msgstr ""
#: lib/cannery_web/live/range_live/index.ex:68 #: lib/cannery_web/live/range_live/index.ex:95
#, elixir-autogen, elixir-format, fuzzy #, elixir-autogen, elixir-format, fuzzy
msgid "Ammo unstaged succesfully" msgid "Ammo unstaged succesfully"
msgstr "" msgstr ""
@ -273,7 +268,7 @@ msgid_plural "Ammo added successfully"
msgstr[0] "" msgstr[0] ""
msgstr[1] "" msgstr[1] ""
#: lib/cannery_web/live/ammo_type_live/index.ex:232 #: lib/cannery_web/live/ammo_type_live/index.html.heex:90
#: lib/cannery_web/live/ammo_type_live/show.html.heex:28 #: lib/cannery_web/live/ammo_type_live/show.html.heex:28
#, elixir-autogen, elixir-format, fuzzy #, elixir-autogen, elixir-format, fuzzy
msgid "Are you sure you want to delete %{name}? This will delete all %{name} type ammo as well!" msgid "Are you sure you want to delete %{name}? This will delete all %{name} type ammo as well!"

View File

@ -10,18 +10,18 @@
msgid "" msgid ""
msgstr "" msgstr ""
#: lib/cannery/containers.ex:140 #: lib/cannery/containers.ex:179
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Container must be empty before deleting" msgid "Container must be empty before deleting"
msgstr "" msgstr ""
#: lib/cannery_web/live/container_live/index.ex:88 #: lib/cannery_web/live/container_live/index.ex:92
#: lib/cannery_web/live/container_live/show.ex:71 #: lib/cannery_web/live/container_live/show.ex:73
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Could not delete %{name}: %{error}" msgid "Could not delete %{name}: %{error}"
msgstr "" msgstr ""
#: lib/cannery_web/live/container_live/index.ex:76 #: lib/cannery_web/live/container_live/index.ex:80
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Could not find that container" msgid "Could not find that container"
msgstr "" msgstr ""
@ -70,14 +70,14 @@ msgstr ""
msgid "Reset password link is invalid or it has expired." msgid "Reset password link is invalid or it has expired."
msgstr "" msgstr ""
#: lib/cannery_web/controllers/user_registration_controller.ex:25 #: lib/cannery_web/controllers/user_registration_controller.ex:24
#: lib/cannery_web/controllers/user_registration_controller.ex:56 #: lib/cannery_web/controllers/user_registration_controller.ex:55
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Sorry, public registration is disabled" msgid "Sorry, public registration is disabled"
msgstr "" msgstr ""
#: lib/cannery_web/controllers/user_registration_controller.ex:15 #: lib/cannery_web/controllers/user_registration_controller.ex:14
#: lib/cannery_web/controllers/user_registration_controller.ex:46 #: lib/cannery_web/controllers/user_registration_controller.ex:45
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Sorry, this invite was not found or expired" msgid "Sorry, this invite was not found or expired"
msgstr "" msgstr ""
@ -107,17 +107,17 @@ msgstr ""
msgid "You are not authorized to view this page." msgid "You are not authorized to view this page."
msgstr "" msgstr ""
#: lib/cannery/accounts/user.ex:138 #: lib/cannery/accounts/user.ex:137
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "did not change" msgid "did not change"
msgstr "" msgstr ""
#: lib/cannery/accounts/user.ex:159 #: lib/cannery/accounts/user.ex:158
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "does not match password" msgid "does not match password"
msgstr "" msgstr ""
#: lib/cannery/accounts/user.ex:196 #: lib/cannery/accounts/user.ex:195
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "is not valid" msgid "is not valid"
msgstr "" msgstr ""
@ -127,7 +127,7 @@ msgstr ""
msgid "must have the @ sign and no spaces" msgid "must have the @ sign and no spaces"
msgstr "" msgstr ""
#: lib/cannery/tags.ex:40 #: lib/cannery/tags.ex:66
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Tag not found" msgid "Tag not found"
msgstr "" msgstr ""
@ -137,13 +137,13 @@ msgstr ""
msgid "Tag could not be added" msgid "Tag could not be added"
msgstr "" msgstr ""
#: lib/cannery/activity_log/shot_group.ex:123 #: lib/cannery/activity_log/shot_group.ex:122
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Count must be at least 1" msgid "Count must be at least 1"
msgstr "" msgstr ""
#: lib/cannery/activity_log/shot_group.ex:82 #: lib/cannery/activity_log/shot_group.ex:82
#: lib/cannery/activity_log/shot_group.ex:119 #: lib/cannery/activity_log/shot_group.ex:118
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Count must be less than %{count}" msgid "Count must be less than %{count}"
msgstr "" msgstr ""
@ -169,22 +169,22 @@ msgstr ""
msgid "Invalid number of copies, must be between 1 and %{max}. Was %{multiplier}" msgid "Invalid number of copies, must be between 1 and %{max}. Was %{multiplier}"
msgstr "" msgstr ""
#: lib/cannery/ammo.ex:587 #: lib/cannery/ammo.ex:686
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Invalid multiplier" msgid "Invalid multiplier"
msgstr "" msgstr ""
#: lib/cannery/ammo/ammo_group.ex:94 #: lib/cannery/ammo/ammo_group.ex:97
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Please select an ammo type and container" msgid "Please select an ammo type and container"
msgstr "" msgstr ""
#: lib/cannery/activity_log/shot_group.ex:77 #: lib/cannery_web/live/range_live/index.html.heex:69
#, elixir-autogen, elixir-format
msgid "Please select a valid user and ammo group"
msgstr ""
#: lib/cannery_web/live/range_live/index.html.heex:67
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Your browser does not support the canvas element." msgid "Your browser does not support the canvas element."
msgstr "" msgstr ""
#: lib/cannery/activity_log/shot_group.ex:77
#, elixir-autogen, elixir-format
msgid "Please select a valid user and ammo pack"
msgstr ""

View File

@ -3,8 +3,8 @@ msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-05-21 19:45+0000\n" "POT-Creation-Date: 2022-05-21 19:45+0000\n"
"PO-Revision-Date: 2022-05-22 22:52+0000\n" "PO-Revision-Date: 2022-11-30 19:19+0000\n"
"Last-Translator: Hannah Winter <konhat@hotmail.es>\n" "Last-Translator: Brea Foga <breaardiente@gmail.com>\n"
"Language-Team: Spanish <https://weblate.bubbletea.dev/projects/cannery/" "Language-Team: Spanish <https://weblate.bubbletea.dev/projects/cannery/"
"actions/es/>\n" "actions/es/>\n"
"Language: es\n" "Language: es\n"
@ -12,7 +12,7 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n" "Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n" "Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 4.12.2\n" "X-Generator: Weblate 4.14.2\n"
## This file is a PO Template file. ## This file is a PO Template file.
## ##
@ -23,8 +23,8 @@ msgstr ""
## Run "mix gettext.extract" to bring this file up to ## Run "mix gettext.extract" to bring this file up to
## date. Leave "msgstr"s empty as changing them here has no ## date. Leave "msgstr"s empty as changing them here has no
## effect: edit them in PO (.po) files instead. ## effect: edit them in PO (.po) files instead.
#: lib/cannery_web/live/ammo_group_live/index.ex:44 #: lib/cannery_web/live/ammo_group_live/index.ex:54
#: lib/cannery_web/live/ammo_group_live/index.ex:50 #: lib/cannery_web/live/ammo_group_live/index.ex:62
#: lib/cannery_web/live/ammo_group_live/index.html.heex:40 #: lib/cannery_web/live/ammo_group_live/index.html.heex:40
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Add Ammo" msgid "Add Ammo"
@ -33,17 +33,17 @@ msgstr "Añadir Munición"
#: lib/cannery_web/live/ammo_group_live/index.html.heex:36 #: lib/cannery_web/live/ammo_group_live/index.html.heex:36
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Add your first box!" msgid "Add your first box!"
msgstr "" msgstr "¡Añade tu primera caja!"
#: lib/cannery_web/live/container_live/index.html.heex:13 #: lib/cannery_web/live/container_live/index.html.heex:13
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Add your first container!" msgid "Add your first container!"
msgstr "" msgstr "¡Añade tu primer contenedor!"
#: lib/cannery_web/live/ammo_type_live/index.html.heex:13 #: lib/cannery_web/live/ammo_type_live/index.html.heex:13
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Add your first type!" msgid "Add your first type!"
msgstr "" msgstr "¡Añade tu primer tipo!"
#: lib/cannery_web/templates/user_settings/edit.html.heex:15 #: lib/cannery_web/templates/user_settings/edit.html.heex:15
#: lib/cannery_web/templates/user_settings/edit.html.heex:44 #: lib/cannery_web/templates/user_settings/edit.html.heex:44
@ -62,7 +62,7 @@ msgstr "Cambiar contraseña"
msgid "Create Invite" msgid "Create Invite"
msgstr "Crear Invitación" msgstr "Crear Invitación"
#: lib/cannery_web/templates/user_settings/edit.html.heex:157 #: lib/cannery_web/templates/user_settings/edit.html.heex:162
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Delete User" msgid "Delete User"
msgstr "Eliminar cuenta de Usuario" msgstr "Eliminar cuenta de Usuario"
@ -77,7 +77,7 @@ msgstr "¿Has olvidado tu contraseña?"
#: lib/cannery_web/live/invite_live/index.html.heex:13 #: lib/cannery_web/live/invite_live/index.html.heex:13
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Invite someone new!" msgid "Invite someone new!"
msgstr "" msgstr "¡Invita a alguien nuevo!"
#: lib/cannery_web/components/topbar.ex:137 #: lib/cannery_web/components/topbar.ex:137
#: lib/cannery_web/templates/user_confirmation/new.html.heex:30 #: lib/cannery_web/templates/user_confirmation/new.html.heex:30
@ -88,27 +88,27 @@ msgstr ""
#: lib/cannery_web/templates/user_session/new.html.heex:33 #: lib/cannery_web/templates/user_session/new.html.heex:33
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Log in" msgid "Log in"
msgstr "" msgstr "Entrar"
#: lib/cannery_web/live/tag_live/index.html.heex:15 #: lib/cannery_web/live/tag_live/index.html.heex:15
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Make your first tag!" msgid "Make your first tag!"
msgstr "" msgstr "¡Aplica tu primera etiqueta!"
#: lib/cannery_web/live/ammo_type_live/index.html.heex:17 #: lib/cannery_web/live/ammo_type_live/index.html.heex:17
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "New Ammo type" msgid "New Ammo type"
msgstr "" msgstr "Nuevo tipo de Munición"
#: lib/cannery_web/live/container_live/index.html.heex:17 #: lib/cannery_web/live/container_live/index.html.heex:17
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "New Container" msgid "New Container"
msgstr "" msgstr "Nuevo Contenedor"
#: lib/cannery_web/live/tag_live/index.html.heex:19 #: lib/cannery_web/live/tag_live/index.html.heex:19
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "New Tag" msgid "New Tag"
msgstr "" msgstr "Nueva Etiqueta"
#: lib/cannery_web/components/topbar.ex:128 #: lib/cannery_web/components/topbar.ex:128
#: lib/cannery_web/templates/user_confirmation/new.html.heex:26 #: lib/cannery_web/templates/user_confirmation/new.html.heex:26
@ -119,22 +119,22 @@ msgstr ""
#: lib/cannery_web/templates/user_session/new.html.heex:41 #: lib/cannery_web/templates/user_session/new.html.heex:41
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Register" msgid "Register"
msgstr "" msgstr "Registrarse"
#: lib/cannery_web/templates/user_confirmation/new.html.heex:3 #: lib/cannery_web/templates/user_confirmation/new.html.heex:3
#: lib/cannery_web/templates/user_confirmation/new.html.heex:16 #: lib/cannery_web/templates/user_confirmation/new.html.heex:16
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Resend confirmation instructions" msgid "Resend confirmation instructions"
msgstr "" msgstr "Reenviar instrucciones de confirmación"
#: lib/cannery_web/templates/user_reset_password/edit.html.heex:3 #: lib/cannery_web/templates/user_reset_password/edit.html.heex:3
#: lib/cannery_web/templates/user_reset_password/edit.html.heex:34 #: lib/cannery_web/templates/user_reset_password/edit.html.heex:34
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Reset password" msgid "Reset password"
msgstr "" msgstr "Resetear contraseña"
#: lib/cannery_web/components/add_shot_group_component.html.heex:53 #: lib/cannery_web/components/add_shot_group_component.html.heex:53
#: lib/cannery_web/live/ammo_group_live/form_component.html.heex:73 #: lib/cannery_web/live/ammo_group_live/form_component.html.heex:81
#: lib/cannery_web/live/ammo_type_live/form_component.html.heex:156 #: lib/cannery_web/live/ammo_type_live/form_component.html.heex:156
#: lib/cannery_web/live/container_live/form_component.html.heex:50 #: lib/cannery_web/live/container_live/form_component.html.heex:50
#: lib/cannery_web/live/invite_live/form_component.html.heex:31 #: lib/cannery_web/live/invite_live/form_component.html.heex:31
@ -142,128 +142,123 @@ msgstr ""
#: lib/cannery_web/live/tag_live/form_component.ex:91 #: lib/cannery_web/live/tag_live/form_component.ex:91
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Save" msgid "Save"
msgstr "" msgstr "Guardar"
#: lib/cannery_web/templates/user_reset_password/new.html.heex:16 #: lib/cannery_web/templates/user_reset_password/new.html.heex:16
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Send instructions to reset password" msgid "Send instructions to reset password"
msgstr "Enviar instrucciones para reestablecer contraseña" msgstr "Enviar instrucciones para reestablecer contraseña"
#: lib/cannery_web/live/container_live/show.html.heex:72 #: lib/cannery_web/live/container_live/show.html.heex:80
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Why not add one?" msgid "Why not add one?"
msgstr "" msgstr "¿Por qué no añadir una?"
#: lib/cannery_web/live/container_live/edit_tags_component.html.heex:53 #: lib/cannery_web/live/container_live/edit_tags_component.html.heex:53
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Add" msgid "Add"
msgstr "" msgstr "Añadir"
#: lib/cannery_web/live/range_live/index.html.heex:17 #: lib/cannery_web/live/range_live/index.html.heex:17
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Stage ammo" msgid "Stage ammo"
msgstr "" msgstr "Preparar munición"
#: lib/cannery_web/live/range_live/index.html.heex:13 #: lib/cannery_web/live/range_live/index.html.heex:13
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Why not get some ready to shoot?" msgid "Why not get some ready to shoot?"
msgstr "" msgstr "¿Por qué no preparar parte para disparar?"
#: lib/cannery_web/live/ammo_group_live/index.ex:199 #: lib/cannery_web/live/ammo_group_live/index.html.heex:100
#: lib/cannery_web/live/ammo_group_live/show.html.heex:101 #: lib/cannery_web/live/ammo_group_live/show.html.heex:101
#: lib/cannery_web/live/range_live/index.html.heex:38 #: lib/cannery_web/live/range_live/index.html.heex:39
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Record shots" msgid "Record shots"
msgstr "" msgstr "Tiros récord"
#: lib/cannery_web/components/move_ammo_group_component.ex:90 #: lib/cannery_web/components/move_ammo_group_component.ex:90
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Add another container!" msgid "Add another container!"
msgstr "" msgstr "¡Añade otro contenedor!"
#: lib/cannery_web/live/ammo_group_live/show.html.heex:94 #: lib/cannery_web/live/ammo_group_live/show.html.heex:94
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Move containers" msgid "Move containers"
msgstr "" msgstr "Mover contenedores"
#: lib/cannery_web/components/move_ammo_group_component.ex:126 #: lib/cannery_web/components/move_ammo_group_component.ex:126
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Select" msgid "Select"
msgstr "" msgstr "Seleccionar"
#: lib/cannery_web/live/invite_live/index.html.heex:31 #: lib/cannery_web/live/invite_live/index.html.heex:31
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Copy to clipboard" msgid "Copy to clipboard"
msgstr "" msgstr "Copiar al portapapeles"
#: lib/cannery_web/live/ammo_group_live/index.html.heex:21 #: lib/cannery_web/live/ammo_group_live/index.html.heex:21
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "add a container first" msgid "add a container first"
msgstr "" msgstr "añade primero un contenedor"
#: lib/cannery_web/live/ammo_group_live/form_component.html.heex:66 #: lib/cannery_web/live/ammo_group_live/form_component.html.heex:74
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Create" msgid "Create"
msgstr "" msgstr "Crear"
#: lib/cannery_web/templates/user_settings/edit.html.heex:113 #: lib/cannery_web/templates/user_settings/edit.html.heex:113
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Change Language" msgid "Change Language"
msgstr "" msgstr "Cambiar Lenguaje"
#: lib/cannery_web/templates/user_settings/edit.html.heex:134 #: lib/cannery_web/templates/user_settings/edit.html.heex:139
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Change language" msgid "Change language"
msgstr "" msgstr "Cambiar lenguaje"
#: lib/cannery_web/live/ammo_group_live/show.html.heex:60 #: lib/cannery_web/live/ammo_group_live/show.html.heex:60
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "View in Catalog" msgid "View in Catalog"
msgstr "" msgstr "Ver en Catalogo"
#: lib/cannery_web/live/ammo_group_live/index.html.heex:31 #: lib/cannery_web/live/ammo_group_live/index.html.heex:31
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "add an ammo type first" msgid "add an ammo type first"
msgstr "" msgstr "añade primero un tipo de munición"
#: lib/cannery_web/live/invite_live/index.html.heex:60 #: lib/cannery_web/live/invite_live/index.html.heex:60
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Disable" msgid "Disable"
msgstr "" msgstr "Desactivar"
#: lib/cannery_web/live/invite_live/index.html.heex:64 #: lib/cannery_web/live/invite_live/index.html.heex:64
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Enable" msgid "Enable"
msgstr "" msgstr "Activar"
#: lib/cannery_web/components/move_ammo_group_component.ex:80 #: lib/cannery_web/components/move_ammo_group_component.ex:80
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Move ammo" msgid "Move ammo"
msgstr "" msgstr "Mover munición"
#: lib/cannery_web/live/invite_live/index.html.heex:80 #: lib/cannery_web/live/invite_live/index.html.heex:80
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Set Unlimited" msgid "Set Unlimited"
msgstr "" msgstr "Activar ilimitados"
#: lib/cannery_web/live/container_live/show.html.heex:97
#, elixir-autogen, elixir-format
msgid "Show used"
msgstr ""
#: lib/cannery_web/live/ammo_group_live/show.html.heex:86 #: lib/cannery_web/live/ammo_group_live/show.html.heex:86
#: lib/cannery_web/live/range_live/index.html.heex:31 #: lib/cannery_web/live/range_live/index.html.heex:32
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Stage for range" msgid "Stage for range"
msgstr "" msgstr "Preparar para el campo de tiro"
#: lib/cannery_web/live/ammo_group_live/show.html.heex:85 #: lib/cannery_web/live/ammo_group_live/show.html.heex:85
#: lib/cannery_web/live/range_live/index.html.heex:30 #: lib/cannery_web/live/range_live/index.html.heex:31
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Unstage from range" msgid "Unstage from range"
msgstr "" msgstr "Desmontar del campo de tiro"
#: lib/cannery_web/templates/user_settings/edit.html.heex:148 #: lib/cannery_web/templates/user_settings/edit.html.heex:153
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Export Data as JSON" msgid "Export Data as JSON"
msgstr "" msgstr "Exportar datos como JSON"

File diff suppressed because it is too large Load Diff

View File

@ -3,8 +3,8 @@ msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-05-21 19:44+0000\n" "POT-Creation-Date: 2022-05-21 19:44+0000\n"
"PO-Revision-Date: 2022-05-22 22:52+0000\n" "PO-Revision-Date: 2022-11-30 19:19+0000\n"
"Last-Translator: Ed <ed.ylles1997@gmail.com>\n" "Last-Translator: Hannah Winter <konhat@hotmail.es>\n"
"Language-Team: Spanish <https://weblate.bubbletea.dev/projects/cannery/" "Language-Team: Spanish <https://weblate.bubbletea.dev/projects/cannery/"
"emails/es/>\n" "emails/es/>\n"
"Language: es\n" "Language: es\n"
@ -12,7 +12,7 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n" "Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n" "Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 4.12.2\n" "X-Generator: Weblate 4.14.2\n"
## This file is a PO Template file. ## This file is a PO Template file.
## ##
@ -41,23 +41,23 @@ msgstr "Hola %{email},"
#: lib/cannery_web/templates/email/confirm_email.txt.eex:10 #: lib/cannery_web/templates/email/confirm_email.txt.eex:10
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "If you didn't create an account at %{url}, please ignore this." msgid "If you didn't create an account at %{url}, please ignore this."
msgstr "" msgstr "Si no creó un usuario en %{url}, por favor, ignore este mensaje."
#: lib/cannery_web/templates/email/reset_password.txt.eex:8 #: lib/cannery_web/templates/email/reset_password.txt.eex:8
#: lib/cannery_web/templates/email/update_email.txt.eex:8 #: lib/cannery_web/templates/email/update_email.txt.eex:8
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "If you didn't request this change from %{url}, please ignore this." msgid "If you didn't request this change from %{url}, please ignore this."
msgstr "" msgstr "Si no pidió este cambio desde %{url}, por favor, ignore este mensaje."
#: lib/cannery/accounts/email.ex:37 #: lib/cannery/accounts/email.ex:37
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Reset your %{name} password" msgid "Reset your %{name} password"
msgstr "" msgstr "Reseteé su contraseña en %{name}"
#: lib/cannery/accounts/email.ex:44 #: lib/cannery/accounts/email.ex:44
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Update your %{name} email" msgid "Update your %{name} email"
msgstr "" msgstr "Actualice su correo en &{url}"
#: lib/cannery_web/templates/email/confirm_email.html.eex:9 #: lib/cannery_web/templates/email/confirm_email.html.eex:9
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
@ -95,20 +95,26 @@ msgstr ""
#: lib/cannery_web/templates/email/confirm_email.html.eex:22 #: lib/cannery_web/templates/email/confirm_email.html.eex:22
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "If you didn't create an account at %{name}, please ignore this." msgid "If you didn't create an account at %{name}, please ignore this."
msgstr "" msgstr "Si no ha creado una cuenta en %{name}, por favor, ignore este mensaje."
#: lib/cannery_web/templates/email/reset_password.html.eex:16 #: lib/cannery_web/templates/email/reset_password.html.eex:16
#: lib/cannery_web/templates/email/update_email.html.eex:16 #: lib/cannery_web/templates/email/update_email.html.eex:16
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "If you didn't request this change from %{name}, please ignore this." msgid "If you didn't request this change from %{name}, please ignore this."
msgstr "" msgstr ""
"Si no ha solicitado este cambio desde %{name}, por favor, ignore este "
"mensaje."
#: lib/cannery_web/templates/layout/email.txt.eex:9 #: lib/cannery_web/templates/layout/email.txt.eex:9
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "This email was sent from %{name} at %{url}, the self-hosted firearm tracker website." msgid "This email was sent from %{name} at %{url}, the self-hosted firearm tracker website."
msgstr "" msgstr ""
"Este correo se mandó por %{name} desde %{url}, la página de seguimiento de "
"armas autogestionada."
#: lib/cannery_web/templates/layout/email.html.heex:13 #: lib/cannery_web/templates/layout/email.html.heex:13
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "This email was sent from %{name}, the self-hosted firearm tracker website." msgid "This email was sent from %{name}, the self-hosted firearm tracker website."
msgstr "" msgstr ""
"Este correo se mandó por %{name}, la página de seguimiento de armas "
"autogestionada."

View File

@ -3,8 +3,8 @@ msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-05-21 19:44+0000\n" "POT-Creation-Date: 2022-05-21 19:44+0000\n"
"PO-Revision-Date: 2022-05-22 22:52+0000\n" "PO-Revision-Date: 2022-12-01 19:21+0000\n"
"Last-Translator: Ed <ed.ylles1997@gmail.com>\n" "Last-Translator: Brea Foga <breaardiente@gmail.com>\n"
"Language-Team: Spanish <https://weblate.bubbletea.dev/projects/cannery/" "Language-Team: Spanish <https://weblate.bubbletea.dev/projects/cannery/"
"errors/es/>\n" "errors/es/>\n"
"Language: es\n" "Language: es\n"
@ -12,7 +12,7 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n" "Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n" "Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 4.12.2\n" "X-Generator: Weblate 4.14.2\n"
## This file is a PO Template file. ## This file is a PO Template file.
## ##
@ -23,26 +23,26 @@ msgstr ""
## Run "mix gettext.extract" to bring this file up to ## Run "mix gettext.extract" to bring this file up to
## date. Leave "msgstr"s empty as changing them here has no ## date. Leave "msgstr"s empty as changing them here has no
## effect: edit them in PO (.po) files instead. ## effect: edit them in PO (.po) files instead.
#: lib/cannery/containers.ex:140 #: lib/cannery/containers.ex:179
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Container must be empty before deleting" msgid "Container must be empty before deleting"
msgstr "el Contenedor debe estar vac antes de borrarlo" msgstr "El contenedor debe estar vacío antes de ser borrado"
#: lib/cannery_web/live/container_live/index.ex:88 #: lib/cannery_web/live/container_live/index.ex:92
#: lib/cannery_web/live/container_live/show.ex:71 #: lib/cannery_web/live/container_live/show.ex:73
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Could not delete %{name}: %{error}" msgid "Could not delete %{name}: %{error}"
msgstr "No se pudo eliminar %{name}: %{error}" msgstr "No se pudo eliminar %{name}: %{error}"
#: lib/cannery_web/live/container_live/index.ex:76 #: lib/cannery_web/live/container_live/index.ex:80
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Could not find that container" msgid "Could not find that container"
msgstr "" msgstr "No se pudo encontrar el contenedor"
#: lib/cannery_web/controllers/user_settings_controller.ex:84 #: lib/cannery_web/controllers/user_settings_controller.ex:84
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Email change link is invalid or it has expired." msgid "Email change link is invalid or it has expired."
msgstr "" msgstr "El enlace de cambio de correo es inválido o ha expirado."
#: lib/cannery_web/templates/error/error.html.heex:8 #: lib/cannery_web/templates/error/error.html.heex:8
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
@ -52,22 +52,22 @@ msgstr "Error"
#: lib/cannery_web/templates/error/error.html.heex:28 #: lib/cannery_web/templates/error/error.html.heex:28
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Go back home" msgid "Go back home"
msgstr "" msgstr "Volver hacia atrás"
#: lib/cannery_web/views/error_view.ex:11 #: lib/cannery_web/views/error_view.ex:11
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Internal Server Error" msgid "Internal Server Error"
msgstr "" msgstr "Error interno del servidor"
#: lib/cannery_web/controllers/user_session_controller.ex:17 #: lib/cannery_web/controllers/user_session_controller.ex:17
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Invalid email or password" msgid "Invalid email or password"
msgstr "" msgstr "Correo o contraseña incorrecta"
#: lib/cannery_web/views/error_view.ex:9 #: lib/cannery_web/views/error_view.ex:9
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Not found" msgid "Not found"
msgstr "" msgstr "No se encontró"
#: lib/cannery_web/templates/user_registration/new.html.heex:16 #: 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_reset_password/edit.html.heex:16
@ -86,121 +86,121 @@ msgid "Reset password link is invalid or it has expired."
msgstr "" msgstr ""
"El enlace de reestablecimiento de la contraseña es inválido o ha caducado." "El enlace de reestablecimiento de la contraseña es inválido o ha caducado."
#: lib/cannery_web/controllers/user_registration_controller.ex:25 #: lib/cannery_web/controllers/user_registration_controller.ex:24
#: lib/cannery_web/controllers/user_registration_controller.ex:56 #: lib/cannery_web/controllers/user_registration_controller.ex:55
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Sorry, public registration is disabled" msgid "Sorry, public registration is disabled"
msgstr "" msgstr "Lo sentimos, el registro público no está habilitado"
#: lib/cannery_web/controllers/user_registration_controller.ex:15 #: lib/cannery_web/controllers/user_registration_controller.ex:14
#: lib/cannery_web/controllers/user_registration_controller.ex:46 #: lib/cannery_web/controllers/user_registration_controller.ex:45
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Sorry, this invite was not found or expired" msgid "Sorry, this invite was not found or expired"
msgstr "" msgstr "Lo sentimos, esta invitación no es válida o ha caducado"
#: lib/cannery_web/controllers/user_settings_controller.ex:99 #: lib/cannery_web/controllers/user_settings_controller.ex:99
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Unable to delete user" msgid "Unable to delete user"
msgstr "" msgstr "No se ha podido eliminar el usuario"
#: lib/cannery_web/views/error_view.ex:10 #: lib/cannery_web/views/error_view.ex:10
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Unauthorized" msgid "Unauthorized"
msgstr "" msgstr "No autorizado"
#: lib/cannery_web/controllers/user_confirmation_controller.ex:54 #: lib/cannery_web/controllers/user_confirmation_controller.ex:54
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "User confirmation link is invalid or it has expired." msgid "User confirmation link is invalid or it has expired."
msgstr "" msgstr "El enlace de confirmación de usuario no es válido o ha caducado."
#: lib/cannery_web/live/invite_live/index.ex:18 #: lib/cannery_web/live/invite_live/index.ex:18
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "You are not authorized to view this page" msgid "You are not authorized to view this page"
msgstr "" msgstr "No está autorizado a ver esta página"
#: lib/cannery_web/controllers/user_auth.ex:177 #: lib/cannery_web/controllers/user_auth.ex:177
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "You are not authorized to view this page." msgid "You are not authorized to view this page."
msgstr "" msgstr "No está autorizado a ver esta página."
#: lib/cannery/accounts/user.ex:138 #: lib/cannery/accounts/user.ex:137
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "did not change" msgid "did not change"
msgstr "" msgstr "no cambió"
#: lib/cannery/accounts/user.ex:159 #: lib/cannery/accounts/user.ex:158
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "does not match password" msgid "does not match password"
msgstr "" msgstr "no coincide con la contraseña"
#: lib/cannery/accounts/user.ex:196 #: lib/cannery/accounts/user.ex:195
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "is not valid" msgid "is not valid"
msgstr "" msgstr "no es válido"
#: lib/cannery/accounts/user.ex:92 #: lib/cannery/accounts/user.ex:92
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "must have the @ sign and no spaces" msgid "must have the @ sign and no spaces"
msgstr "" msgstr "debe tener el signo @ y no contener espacios"
#: lib/cannery/tags.ex:40 #: lib/cannery/tags.ex:66
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Tag not found" msgid "Tag not found"
msgstr "" msgstr "Etiqueta no encontrada"
#: lib/cannery_web/live/container_live/edit_tags_component.ex:30 #: lib/cannery_web/live/container_live/edit_tags_component.ex:30
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Tag could not be added" msgid "Tag could not be added"
msgstr "" msgstr "No se ha podido añadir la etiqueta"
#: lib/cannery/activity_log/shot_group.ex:123 #: lib/cannery/activity_log/shot_group.ex:122
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Count must be at least 1" msgid "Count must be at least 1"
msgstr "" msgstr "El recuento debe dar al menos 1"
#: lib/cannery/activity_log/shot_group.ex:82 #: lib/cannery/activity_log/shot_group.ex:82
#: lib/cannery/activity_log/shot_group.ex:119 #: lib/cannery/activity_log/shot_group.ex:118
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Count must be less than %{count}" msgid "Count must be less than %{count}"
msgstr "" msgstr "El recuento debe ser menos de %{count}"
#: lib/cannery_web/controllers/user_auth.ex:39 #: lib/cannery_web/controllers/user_auth.ex:39
#: lib/cannery_web/controllers/user_auth.ex:161 #: lib/cannery_web/controllers/user_auth.ex:161
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "You must confirm your account and log in to access this page." msgid "You must confirm your account and log in to access this page."
msgstr "" msgstr "Debe confirmar su cuenta e iniciar sesión para acceder a esta página."
#: lib/cannery_web/live/container_live/edit_tags_component.ex:52 #: lib/cannery_web/live/container_live/edit_tags_component.ex:52
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Tag could not be removed" msgid "Tag could not be removed"
msgstr "" msgstr "La etiqueta no pudo ser eliminada"
#: lib/cannery_web/live/ammo_group_live/form_component.ex:157 #: lib/cannery_web/live/ammo_group_live/form_component.ex:157
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Could not parse number of copies" msgid "Could not parse number of copies"
msgstr "" msgstr "No se ha podido procesar el número de copias"
#: lib/cannery_web/live/ammo_group_live/form_component.ex:142 #: lib/cannery_web/live/ammo_group_live/form_component.ex:142
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Invalid number of copies, must be between 1 and %{max}. Was %{multiplier}" msgid "Invalid number of copies, must be between 1 and %{max}. Was %{multiplier}"
msgstr "" msgstr "Número inválido de copias, debe ser entre 1 y %{max}. Fue %{multiplier"
#: lib/cannery/ammo.ex:587 #: lib/cannery/ammo.ex:686
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Invalid multiplier" msgid "Invalid multiplier"
msgstr "" msgstr "Multiplicador inválido"
#: lib/cannery/ammo/ammo_group.ex:94 #: lib/cannery/ammo/ammo_group.ex:97
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Please select an ammo type and container" msgid "Please select an ammo type and container"
msgstr "" msgstr "Por favor escoja un tipo de munición y un contenedor"
#: lib/cannery_web/live/range_live/index.html.heex:69
#, elixir-autogen, elixir-format
msgid "Your browser does not support the canvas element."
msgstr "Su navegador no es compatible con el elemento lienzo."
#: lib/cannery/activity_log/shot_group.ex:77 #: lib/cannery/activity_log/shot_group.ex:77
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Please select a valid user and ammo group" msgid "Please select a valid user and ammo pack"
msgstr "" msgstr "Por favor escoja un usuario y tipo de munición valido"
#: lib/cannery_web/live/range_live/index.html.heex:67
#, elixir-autogen, elixir-format
msgid "Your browser does not support the canvas element."
msgstr ""

View File

@ -3,8 +3,8 @@ msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-05-21 19:44+0000\n" "POT-Creation-Date: 2022-05-21 19:44+0000\n"
"PO-Revision-Date: 2022-06-06 19:05+0000\n" "PO-Revision-Date: 2022-11-30 19:19+0000\n"
"Last-Translator: Ed <ed.ylles1997@gmail.com>\n" "Last-Translator: Brea Foga <breaardiente@gmail.com>\n"
"Language-Team: Spanish <https://weblate.bubbletea.dev/projects/cannery/" "Language-Team: Spanish <https://weblate.bubbletea.dev/projects/cannery/"
"prompts/es/>\n" "prompts/es/>\n"
"Language: es\n" "Language: es\n"
@ -12,7 +12,7 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n" "Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n" "Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 4.12.2\n" "X-Generator: Weblate 4.14.2\n"
## This file is a PO Template file. ## This file is a PO Template file.
## ##
@ -31,11 +31,11 @@ msgstr ""
msgid "%{name} created successfully" msgid "%{name} created successfully"
msgstr "%{name} creado exitosamente" msgstr "%{name} creado exitosamente"
#: lib/cannery_web/live/ammo_type_live/index.ex:47 #: lib/cannery_web/live/ammo_type_live/index.ex:73
#: lib/cannery_web/live/ammo_type_live/show.ex:28 #: lib/cannery_web/live/ammo_type_live/show.ex:55
#: lib/cannery_web/live/invite_live/index.ex:53 #: lib/cannery_web/live/invite_live/index.ex:53
#: lib/cannery_web/live/invite_live/index.ex:133 #: lib/cannery_web/live/invite_live/index.ex:133
#: lib/cannery_web/live/tag_live/index.ex:38 #: lib/cannery_web/live/tag_live/index.ex:64
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "%{name} deleted succesfully" msgid "%{name} deleted succesfully"
msgstr "%{name} borrado exitosamente" msgstr "%{name} borrado exitosamente"
@ -50,8 +50,8 @@ msgstr "%{name} desactivado exitosamente"
msgid "%{name} enabled succesfully" msgid "%{name} enabled succesfully"
msgstr "%{name} activado exitosamente" msgstr "%{name} activado exitosamente"
#: lib/cannery_web/live/container_live/index.ex:81 #: lib/cannery_web/live/container_live/index.ex:85
#: lib/cannery_web/live/container_live/show.ex:61 #: lib/cannery_web/live/container_live/show.ex:63
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "%{name} has been deleted" msgid "%{name} has been deleted"
msgstr "%{name} ha sido borrado" msgstr "%{name} ha sido borrado"
@ -76,21 +76,16 @@ msgstr ""
"Un enlace para confirmar el correo electrónico ha sido enviado a la nueva " "Un enlace para confirmar el correo electrónico ha sido enviado a la nueva "
"dirección." "dirección."
#: lib/cannery_web/live/ammo_group_live/index.ex:64
#, elixir-autogen, elixir-format
msgid "Ammo group deleted succesfully"
msgstr "Grupo de Munición borrado exitosamente"
#: lib/cannery_web/live/invite_live/index.html.heex:103 #: lib/cannery_web/live/invite_live/index.html.heex:103
#: lib/cannery_web/live/invite_live/index.html.heex:133 #: lib/cannery_web/live/invite_live/index.html.heex:133
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Are you sure you want to delete %{email}? This action is permanent!" msgid "Are you sure you want to delete %{email}? This action is permanent!"
msgstr "Está seguro que desea eliminar %{email}? Esta acción es permanente!" msgstr "Está seguro que desea eliminar %{email}? Esta acción es permanente!"
#: lib/cannery_web/live/container_live/index.ex:223 #: lib/cannery_web/live/container_live/index.html.heex:92
#: lib/cannery_web/live/container_live/index.html.heex:73 #: lib/cannery_web/live/container_live/index.html.heex:136
#: lib/cannery_web/live/container_live/show.html.heex:51 #: lib/cannery_web/live/container_live/show.html.heex:59
#: lib/cannery_web/live/tag_live/index.html.heex:39 #: lib/cannery_web/live/tag_live/index.html.heex:64
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Are you sure you want to delete %{name}?" msgid "Are you sure you want to delete %{name}?"
msgstr "Está seguro que desea eliminar %{name}?" msgstr "Está seguro que desea eliminar %{name}?"
@ -100,13 +95,13 @@ msgstr "Está seguro que desea eliminar %{name}?"
msgid "Are you sure you want to delete the invite for %{name}?" msgid "Are you sure you want to delete the invite for %{name}?"
msgstr "Está seguro que quiere eliminar la invitación para %{name}?" msgstr "Está seguro que quiere eliminar la invitación para %{name}?"
#: lib/cannery_web/live/ammo_group_live/index.ex:242 #: lib/cannery_web/live/ammo_group_live/index.html.heex:152
#: lib/cannery_web/live/ammo_group_live/show.html.heex:75 #: lib/cannery_web/live/ammo_group_live/show.html.heex:75
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Are you sure you want to delete this ammo?" msgid "Are you sure you want to delete this ammo?"
msgstr "Está seguro que desea eliminar esta munición?" msgstr "Está seguro que desea eliminar esta munición?"
#: lib/cannery_web/templates/user_settings/edit.html.heex:155 #: lib/cannery_web/templates/user_settings/edit.html.heex:160
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Are you sure you want to delete your account?" msgid "Are you sure you want to delete your account?"
msgstr "Está seguro que desea eliminar su cuenta?" msgstr "Está seguro que desea eliminar su cuenta?"
@ -155,18 +150,18 @@ msgstr "Contraseña reiniciada exitosamente."
msgid "Password updated successfully." msgid "Password updated successfully."
msgstr "Contraseña cambiada exitosamente." msgstr "Contraseña cambiada exitosamente."
#: lib/cannery_web/controllers/user_registration_controller.ex:74 #: lib/cannery_web/controllers/user_registration_controller.ex:73
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Please check your email to verify your account" msgid "Please check your email to verify your account"
msgstr "Por favor chequea el correo para verificar tu cuenta" msgstr "Por favor chequea el correo para verificar tu cuenta"
#: lib/cannery_web/live/home_live.ex:108 #: lib/cannery_web/live/home_live.ex:91
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Register to setup %{name}" msgid "Register to setup %{name}"
msgstr "Regístrese para configurar %{name}" msgstr "Regístrese para configurar %{name}"
#: lib/cannery_web/components/add_shot_group_component.html.heex:55 #: lib/cannery_web/components/add_shot_group_component.html.heex:55
#: lib/cannery_web/live/ammo_group_live/form_component.html.heex:74 #: lib/cannery_web/live/ammo_group_live/form_component.html.heex:82
#: lib/cannery_web/live/ammo_type_live/form_component.html.heex:157 #: lib/cannery_web/live/ammo_type_live/form_component.html.heex:157
#: lib/cannery_web/live/container_live/form_component.html.heex:52 #: lib/cannery_web/live/container_live/form_component.html.heex:52
#: lib/cannery_web/live/invite_live/form_component.html.heex:33 #: lib/cannery_web/live/invite_live/form_component.html.heex:33
@ -192,7 +187,7 @@ msgstr ""
msgid "%{name} added successfully" msgid "%{name} added successfully"
msgstr "%{name} añadido exitosamente" msgstr "%{name} añadido exitosamente"
#: lib/cannery_web/live/container_live/show.ex:37 #: lib/cannery_web/live/container_live/show.ex:39
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "%{tag_name} has been removed from %{container_name}" msgid "%{tag_name} has been removed from %{container_name}"
msgstr "se ha removido %{tag_name} de %{container_name}" msgstr "se ha removido %{tag_name} de %{container_name}"
@ -207,93 +202,96 @@ msgstr "Añadiendo..."
msgid "Shots recorded successfully" msgid "Shots recorded successfully"
msgstr "Tiros registrados exitosamente" msgstr "Tiros registrados exitosamente"
#: lib/cannery_web/live/range_live/index.html.heex:27 #: lib/cannery_web/live/range_live/index.html.heex:28
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Are you sure you want to unstage this ammo?" msgid "Are you sure you want to unstage this ammo?"
msgstr "Está seguro que desea desmontar esta munición?" msgstr "Está seguro que desea desmontar esta munición?"
#: lib/cannery_web/live/ammo_group_live/show.ex:132 #: lib/cannery_web/live/ammo_group_live/show.ex:142
#: lib/cannery_web/live/range_live/index.ex:184 #: lib/cannery_web/live/range_live/index.html.heex:118
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Are you sure you want to delete this shot record?" msgid "Are you sure you want to delete this shot record?"
msgstr "" msgstr "¿Está segure que quiere borrar este récord de disparos?"
#: lib/cannery_web/live/ammo_group_live/show.ex:78 #: lib/cannery_web/live/ammo_group_live/show.ex:83
#: lib/cannery_web/live/range_live/index.ex:54 #: lib/cannery_web/live/range_live/index.ex:80
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Shot records deleted succesfully" msgid "Shot records deleted succesfully"
msgstr "" msgstr "Récord de disparos borrado exitosamente"
#: lib/cannery_web/live/range_live/form_component.ex:55 #: lib/cannery_web/live/range_live/form_component.ex:55
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Shot records updated successfully" msgid "Shot records updated successfully"
msgstr "" msgstr "Récord de disparos actualizado exitosamente"
#: lib/cannery_web/controllers/user_confirmation_controller.ex:38 #: lib/cannery_web/controllers/user_confirmation_controller.ex:38
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "%{email} confirmed successfully." msgid "%{email} confirmed successfully."
msgstr "" msgstr "%{email} confirmado exitosamente."
#: lib/cannery_web/components/move_ammo_group_component.ex:53 #: lib/cannery_web/components/move_ammo_group_component.ex:53
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Ammo moved to %{name} successfully" msgid "Ammo moved to %{name} successfully"
msgstr "" msgstr "Munición movida a %{name} exitosamente"
#: lib/cannery_web/live/invite_live/index.ex:121 #: lib/cannery_web/live/invite_live/index.ex:121
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Copied to clipboard" msgid "Copied to clipboard"
msgstr "" msgstr "Copiado al portapapeles"
#: lib/cannery_web/live/container_live/edit_tags_component.ex:58 #: lib/cannery_web/live/container_live/edit_tags_component.ex:58
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "%{name} removed successfully" msgid "%{name} removed successfully"
msgstr "" msgstr "%{name} eliminado exitosamente"
#: lib/cannery_web/live/ammo_group_live/index.html.heex:17 #: lib/cannery_web/live/ammo_group_live/index.html.heex:17
#: lib/cannery_web/live/ammo_group_live/index.html.heex:27 #: lib/cannery_web/live/ammo_group_live/index.html.heex:27
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "You'll need to" msgid "You'll need to"
msgstr "" msgstr "Necesitará hacerlo"
#: lib/cannery_web/live/ammo_group_live/form_component.html.heex:67 #: lib/cannery_web/live/ammo_group_live/form_component.html.heex:75
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Creating..." msgid "Creating..."
msgstr "" msgstr "Creando..."
#: lib/cannery_web/templates/user_settings/edit.html.heex:136 #: lib/cannery_web/templates/user_settings/edit.html.heex:141
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Are you sure you want to change your language?" msgid "Are you sure you want to change your language?"
msgstr "" msgstr "¿Está segure de que quiere cambiar el idioma?"
#: lib/cannery_web/controllers/user_settings_controller.ex:65 #: lib/cannery_web/controllers/user_settings_controller.ex:65
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Language updated successfully." msgid "Language updated successfully."
msgstr "" msgstr "Idioma cambiado exitosamente."
#: lib/cannery_web/live/ammo_group_live/show.ex:50 #: lib/cannery_web/live/ammo_group_live/index.ex:89
#, elixir-autogen, elixir-format, fuzzy #: lib/cannery_web/live/ammo_group_live/show.ex:55
#, elixir-autogen, elixir-format
msgid "Ammo deleted succesfully" msgid "Ammo deleted succesfully"
msgstr "" msgstr "Munición borrada exitosamente"
#: lib/cannery_web/live/range_live/index.ex:68 #: lib/cannery_web/live/range_live/index.ex:95
#, elixir-autogen, elixir-format, fuzzy #, elixir-autogen, elixir-format, fuzzy
msgid "Ammo unstaged succesfully" msgid "Ammo unstaged succesfully"
msgstr "" msgstr "Munición descargada exitosamente"
#: lib/cannery_web/live/ammo_group_live/form_component.ex:118 #: lib/cannery_web/live/ammo_group_live/form_component.ex:118
#, elixir-autogen, elixir-format, fuzzy #, elixir-autogen, elixir-format
msgid "Ammo updated successfully" msgid "Ammo updated successfully"
msgstr "" msgstr "Munición actualizada exitosamente"
#: lib/cannery_web/live/ammo_group_live/form_component.ex:178 #: lib/cannery_web/live/ammo_group_live/form_component.ex:178
#, elixir-autogen, elixir-format, fuzzy #, elixir-autogen, elixir-format
msgid "Ammo added successfully" msgid "Ammo added successfully"
msgid_plural "Ammo added successfully" msgid_plural "Ammo added successfully"
msgstr[0] "" msgstr[0] "Munición añadida exitosamente"
msgstr[1] "" msgstr[1] "Municiones añadidas exitosamente"
#: lib/cannery_web/live/ammo_type_live/index.ex:232 #: lib/cannery_web/live/ammo_type_live/index.html.heex:90
#: lib/cannery_web/live/ammo_type_live/show.html.heex:28 #: lib/cannery_web/live/ammo_type_live/show.html.heex:28
#, elixir-autogen, elixir-format, fuzzy #, elixir-autogen, elixir-format
msgid "Are you sure you want to delete %{name}? This will delete all %{name} type ammo as well!" msgid "Are you sure you want to delete %{name}? This will delete all %{name} type ammo as well!"
msgstr "" msgstr ""
"¿Está seguro de que quiere borrar %{name}? ¡Esto también borrará todos los "
"tipos de munición %{name}!"

View File

@ -23,8 +23,8 @@ msgstr ""
# # Run "mix gettext.extract" to bring this file up to # # Run "mix gettext.extract" to bring this file up to
# # date. Leave "msgstr"s empty as changing them here has no # # date. Leave "msgstr"s empty as changing them here has no
# # effect: edit them in PO (.po) files instead. # # effect: edit them in PO (.po) files instead.
#: lib/cannery_web/live/ammo_group_live/index.ex:44 #: lib/cannery_web/live/ammo_group_live/index.ex:54
#: lib/cannery_web/live/ammo_group_live/index.ex:50 #: lib/cannery_web/live/ammo_group_live/index.ex:62
#: lib/cannery_web/live/ammo_group_live/index.html.heex:40 #: lib/cannery_web/live/ammo_group_live/index.html.heex:40
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Add Ammo" msgid "Add Ammo"
@ -62,7 +62,7 @@ msgstr "Changer le mot de passe"
msgid "Create Invite" msgid "Create Invite"
msgstr "Créer une invitation" msgstr "Créer une invitation"
#: lib/cannery_web/templates/user_settings/edit.html.heex:157 #: lib/cannery_web/templates/user_settings/edit.html.heex:162
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Delete User" msgid "Delete User"
msgstr "Supprimer utilisateur" msgstr "Supprimer utilisateur"
@ -134,7 +134,7 @@ msgid "Reset password"
msgstr "Réinitialisé le mot de passe" msgstr "Réinitialisé le mot de passe"
#: lib/cannery_web/components/add_shot_group_component.html.heex:53 #: lib/cannery_web/components/add_shot_group_component.html.heex:53
#: lib/cannery_web/live/ammo_group_live/form_component.html.heex:73 #: lib/cannery_web/live/ammo_group_live/form_component.html.heex:81
#: lib/cannery_web/live/ammo_type_live/form_component.html.heex:156 #: lib/cannery_web/live/ammo_type_live/form_component.html.heex:156
#: lib/cannery_web/live/container_live/form_component.html.heex:50 #: lib/cannery_web/live/container_live/form_component.html.heex:50
#: lib/cannery_web/live/invite_live/form_component.html.heex:31 #: lib/cannery_web/live/invite_live/form_component.html.heex:31
@ -149,7 +149,7 @@ msgstr "Sauvegarder"
msgid "Send instructions to reset password" msgid "Send instructions to reset password"
msgstr "Envoyer les instructions pour réinitialiser le mot de passe" msgstr "Envoyer les instructions pour réinitialiser le mot de passe"
#: lib/cannery_web/live/container_live/show.html.heex:72 #: lib/cannery_web/live/container_live/show.html.heex:80
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Why not add one?" msgid "Why not add one?"
msgstr "Pourquoi pas en ajouter un?" msgstr "Pourquoi pas en ajouter un?"
@ -169,9 +169,9 @@ msgstr "Munition préparée"
msgid "Why not get some ready to shoot?" msgid "Why not get some ready to shoot?"
msgstr "Pourquoi pas en préparer pour tirer?" msgstr "Pourquoi pas en préparer pour tirer?"
#: lib/cannery_web/live/ammo_group_live/index.ex:199 #: lib/cannery_web/live/ammo_group_live/index.html.heex:100
#: lib/cannery_web/live/ammo_group_live/show.html.heex:101 #: lib/cannery_web/live/ammo_group_live/show.html.heex:101
#: lib/cannery_web/live/range_live/index.html.heex:38 #: lib/cannery_web/live/range_live/index.html.heex:39
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Record shots" msgid "Record shots"
msgstr "Enregistrer des tirs" msgstr "Enregistrer des tirs"
@ -201,7 +201,7 @@ msgstr "Copier dans le presse-papier"
msgid "add a container first" msgid "add a container first"
msgstr "ajouter un conteneur en premier" msgstr "ajouter un conteneur en premier"
#: lib/cannery_web/live/ammo_group_live/form_component.html.heex:66 #: lib/cannery_web/live/ammo_group_live/form_component.html.heex:74
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Create" msgid "Create"
msgstr "Créer" msgstr "Créer"
@ -211,7 +211,7 @@ msgstr "Créer"
msgid "Change Language" msgid "Change Language"
msgstr "Changer la langue" msgstr "Changer la langue"
#: lib/cannery_web/templates/user_settings/edit.html.heex:134 #: lib/cannery_web/templates/user_settings/edit.html.heex:139
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Change language" msgid "Change language"
msgstr "Changer la langue" msgstr "Changer la langue"
@ -246,24 +246,19 @@ msgstr ""
msgid "Set Unlimited" msgid "Set Unlimited"
msgstr "" msgstr ""
#: lib/cannery_web/live/container_live/show.html.heex:97
#, elixir-autogen, elixir-format
msgid "Show used"
msgstr ""
#: lib/cannery_web/live/ammo_group_live/show.html.heex:86 #: lib/cannery_web/live/ammo_group_live/show.html.heex:86
#: lib/cannery_web/live/range_live/index.html.heex:31 #: lib/cannery_web/live/range_live/index.html.heex:32
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Stage for range" msgid "Stage for range"
msgstr "" msgstr ""
#: lib/cannery_web/live/ammo_group_live/show.html.heex:85 #: lib/cannery_web/live/ammo_group_live/show.html.heex:85
#: lib/cannery_web/live/range_live/index.html.heex:30 #: lib/cannery_web/live/range_live/index.html.heex:31
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Unstage from range" msgid "Unstage from range"
msgstr "" msgstr ""
#: lib/cannery_web/templates/user_settings/edit.html.heex:148 #: lib/cannery_web/templates/user_settings/edit.html.heex:153
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Export Data as JSON" msgid "Export Data as JSON"
msgstr "" msgstr ""

File diff suppressed because it is too large Load Diff

View File

@ -23,18 +23,18 @@ msgstr ""
# # Run "mix gettext.extract" to bring this file up to # # Run "mix gettext.extract" to bring this file up to
# # date. Leave "msgstr"s empty as changing them here has no # # date. Leave "msgstr"s empty as changing them here has no
# # effect: edit them in PO (.po) files instead. # # effect: edit them in PO (.po) files instead.
#: lib/cannery/containers.ex:140 #: lib/cannery/containers.ex:179
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Container must be empty before deleting" msgid "Container must be empty before deleting"
msgstr "Le conteneur doit être vide pour être supprimé" msgstr "Le conteneur doit être vide pour être supprimé"
#: lib/cannery_web/live/container_live/index.ex:88 #: lib/cannery_web/live/container_live/index.ex:92
#: lib/cannery_web/live/container_live/show.ex:71 #: lib/cannery_web/live/container_live/show.ex:73
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Could not delete %{name}: %{error}" msgid "Could not delete %{name}: %{error}"
msgstr "Impossible de supprimer %{name} : %{error}" msgstr "Impossible de supprimer %{name} : %{error}"
#: lib/cannery_web/live/container_live/index.ex:76 #: lib/cannery_web/live/container_live/index.ex:80
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Could not find that container" msgid "Could not find that container"
msgstr "Impossible de trouver ce conteneur" msgstr "Impossible de trouver ce conteneur"
@ -85,14 +85,14 @@ msgstr ""
msgid "Reset password link is invalid or it has expired." msgid "Reset password link is invalid or it has expired."
msgstr "Le lien de réinitialisation de mot de passe est invalide ou expiré." msgstr "Le lien de réinitialisation de mot de passe est invalide ou expiré."
#: lib/cannery_web/controllers/user_registration_controller.ex:25 #: lib/cannery_web/controllers/user_registration_controller.ex:24
#: lib/cannery_web/controllers/user_registration_controller.ex:56 #: lib/cannery_web/controllers/user_registration_controller.ex:55
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Sorry, public registration is disabled" msgid "Sorry, public registration is disabled"
msgstr "Désolé, lenregistrement public est désactivé" msgstr "Désolé, lenregistrement public est désactivé"
#: lib/cannery_web/controllers/user_registration_controller.ex:15 #: lib/cannery_web/controllers/user_registration_controller.ex:14
#: lib/cannery_web/controllers/user_registration_controller.ex:46 #: lib/cannery_web/controllers/user_registration_controller.ex:45
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Sorry, this invite was not found or expired" msgid "Sorry, this invite was not found or expired"
msgstr "Désolé, cette invitation nest pas trouvée ou est expirée" msgstr "Désolé, cette invitation nest pas trouvée ou est expirée"
@ -122,17 +122,17 @@ msgstr "Vous nêtes pas autorisé·e à voir cette page"
msgid "You are not authorized to view this page." msgid "You are not authorized to view this page."
msgstr "Vous nêtes pas autorisé·e à voir cette page." msgstr "Vous nêtes pas autorisé·e à voir cette page."
#: lib/cannery/accounts/user.ex:138 #: lib/cannery/accounts/user.ex:137
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "did not change" msgid "did not change"
msgstr "est inchangé" msgstr "est inchangé"
#: lib/cannery/accounts/user.ex:159 #: lib/cannery/accounts/user.ex:158
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "does not match password" msgid "does not match password"
msgstr "le mot de passe ne correspond pas" msgstr "le mot de passe ne correspond pas"
#: lib/cannery/accounts/user.ex:196 #: lib/cannery/accounts/user.ex:195
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "is not valid" msgid "is not valid"
msgstr "nest pas valide" msgstr "nest pas valide"
@ -142,7 +142,7 @@ msgstr "nest pas valide"
msgid "must have the @ sign and no spaces" msgid "must have the @ sign and no spaces"
msgstr "doit contenir le symbole @ et aucune espace" msgstr "doit contenir le symbole @ et aucune espace"
#: lib/cannery/tags.ex:40 #: lib/cannery/tags.ex:66
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Tag not found" msgid "Tag not found"
msgstr "Tag pas trouvé" msgstr "Tag pas trouvé"
@ -152,13 +152,13 @@ msgstr "Tag pas trouvé"
msgid "Tag could not be added" msgid "Tag could not be added"
msgstr "Le tag na pas pu être ajouté" msgstr "Le tag na pas pu être ajouté"
#: lib/cannery/activity_log/shot_group.ex:123 #: lib/cannery/activity_log/shot_group.ex:122
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Count must be at least 1" msgid "Count must be at least 1"
msgstr "Le nombre doit être au moins égal à 1" msgstr "Le nombre doit être au moins égal à 1"
#: lib/cannery/activity_log/shot_group.ex:82 #: lib/cannery/activity_log/shot_group.ex:82
#: lib/cannery/activity_log/shot_group.ex:119 #: lib/cannery/activity_log/shot_group.ex:118
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Count must be less than %{count}" msgid "Count must be less than %{count}"
msgstr "La quantité doit être inférieur à %{count}" msgstr "La quantité doit être inférieur à %{count}"
@ -186,22 +186,22 @@ msgstr "Impossible d'analyser le nombre de copies"
msgid "Invalid number of copies, must be between 1 and %{max}. Was %{multiplier}" msgid "Invalid number of copies, must be between 1 and %{max}. Was %{multiplier}"
msgstr "Nombre de copies invalide, doit être 1 et %{max}. Été %{multiplier}" msgstr "Nombre de copies invalide, doit être 1 et %{max}. Été %{multiplier}"
#: lib/cannery/ammo.ex:587 #: lib/cannery/ammo.ex:686
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Invalid multiplier" msgid "Invalid multiplier"
msgstr "Multiplicateur invalide" msgstr "Multiplicateur invalide"
#: lib/cannery/ammo/ammo_group.ex:94 #: lib/cannery/ammo/ammo_group.ex:97
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Please select an ammo type and container" msgid "Please select an ammo type and container"
msgstr "Veuillez choisir un type de munitions et un conteneur" msgstr "Veuillez choisir un type de munitions et un conteneur"
#: lib/cannery/activity_log/shot_group.ex:77 #: lib/cannery_web/live/range_live/index.html.heex:69
#, elixir-autogen, elixir-format
msgid "Please select a valid user and ammo group"
msgstr "Veuillez choisir un utilisateur valide et un groupe de munitions"
#: lib/cannery_web/live/range_live/index.html.heex:67
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Your browser does not support the canvas element." msgid "Your browser does not support the canvas element."
msgstr "" msgstr ""
#: lib/cannery/activity_log/shot_group.ex:77
#, elixir-autogen, elixir-format, fuzzy
msgid "Please select a valid user and ammo pack"
msgstr "Veuillez choisir un utilisateur valide et un groupe de munitions"

View File

@ -31,11 +31,11 @@ msgstr ""
msgid "%{name} created successfully" msgid "%{name} created successfully"
msgstr "%{name} créé· avec succès" msgstr "%{name} créé· avec succès"
#: lib/cannery_web/live/ammo_type_live/index.ex:47 #: lib/cannery_web/live/ammo_type_live/index.ex:73
#: lib/cannery_web/live/ammo_type_live/show.ex:28 #: lib/cannery_web/live/ammo_type_live/show.ex:55
#: lib/cannery_web/live/invite_live/index.ex:53 #: lib/cannery_web/live/invite_live/index.ex:53
#: lib/cannery_web/live/invite_live/index.ex:133 #: lib/cannery_web/live/invite_live/index.ex:133
#: lib/cannery_web/live/tag_live/index.ex:38 #: lib/cannery_web/live/tag_live/index.ex:64
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "%{name} deleted succesfully" msgid "%{name} deleted succesfully"
msgstr "%{name} supprimé· avec succès" msgstr "%{name} supprimé· avec succès"
@ -50,8 +50,8 @@ msgstr "%{name} supprimé·e avec succès"
msgid "%{name} enabled succesfully" msgid "%{name} enabled succesfully"
msgstr "%{name} activé·e avec succès" msgstr "%{name} activé·e avec succès"
#: lib/cannery_web/live/container_live/index.ex:81 #: lib/cannery_web/live/container_live/index.ex:85
#: lib/cannery_web/live/container_live/show.ex:61 #: lib/cannery_web/live/container_live/show.ex:63
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "%{name} has been deleted" msgid "%{name} has been deleted"
msgstr "%{name} a été supprimé·e" msgstr "%{name} a été supprimé·e"
@ -76,11 +76,6 @@ msgstr ""
"Un lien pour confirmer votre changement de mél a été envoyé à la nouvelle " "Un lien pour confirmer votre changement de mél a été envoyé à la nouvelle "
"adresse." "adresse."
#: lib/cannery_web/live/ammo_group_live/index.ex:64
#, elixir-autogen, elixir-format
msgid "Ammo group deleted succesfully"
msgstr "Groupe de munition supprimé avec succès"
#: lib/cannery_web/live/invite_live/index.html.heex:103 #: lib/cannery_web/live/invite_live/index.html.heex:103
#: lib/cannery_web/live/invite_live/index.html.heex:133 #: lib/cannery_web/live/invite_live/index.html.heex:133
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
@ -88,10 +83,10 @@ msgid "Are you sure you want to delete %{email}? This action is permanent!"
msgstr "" msgstr ""
"Êtes-vous certain·e de supprimer %{email}? Cette action est définitive!" "Êtes-vous certain·e de supprimer %{email}? Cette action est définitive!"
#: lib/cannery_web/live/container_live/index.ex:223 #: lib/cannery_web/live/container_live/index.html.heex:92
#: lib/cannery_web/live/container_live/index.html.heex:73 #: lib/cannery_web/live/container_live/index.html.heex:136
#: lib/cannery_web/live/container_live/show.html.heex:51 #: lib/cannery_web/live/container_live/show.html.heex:59
#: lib/cannery_web/live/tag_live/index.html.heex:39 #: lib/cannery_web/live/tag_live/index.html.heex:64
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Are you sure you want to delete %{name}?" msgid "Are you sure you want to delete %{name}?"
msgstr "Êtes-vous certain·e de supprimer %{name}?" msgstr "Êtes-vous certain·e de supprimer %{name}?"
@ -101,13 +96,13 @@ msgstr "Êtes-vous certain·e de supprimer %{name}?"
msgid "Are you sure you want to delete the invite for %{name}?" msgid "Are you sure you want to delete the invite for %{name}?"
msgstr "Êtes-vous certain·e de supprimer linvitation pour %{name}?" msgstr "Êtes-vous certain·e de supprimer linvitation pour %{name}?"
#: lib/cannery_web/live/ammo_group_live/index.ex:242 #: lib/cannery_web/live/ammo_group_live/index.html.heex:152
#: lib/cannery_web/live/ammo_group_live/show.html.heex:75 #: lib/cannery_web/live/ammo_group_live/show.html.heex:75
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Are you sure you want to delete this ammo?" msgid "Are you sure you want to delete this ammo?"
msgstr "Êtes-vous certain·e de supprimer cette munition?" msgstr "Êtes-vous certain·e de supprimer cette munition?"
#: lib/cannery_web/templates/user_settings/edit.html.heex:155 #: lib/cannery_web/templates/user_settings/edit.html.heex:160
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Are you sure you want to delete your account?" msgid "Are you sure you want to delete your account?"
msgstr "Êtes-vous certain·e de supprimer votre compte?" msgstr "Êtes-vous certain·e de supprimer votre compte?"
@ -156,18 +151,18 @@ msgstr "Mot de passe réinitialiser avec succès."
msgid "Password updated successfully." msgid "Password updated successfully."
msgstr "Mot de passe mis à jour avec succès." msgstr "Mot de passe mis à jour avec succès."
#: lib/cannery_web/controllers/user_registration_controller.ex:74 #: lib/cannery_web/controllers/user_registration_controller.ex:73
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Please check your email to verify your account" msgid "Please check your email to verify your account"
msgstr "Veuillez vérifier votre mél pour confirmer votre compte" msgstr "Veuillez vérifier votre mél pour confirmer votre compte"
#: lib/cannery_web/live/home_live.ex:108 #: lib/cannery_web/live/home_live.ex:91
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Register to setup %{name}" msgid "Register to setup %{name}"
msgstr "Senregistrer pour mettre en place %{name}" msgstr "Senregistrer pour mettre en place %{name}"
#: lib/cannery_web/components/add_shot_group_component.html.heex:55 #: lib/cannery_web/components/add_shot_group_component.html.heex:55
#: lib/cannery_web/live/ammo_group_live/form_component.html.heex:74 #: lib/cannery_web/live/ammo_group_live/form_component.html.heex:82
#: lib/cannery_web/live/ammo_type_live/form_component.html.heex:157 #: lib/cannery_web/live/ammo_type_live/form_component.html.heex:157
#: lib/cannery_web/live/container_live/form_component.html.heex:52 #: lib/cannery_web/live/container_live/form_component.html.heex:52
#: lib/cannery_web/live/invite_live/form_component.html.heex:33 #: lib/cannery_web/live/invite_live/form_component.html.heex:33
@ -194,7 +189,7 @@ msgstr ""
msgid "%{name} added successfully" msgid "%{name} added successfully"
msgstr "%{name} a été ajouté avec succès" msgstr "%{name} a été ajouté avec succès"
#: lib/cannery_web/live/container_live/show.ex:37 #: lib/cannery_web/live/container_live/show.ex:39
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "%{tag_name} has been removed from %{container_name}" msgid "%{tag_name} has been removed from %{container_name}"
msgstr "%{tag_name} a été retiré de %{container_name}" msgstr "%{tag_name} a été retiré de %{container_name}"
@ -209,19 +204,19 @@ msgstr "Ajout en cours…"
msgid "Shots recorded successfully" msgid "Shots recorded successfully"
msgstr "Tirs enregistré avec succès" msgstr "Tirs enregistré avec succès"
#: lib/cannery_web/live/range_live/index.html.heex:27 #: lib/cannery_web/live/range_live/index.html.heex:28
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Are you sure you want to unstage this ammo?" msgid "Are you sure you want to unstage this ammo?"
msgstr "Êtes-vous certain·e de vouloir désélectionner cette munition?" msgstr "Êtes-vous certain·e de vouloir désélectionner cette munition?"
#: lib/cannery_web/live/ammo_group_live/show.ex:132 #: lib/cannery_web/live/ammo_group_live/show.ex:142
#: lib/cannery_web/live/range_live/index.ex:184 #: lib/cannery_web/live/range_live/index.html.heex:118
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Are you sure you want to delete this shot record?" msgid "Are you sure you want to delete this shot record?"
msgstr "Êtes-vous certain·e de vouloir supprimer cet enregistrement de tir?" msgstr "Êtes-vous certain·e de vouloir supprimer cet enregistrement de tir?"
#: lib/cannery_web/live/ammo_group_live/show.ex:78 #: lib/cannery_web/live/ammo_group_live/show.ex:83
#: lib/cannery_web/live/range_live/index.ex:54 #: lib/cannery_web/live/range_live/index.ex:80
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Shot records deleted succesfully" msgid "Shot records deleted succesfully"
msgstr "Enregistrements de tir supprimés avec succès" msgstr "Enregistrements de tir supprimés avec succès"
@ -257,12 +252,12 @@ msgstr "%{name} retiré avec succès"
msgid "You'll need to" msgid "You'll need to"
msgstr "Vous aurez besoin de" msgstr "Vous aurez besoin de"
#: lib/cannery_web/live/ammo_group_live/form_component.html.heex:67 #: lib/cannery_web/live/ammo_group_live/form_component.html.heex:75
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Creating..." msgid "Creating..."
msgstr "Création en cours…" msgstr "Création en cours…"
#: lib/cannery_web/templates/user_settings/edit.html.heex:136 #: lib/cannery_web/templates/user_settings/edit.html.heex:141
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Are you sure you want to change your language?" msgid "Are you sure you want to change your language?"
msgstr "Êtes-vous certain·e de vouloir changer votre langue?" msgstr "Êtes-vous certain·e de vouloir changer votre langue?"
@ -272,12 +267,13 @@ msgstr "Êtes-vous certain·e de vouloir changer votre langue?"
msgid "Language updated successfully." msgid "Language updated successfully."
msgstr "Langue mise à jour avec succès." msgstr "Langue mise à jour avec succès."
#: lib/cannery_web/live/ammo_group_live/show.ex:50 #: lib/cannery_web/live/ammo_group_live/index.ex:89
#: lib/cannery_web/live/ammo_group_live/show.ex:55
#, elixir-autogen, elixir-format, fuzzy #, elixir-autogen, elixir-format, fuzzy
msgid "Ammo deleted succesfully" msgid "Ammo deleted succesfully"
msgstr "Groupe de munition supprimé avec succès" msgstr "Groupe de munition supprimé avec succès"
#: lib/cannery_web/live/range_live/index.ex:68 #: lib/cannery_web/live/range_live/index.ex:95
#, elixir-autogen, elixir-format, fuzzy #, elixir-autogen, elixir-format, fuzzy
msgid "Ammo unstaged succesfully" msgid "Ammo unstaged succesfully"
msgstr "Groupe de munition désélectionner avec succès" msgstr "Groupe de munition désélectionner avec succès"
@ -294,7 +290,7 @@ msgid_plural "Ammo added successfully"
msgstr[0] "Groupe de munition mis à jour avec succès" msgstr[0] "Groupe de munition mis à jour avec succès"
msgstr[1] "Groupe de munition mis à jour avec succès" msgstr[1] "Groupe de munition mis à jour avec succès"
#: lib/cannery_web/live/ammo_type_live/index.ex:232 #: lib/cannery_web/live/ammo_type_live/index.html.heex:90
#: lib/cannery_web/live/ammo_type_live/show.html.heex:28 #: lib/cannery_web/live/ammo_type_live/show.html.heex:28
#, elixir-autogen, elixir-format, fuzzy #, elixir-autogen, elixir-format, fuzzy
msgid "Are you sure you want to delete %{name}? This will delete all %{name} type ammo as well!" msgid "Are you sure you want to delete %{name}? This will delete all %{name} type ammo as well!"

View File

@ -21,8 +21,8 @@ msgstr ""
## Run "mix gettext.extract" to bring this file up to ## Run "mix gettext.extract" to bring this file up to
## date. Leave "msgstr"s empty as changing them here has no ## date. Leave "msgstr"s empty as changing them here has no
## effect: edit them in PO (.po) files instead. ## effect: edit them in PO (.po) files instead.
#: lib/cannery_web/live/ammo_group_live/index.ex:44 #: lib/cannery_web/live/ammo_group_live/index.ex:54
#: lib/cannery_web/live/ammo_group_live/index.ex:50 #: lib/cannery_web/live/ammo_group_live/index.ex:62
#: lib/cannery_web/live/ammo_group_live/index.html.heex:40 #: lib/cannery_web/live/ammo_group_live/index.html.heex:40
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Add Ammo" msgid "Add Ammo"
@ -60,7 +60,7 @@ msgstr ""
msgid "Create Invite" msgid "Create Invite"
msgstr "" msgstr ""
#: lib/cannery_web/templates/user_settings/edit.html.heex:157 #: lib/cannery_web/templates/user_settings/edit.html.heex:162
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Delete User" msgid "Delete User"
msgstr "" msgstr ""
@ -132,7 +132,7 @@ msgid "Reset password"
msgstr "" msgstr ""
#: lib/cannery_web/components/add_shot_group_component.html.heex:53 #: lib/cannery_web/components/add_shot_group_component.html.heex:53
#: lib/cannery_web/live/ammo_group_live/form_component.html.heex:73 #: lib/cannery_web/live/ammo_group_live/form_component.html.heex:81
#: lib/cannery_web/live/ammo_type_live/form_component.html.heex:156 #: lib/cannery_web/live/ammo_type_live/form_component.html.heex:156
#: lib/cannery_web/live/container_live/form_component.html.heex:50 #: lib/cannery_web/live/container_live/form_component.html.heex:50
#: lib/cannery_web/live/invite_live/form_component.html.heex:31 #: lib/cannery_web/live/invite_live/form_component.html.heex:31
@ -147,7 +147,7 @@ msgstr ""
msgid "Send instructions to reset password" msgid "Send instructions to reset password"
msgstr "" msgstr ""
#: lib/cannery_web/live/container_live/show.html.heex:72 #: lib/cannery_web/live/container_live/show.html.heex:80
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Why not add one?" msgid "Why not add one?"
msgstr "" msgstr ""
@ -167,9 +167,9 @@ msgstr ""
msgid "Why not get some ready to shoot?" msgid "Why not get some ready to shoot?"
msgstr "" msgstr ""
#: lib/cannery_web/live/ammo_group_live/index.ex:199 #: lib/cannery_web/live/ammo_group_live/index.html.heex:100
#: lib/cannery_web/live/ammo_group_live/show.html.heex:101 #: lib/cannery_web/live/ammo_group_live/show.html.heex:101
#: lib/cannery_web/live/range_live/index.html.heex:38 #: lib/cannery_web/live/range_live/index.html.heex:39
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Record shots" msgid "Record shots"
msgstr "" msgstr ""
@ -199,7 +199,7 @@ msgstr ""
msgid "add a container first" msgid "add a container first"
msgstr "" msgstr ""
#: lib/cannery_web/live/ammo_group_live/form_component.html.heex:66 #: lib/cannery_web/live/ammo_group_live/form_component.html.heex:74
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Create" msgid "Create"
msgstr "" msgstr ""
@ -209,7 +209,7 @@ msgstr ""
msgid "Change Language" msgid "Change Language"
msgstr "" msgstr ""
#: lib/cannery_web/templates/user_settings/edit.html.heex:134 #: lib/cannery_web/templates/user_settings/edit.html.heex:139
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Change language" msgid "Change language"
msgstr "" msgstr ""
@ -244,24 +244,19 @@ msgstr ""
msgid "Set Unlimited" msgid "Set Unlimited"
msgstr "" msgstr ""
#: lib/cannery_web/live/container_live/show.html.heex:97
#, elixir-autogen, elixir-format
msgid "Show used"
msgstr ""
#: lib/cannery_web/live/ammo_group_live/show.html.heex:86 #: lib/cannery_web/live/ammo_group_live/show.html.heex:86
#: lib/cannery_web/live/range_live/index.html.heex:31 #: lib/cannery_web/live/range_live/index.html.heex:32
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Stage for range" msgid "Stage for range"
msgstr "" msgstr ""
#: lib/cannery_web/live/ammo_group_live/show.html.heex:85 #: lib/cannery_web/live/ammo_group_live/show.html.heex:85
#: lib/cannery_web/live/range_live/index.html.heex:30 #: lib/cannery_web/live/range_live/index.html.heex:31
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Unstage from range" msgid "Unstage from range"
msgstr "" msgstr ""
#: lib/cannery_web/templates/user_settings/edit.html.heex:148 #: lib/cannery_web/templates/user_settings/edit.html.heex:153
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Export Data as JSON" msgid "Export Data as JSON"
msgstr "" msgstr ""

File diff suppressed because it is too large Load Diff

View File

@ -24,18 +24,18 @@ msgstr ""
## Run "mix gettext.extract" to bring this file up to ## Run "mix gettext.extract" to bring this file up to
## date. Leave "msgstr"s empty as changing them here has no ## date. Leave "msgstr"s empty as changing them here has no
## effect: edit them in PO (.po) files instead. ## effect: edit them in PO (.po) files instead.
#: lib/cannery/containers.ex:140 #: lib/cannery/containers.ex:179
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Container must be empty before deleting" msgid "Container must be empty before deleting"
msgstr "Caithfidh an coimeádán a bheidh follamh roimh scriosadh" msgstr "Caithfidh an coimeádán a bheidh follamh roimh scriosadh"
#: lib/cannery_web/live/container_live/index.ex:88 #: lib/cannery_web/live/container_live/index.ex:92
#: lib/cannery_web/live/container_live/show.ex:71 #: lib/cannery_web/live/container_live/show.ex:73
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Could not delete %{name}: %{error}" msgid "Could not delete %{name}: %{error}"
msgstr "Ní feidir %{name} a scriosadh: %{error}" msgstr "Ní feidir %{name} a scriosadh: %{error}"
#: lib/cannery_web/live/container_live/index.ex:76 #: lib/cannery_web/live/container_live/index.ex:80
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Could not find that container" msgid "Could not find that container"
msgstr "Ní feidir an coimeádán sin a fáil" msgstr "Ní feidir an coimeádán sin a fáil"
@ -86,14 +86,14 @@ msgstr ""
msgid "Reset password link is invalid or it has expired." msgid "Reset password link is invalid or it has expired."
msgstr "Tá nasc an pasfhocail a athrú neamhbailí nó as dáta." msgstr "Tá nasc an pasfhocail a athrú neamhbailí nó as dáta."
#: lib/cannery_web/controllers/user_registration_controller.ex:25 #: lib/cannery_web/controllers/user_registration_controller.ex:24
#: lib/cannery_web/controllers/user_registration_controller.ex:56 #: lib/cannery_web/controllers/user_registration_controller.ex:55
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Sorry, public registration is disabled" msgid "Sorry, public registration is disabled"
msgstr "Tá brón orainn, tá clarú póiblí bactha" msgstr "Tá brón orainn, tá clarú póiblí bactha"
#: lib/cannery_web/controllers/user_registration_controller.ex:15 #: lib/cannery_web/controllers/user_registration_controller.ex:14
#: lib/cannery_web/controllers/user_registration_controller.ex:46 #: lib/cannery_web/controllers/user_registration_controller.ex:45
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Sorry, this invite was not found or expired" msgid "Sorry, this invite was not found or expired"
msgstr "Tá brón orainn, ní feidir an cuireadh seo a fáil nó tá sé as dáta" msgstr "Tá brón orainn, ní feidir an cuireadh seo a fáil nó tá sé as dáta"
@ -123,17 +123,17 @@ msgstr "Níl cead agaibh féachaint ar an leathanach seo"
msgid "You are not authorized to view this page." msgid "You are not authorized to view this page."
msgstr "Níl cead agaibh féachaint ar an leathanach seo." msgstr "Níl cead agaibh féachaint ar an leathanach seo."
#: lib/cannery/accounts/user.ex:138 #: lib/cannery/accounts/user.ex:137
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "did not change" msgid "did not change"
msgstr "Níor athraigh sé" msgstr "Níor athraigh sé"
#: lib/cannery/accounts/user.ex:159 #: lib/cannery/accounts/user.ex:158
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "does not match password" msgid "does not match password"
msgstr "" msgstr ""
#: lib/cannery/accounts/user.ex:196 #: lib/cannery/accounts/user.ex:195
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "is not valid" msgid "is not valid"
msgstr "" msgstr ""
@ -143,7 +143,7 @@ msgstr ""
msgid "must have the @ sign and no spaces" msgid "must have the @ sign and no spaces"
msgstr "" msgstr ""
#: lib/cannery/tags.ex:40 #: lib/cannery/tags.ex:66
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Tag not found" msgid "Tag not found"
msgstr "" msgstr ""
@ -153,13 +153,13 @@ msgstr ""
msgid "Tag could not be added" msgid "Tag could not be added"
msgstr "" msgstr ""
#: lib/cannery/activity_log/shot_group.ex:123 #: lib/cannery/activity_log/shot_group.ex:122
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Count must be at least 1" msgid "Count must be at least 1"
msgstr "" msgstr ""
#: lib/cannery/activity_log/shot_group.ex:82 #: lib/cannery/activity_log/shot_group.ex:82
#: lib/cannery/activity_log/shot_group.ex:119 #: lib/cannery/activity_log/shot_group.ex:118
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Count must be less than %{count}" msgid "Count must be less than %{count}"
msgstr "" msgstr ""
@ -185,22 +185,22 @@ msgstr ""
msgid "Invalid number of copies, must be between 1 and %{max}. Was %{multiplier}" msgid "Invalid number of copies, must be between 1 and %{max}. Was %{multiplier}"
msgstr "" msgstr ""
#: lib/cannery/ammo.ex:587 #: lib/cannery/ammo.ex:686
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Invalid multiplier" msgid "Invalid multiplier"
msgstr "" msgstr ""
#: lib/cannery/ammo/ammo_group.ex:94 #: lib/cannery/ammo/ammo_group.ex:97
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Please select an ammo type and container" msgid "Please select an ammo type and container"
msgstr "" msgstr ""
#: lib/cannery/activity_log/shot_group.ex:77 #: lib/cannery_web/live/range_live/index.html.heex:69
#, elixir-autogen, elixir-format
msgid "Please select a valid user and ammo group"
msgstr ""
#: lib/cannery_web/live/range_live/index.html.heex:67
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Your browser does not support the canvas element." msgid "Your browser does not support the canvas element."
msgstr "" msgstr ""
#: lib/cannery/activity_log/shot_group.ex:77
#, elixir-autogen, elixir-format, fuzzy
msgid "Please select a valid user and ammo pack"
msgstr ""

View File

@ -29,11 +29,11 @@ msgstr ""
msgid "%{name} created successfully" msgid "%{name} created successfully"
msgstr "" msgstr ""
#: lib/cannery_web/live/ammo_type_live/index.ex:47 #: lib/cannery_web/live/ammo_type_live/index.ex:73
#: lib/cannery_web/live/ammo_type_live/show.ex:28 #: lib/cannery_web/live/ammo_type_live/show.ex:55
#: lib/cannery_web/live/invite_live/index.ex:53 #: lib/cannery_web/live/invite_live/index.ex:53
#: lib/cannery_web/live/invite_live/index.ex:133 #: lib/cannery_web/live/invite_live/index.ex:133
#: lib/cannery_web/live/tag_live/index.ex:38 #: lib/cannery_web/live/tag_live/index.ex:64
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "%{name} deleted succesfully" msgid "%{name} deleted succesfully"
msgstr "" msgstr ""
@ -48,8 +48,8 @@ msgstr ""
msgid "%{name} enabled succesfully" msgid "%{name} enabled succesfully"
msgstr "" msgstr ""
#: lib/cannery_web/live/container_live/index.ex:81 #: lib/cannery_web/live/container_live/index.ex:85
#: lib/cannery_web/live/container_live/show.ex:61 #: lib/cannery_web/live/container_live/show.ex:63
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "%{name} has been deleted" msgid "%{name} has been deleted"
msgstr "" msgstr ""
@ -72,21 +72,16 @@ msgstr ""
msgid "A link to confirm your email change has been sent to the new address." msgid "A link to confirm your email change has been sent to the new address."
msgstr "" msgstr ""
#: lib/cannery_web/live/ammo_group_live/index.ex:64
#, elixir-autogen, elixir-format
msgid "Ammo group deleted succesfully"
msgstr ""
#: lib/cannery_web/live/invite_live/index.html.heex:103 #: lib/cannery_web/live/invite_live/index.html.heex:103
#: lib/cannery_web/live/invite_live/index.html.heex:133 #: lib/cannery_web/live/invite_live/index.html.heex:133
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Are you sure you want to delete %{email}? This action is permanent!" msgid "Are you sure you want to delete %{email}? This action is permanent!"
msgstr "" msgstr ""
#: lib/cannery_web/live/container_live/index.ex:223 #: lib/cannery_web/live/container_live/index.html.heex:92
#: lib/cannery_web/live/container_live/index.html.heex:73 #: lib/cannery_web/live/container_live/index.html.heex:136
#: lib/cannery_web/live/container_live/show.html.heex:51 #: lib/cannery_web/live/container_live/show.html.heex:59
#: lib/cannery_web/live/tag_live/index.html.heex:39 #: lib/cannery_web/live/tag_live/index.html.heex:64
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Are you sure you want to delete %{name}?" msgid "Are you sure you want to delete %{name}?"
msgstr "" msgstr ""
@ -96,13 +91,13 @@ msgstr ""
msgid "Are you sure you want to delete the invite for %{name}?" msgid "Are you sure you want to delete the invite for %{name}?"
msgstr "" msgstr ""
#: lib/cannery_web/live/ammo_group_live/index.ex:242 #: lib/cannery_web/live/ammo_group_live/index.html.heex:152
#: lib/cannery_web/live/ammo_group_live/show.html.heex:75 #: lib/cannery_web/live/ammo_group_live/show.html.heex:75
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Are you sure you want to delete this ammo?" msgid "Are you sure you want to delete this ammo?"
msgstr "" msgstr ""
#: lib/cannery_web/templates/user_settings/edit.html.heex:155 #: lib/cannery_web/templates/user_settings/edit.html.heex:160
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Are you sure you want to delete your account?" msgid "Are you sure you want to delete your account?"
msgstr "" msgstr ""
@ -147,18 +142,18 @@ msgstr ""
msgid "Password updated successfully." msgid "Password updated successfully."
msgstr "" msgstr ""
#: lib/cannery_web/controllers/user_registration_controller.ex:74 #: lib/cannery_web/controllers/user_registration_controller.ex:73
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Please check your email to verify your account" msgid "Please check your email to verify your account"
msgstr "" msgstr ""
#: lib/cannery_web/live/home_live.ex:108 #: lib/cannery_web/live/home_live.ex:91
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Register to setup %{name}" msgid "Register to setup %{name}"
msgstr "" msgstr ""
#: lib/cannery_web/components/add_shot_group_component.html.heex:55 #: lib/cannery_web/components/add_shot_group_component.html.heex:55
#: lib/cannery_web/live/ammo_group_live/form_component.html.heex:74 #: lib/cannery_web/live/ammo_group_live/form_component.html.heex:82
#: lib/cannery_web/live/ammo_type_live/form_component.html.heex:157 #: lib/cannery_web/live/ammo_type_live/form_component.html.heex:157
#: lib/cannery_web/live/container_live/form_component.html.heex:52 #: lib/cannery_web/live/container_live/form_component.html.heex:52
#: lib/cannery_web/live/invite_live/form_component.html.heex:33 #: lib/cannery_web/live/invite_live/form_component.html.heex:33
@ -183,7 +178,7 @@ msgstr ""
msgid "%{name} added successfully" msgid "%{name} added successfully"
msgstr "" msgstr ""
#: lib/cannery_web/live/container_live/show.ex:37 #: lib/cannery_web/live/container_live/show.ex:39
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "%{tag_name} has been removed from %{container_name}" msgid "%{tag_name} has been removed from %{container_name}"
msgstr "" msgstr ""
@ -198,19 +193,19 @@ msgstr ""
msgid "Shots recorded successfully" msgid "Shots recorded successfully"
msgstr "" msgstr ""
#: lib/cannery_web/live/range_live/index.html.heex:27 #: lib/cannery_web/live/range_live/index.html.heex:28
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Are you sure you want to unstage this ammo?" msgid "Are you sure you want to unstage this ammo?"
msgstr "" msgstr ""
#: lib/cannery_web/live/ammo_group_live/show.ex:132 #: lib/cannery_web/live/ammo_group_live/show.ex:142
#: lib/cannery_web/live/range_live/index.ex:184 #: lib/cannery_web/live/range_live/index.html.heex:118
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Are you sure you want to delete this shot record?" msgid "Are you sure you want to delete this shot record?"
msgstr "" msgstr ""
#: lib/cannery_web/live/ammo_group_live/show.ex:78 #: lib/cannery_web/live/ammo_group_live/show.ex:83
#: lib/cannery_web/live/range_live/index.ex:54 #: lib/cannery_web/live/range_live/index.ex:80
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Shot records deleted succesfully" msgid "Shot records deleted succesfully"
msgstr "" msgstr ""
@ -246,12 +241,12 @@ msgstr ""
msgid "You'll need to" msgid "You'll need to"
msgstr "" msgstr ""
#: lib/cannery_web/live/ammo_group_live/form_component.html.heex:67 #: lib/cannery_web/live/ammo_group_live/form_component.html.heex:75
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Creating..." msgid "Creating..."
msgstr "" msgstr ""
#: lib/cannery_web/templates/user_settings/edit.html.heex:136 #: lib/cannery_web/templates/user_settings/edit.html.heex:141
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Are you sure you want to change your language?" msgid "Are you sure you want to change your language?"
msgstr "" msgstr ""
@ -261,12 +256,13 @@ msgstr ""
msgid "Language updated successfully." msgid "Language updated successfully."
msgstr "" msgstr ""
#: lib/cannery_web/live/ammo_group_live/show.ex:50 #: lib/cannery_web/live/ammo_group_live/index.ex:89
#: lib/cannery_web/live/ammo_group_live/show.ex:55
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Ammo deleted succesfully" msgid "Ammo deleted succesfully"
msgstr "" msgstr ""
#: lib/cannery_web/live/range_live/index.ex:68 #: lib/cannery_web/live/range_live/index.ex:95
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Ammo unstaged succesfully" msgid "Ammo unstaged succesfully"
msgstr "" msgstr ""
@ -283,7 +279,7 @@ msgid_plural "Ammo added successfully"
msgstr[0] "" msgstr[0] ""
msgstr[1] "" msgstr[1] ""
#: lib/cannery_web/live/ammo_type_live/index.ex:232 #: lib/cannery_web/live/ammo_type_live/index.html.heex:90
#: lib/cannery_web/live/ammo_type_live/show.html.heex:28 #: lib/cannery_web/live/ammo_type_live/show.html.heex:28
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Are you sure you want to delete %{name}? This will delete all %{name} type ammo as well!" msgid "Are you sure you want to delete %{name}? This will delete all %{name} type ammo as well!"

View File

@ -18,11 +18,11 @@ msgstr ""
msgid "%{name} created successfully" msgid "%{name} created successfully"
msgstr "" msgstr ""
#: lib/cannery_web/live/ammo_type_live/index.ex:47 #: lib/cannery_web/live/ammo_type_live/index.ex:73
#: lib/cannery_web/live/ammo_type_live/show.ex:28 #: lib/cannery_web/live/ammo_type_live/show.ex:55
#: lib/cannery_web/live/invite_live/index.ex:53 #: lib/cannery_web/live/invite_live/index.ex:53
#: lib/cannery_web/live/invite_live/index.ex:133 #: lib/cannery_web/live/invite_live/index.ex:133
#: lib/cannery_web/live/tag_live/index.ex:38 #: lib/cannery_web/live/tag_live/index.ex:64
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "%{name} deleted succesfully" msgid "%{name} deleted succesfully"
msgstr "" msgstr ""
@ -37,8 +37,8 @@ msgstr ""
msgid "%{name} enabled succesfully" msgid "%{name} enabled succesfully"
msgstr "" msgstr ""
#: lib/cannery_web/live/container_live/index.ex:81 #: lib/cannery_web/live/container_live/index.ex:85
#: lib/cannery_web/live/container_live/show.ex:61 #: lib/cannery_web/live/container_live/show.ex:63
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "%{name} has been deleted" msgid "%{name} has been deleted"
msgstr "" msgstr ""
@ -61,21 +61,16 @@ msgstr ""
msgid "A link to confirm your email change has been sent to the new address." msgid "A link to confirm your email change has been sent to the new address."
msgstr "" msgstr ""
#: lib/cannery_web/live/ammo_group_live/index.ex:64
#, elixir-autogen, elixir-format
msgid "Ammo group deleted succesfully"
msgstr ""
#: lib/cannery_web/live/invite_live/index.html.heex:103 #: lib/cannery_web/live/invite_live/index.html.heex:103
#: lib/cannery_web/live/invite_live/index.html.heex:133 #: lib/cannery_web/live/invite_live/index.html.heex:133
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Are you sure you want to delete %{email}? This action is permanent!" msgid "Are you sure you want to delete %{email}? This action is permanent!"
msgstr "" msgstr ""
#: lib/cannery_web/live/container_live/index.ex:223 #: lib/cannery_web/live/container_live/index.html.heex:92
#: lib/cannery_web/live/container_live/index.html.heex:73 #: lib/cannery_web/live/container_live/index.html.heex:136
#: lib/cannery_web/live/container_live/show.html.heex:51 #: lib/cannery_web/live/container_live/show.html.heex:59
#: lib/cannery_web/live/tag_live/index.html.heex:39 #: lib/cannery_web/live/tag_live/index.html.heex:64
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Are you sure you want to delete %{name}?" msgid "Are you sure you want to delete %{name}?"
msgstr "" msgstr ""
@ -85,13 +80,13 @@ msgstr ""
msgid "Are you sure you want to delete the invite for %{name}?" msgid "Are you sure you want to delete the invite for %{name}?"
msgstr "" msgstr ""
#: lib/cannery_web/live/ammo_group_live/index.ex:242 #: lib/cannery_web/live/ammo_group_live/index.html.heex:152
#: lib/cannery_web/live/ammo_group_live/show.html.heex:75 #: lib/cannery_web/live/ammo_group_live/show.html.heex:75
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Are you sure you want to delete this ammo?" msgid "Are you sure you want to delete this ammo?"
msgstr "" msgstr ""
#: lib/cannery_web/templates/user_settings/edit.html.heex:155 #: lib/cannery_web/templates/user_settings/edit.html.heex:160
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Are you sure you want to delete your account?" msgid "Are you sure you want to delete your account?"
msgstr "" msgstr ""
@ -136,18 +131,18 @@ msgstr ""
msgid "Password updated successfully." msgid "Password updated successfully."
msgstr "" msgstr ""
#: lib/cannery_web/controllers/user_registration_controller.ex:74 #: lib/cannery_web/controllers/user_registration_controller.ex:73
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Please check your email to verify your account" msgid "Please check your email to verify your account"
msgstr "" msgstr ""
#: lib/cannery_web/live/home_live.ex:108 #: lib/cannery_web/live/home_live.ex:91
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Register to setup %{name}" msgid "Register to setup %{name}"
msgstr "" msgstr ""
#: lib/cannery_web/components/add_shot_group_component.html.heex:55 #: lib/cannery_web/components/add_shot_group_component.html.heex:55
#: lib/cannery_web/live/ammo_group_live/form_component.html.heex:74 #: lib/cannery_web/live/ammo_group_live/form_component.html.heex:82
#: lib/cannery_web/live/ammo_type_live/form_component.html.heex:157 #: lib/cannery_web/live/ammo_type_live/form_component.html.heex:157
#: lib/cannery_web/live/container_live/form_component.html.heex:52 #: lib/cannery_web/live/container_live/form_component.html.heex:52
#: lib/cannery_web/live/invite_live/form_component.html.heex:33 #: lib/cannery_web/live/invite_live/form_component.html.heex:33
@ -172,7 +167,7 @@ msgstr ""
msgid "%{name} added successfully" msgid "%{name} added successfully"
msgstr "" msgstr ""
#: lib/cannery_web/live/container_live/show.ex:37 #: lib/cannery_web/live/container_live/show.ex:39
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "%{tag_name} has been removed from %{container_name}" msgid "%{tag_name} has been removed from %{container_name}"
msgstr "" msgstr ""
@ -187,19 +182,19 @@ msgstr ""
msgid "Shots recorded successfully" msgid "Shots recorded successfully"
msgstr "" msgstr ""
#: lib/cannery_web/live/range_live/index.html.heex:27 #: lib/cannery_web/live/range_live/index.html.heex:28
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Are you sure you want to unstage this ammo?" msgid "Are you sure you want to unstage this ammo?"
msgstr "" msgstr ""
#: lib/cannery_web/live/ammo_group_live/show.ex:132 #: lib/cannery_web/live/ammo_group_live/show.ex:142
#: lib/cannery_web/live/range_live/index.ex:184 #: lib/cannery_web/live/range_live/index.html.heex:118
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Are you sure you want to delete this shot record?" msgid "Are you sure you want to delete this shot record?"
msgstr "" msgstr ""
#: lib/cannery_web/live/ammo_group_live/show.ex:78 #: lib/cannery_web/live/ammo_group_live/show.ex:83
#: lib/cannery_web/live/range_live/index.ex:54 #: lib/cannery_web/live/range_live/index.ex:80
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Shot records deleted succesfully" msgid "Shot records deleted succesfully"
msgstr "" msgstr ""
@ -235,12 +230,12 @@ msgstr ""
msgid "You'll need to" msgid "You'll need to"
msgstr "" msgstr ""
#: lib/cannery_web/live/ammo_group_live/form_component.html.heex:67 #: lib/cannery_web/live/ammo_group_live/form_component.html.heex:75
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Creating..." msgid "Creating..."
msgstr "" msgstr ""
#: lib/cannery_web/templates/user_settings/edit.html.heex:136 #: lib/cannery_web/templates/user_settings/edit.html.heex:141
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Are you sure you want to change your language?" msgid "Are you sure you want to change your language?"
msgstr "" msgstr ""
@ -250,12 +245,13 @@ msgstr ""
msgid "Language updated successfully." msgid "Language updated successfully."
msgstr "" msgstr ""
#: lib/cannery_web/live/ammo_group_live/show.ex:50 #: lib/cannery_web/live/ammo_group_live/index.ex:89
#: lib/cannery_web/live/ammo_group_live/show.ex:55
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Ammo deleted succesfully" msgid "Ammo deleted succesfully"
msgstr "" msgstr ""
#: lib/cannery_web/live/range_live/index.ex:68 #: lib/cannery_web/live/range_live/index.ex:95
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Ammo unstaged succesfully" msgid "Ammo unstaged succesfully"
msgstr "" msgstr ""
@ -272,7 +268,7 @@ msgid_plural "Ammo added successfully"
msgstr[0] "" msgstr[0] ""
msgstr[1] "" msgstr[1] ""
#: lib/cannery_web/live/ammo_type_live/index.ex:232 #: lib/cannery_web/live/ammo_type_live/index.html.heex:90
#: lib/cannery_web/live/ammo_type_live/show.html.heex:28 #: lib/cannery_web/live/ammo_type_live/show.html.heex:28
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Are you sure you want to delete %{name}? This will delete all %{name} type ammo as well!" msgid "Are you sure you want to delete %{name}? This will delete all %{name} type ammo as well!"

View File

@ -0,0 +1,16 @@
defmodule Cannery.Repo.Migrations.AddMoreIndexes do
use Ecto.Migration
def change do
create unique_index(:container_tags, [:tag_id, :container_id])
create index(:ammo_groups, [:user_id], where: "count = 0", name: :empty_ammo_groups_index)
create index(:ammo_groups, [:user_id, :ammo_type_id])
create index(:ammo_groups, [:user_id, :container_id])
create index(:ammo_types, [:user_id])
drop index(:shot_groups, [:id])
create index(:shot_groups, [:user_id, :ammo_group_id])
end
end

View File

@ -0,0 +1,19 @@
defmodule Cannery.Repo.Migrations.AddPurchaseDateToAmmoGroup do
use Ecto.Migration
def up do
alter table(:ammo_groups) do
add :purchased_on, :date
end
flush()
execute("UPDATE ammo_groups SET purchased_on = inserted_at::DATE WHERE purchased_on IS NULL")
end
def down do
alter table(:ammo_groups) do
remove :purchased_on
end
end
end

View File

@ -0,0 +1,119 @@
defmodule Cannery.Repo.Migrations.AddSearch do
use Ecto.Migration
def up do
execute """
CREATE FUNCTION immutable_to_string(integer, text)
RETURNS text LANGUAGE sql IMMUTABLE as
$$SELECT coalesce(($1)::TEXT, $2)::TEXT$$
"""
execute """
CREATE FUNCTION immutable_to_string(double precision, text)
RETURNS text LANGUAGE sql IMMUTABLE as
$$SELECT coalesce(($1)::TEXT, $2)::TEXT$$
"""
execute """
CREATE FUNCTION immutable_to_string(date, text)
RETURNS text LANGUAGE sql IMMUTABLE as
$$SELECT coalesce(($1)::TEXT, $2)::TEXT$$
"""
execute """
CREATE FUNCTION boolean_to_string(boolean, text, text)
RETURNS text LANGUAGE sql IMMUTABLE as
$$SELECT (CASE $1 WHEN true THEN $2 ELSE $3 END)::TEXT$$
"""
execute """
ALTER TABLE ammo_groups
ADD COLUMN search tsvector
GENERATED ALWAYS AS (
setweight(to_tsvector('english', coalesce("notes", '')), 'A') ||
setweight(to_tsvector('english', immutable_to_string("price_paid", '')), 'B') ||
setweight(to_tsvector('english', immutable_to_string("purchased_on", '')), 'B') ||
setweight(to_tsvector('english', immutable_to_string("count", '')), 'C')
) STORED
"""
execute("CREATE INDEX ammo_groups_trgm_idx ON ammo_groups USING GIN (search)")
execute """
ALTER TABLE containers
ADD COLUMN search tsvector
GENERATED ALWAYS AS (
setweight(to_tsvector('english', coalesce("name", '')), 'A') ||
setweight(to_tsvector('english', coalesce("desc", '')), 'B') ||
setweight(to_tsvector('english', coalesce("location", '')), 'B') ||
setweight(to_tsvector('english', coalesce("type", '')), 'C')
) STORED
"""
execute("CREATE INDEX containers_trgm_idx ON containers USING GIN (search)")
execute """
ALTER TABLE tags
ADD COLUMN search tsvector
GENERATED ALWAYS AS (
setweight(to_tsvector('english', coalesce("name", '')), 'A')
) STORED
"""
execute("CREATE INDEX tags_trgm_idx ON tags USING GIN (search)")
execute """
ALTER TABLE ammo_types
ADD COLUMN search tsvector
GENERATED ALWAYS AS (
setweight(to_tsvector('english', coalesce("name", '')), 'A') ||
setweight(to_tsvector('english', coalesce("desc", '')), 'B') ||
setweight(to_tsvector('english', coalesce("bullet_type", '')), 'C') ||
setweight(to_tsvector('english', coalesce("bullet_core", '')), 'C') ||
setweight(to_tsvector('english', coalesce("cartridge", '')), 'C') ||
setweight(to_tsvector('english', coalesce("caliber", '')), 'C') ||
setweight(to_tsvector('english', coalesce("case_material", '')), 'C') ||
setweight(to_tsvector('english', coalesce("jacket_type", '')), 'C') ||
setweight(to_tsvector('english', immutable_to_string("muzzle_velocity", '')), 'C') ||
setweight(to_tsvector('english', coalesce("powder_type", '')), 'C') ||
setweight(to_tsvector('english', immutable_to_string("powder_grains_per_charge", '')), 'C') ||
setweight(to_tsvector('english', immutable_to_string("grains", '')), 'C') ||
setweight(to_tsvector('english', coalesce("pressure", '')), 'C') ||
setweight(to_tsvector('english', coalesce("primer_type", '')), 'C') ||
setweight(to_tsvector('english', coalesce("firing_type", '')), 'C') ||
setweight(to_tsvector('english', boolean_to_string("tracer", 'tracer', '')), 'C') ||
setweight(to_tsvector('english', boolean_to_string("incendiary", 'incendiary', '')), 'C') ||
setweight(to_tsvector('english', boolean_to_string("blank", 'blank', '')), 'C') ||
setweight(to_tsvector('english', boolean_to_string("corrosive", 'corrosive', '')), 'C') ||
setweight(to_tsvector('english', coalesce("manufacturer", '')), 'D') ||
setweight(to_tsvector('english', coalesce("upc", '')), 'D')
) STORED
"""
execute("CREATE INDEX ammo_types_trgm_idx ON ammo_types USING GIN (search)")
execute """
ALTER TABLE shot_groups
ADD COLUMN search tsvector
GENERATED ALWAYS AS (
setweight(to_tsvector('english', coalesce(notes, '')), 'A') ||
setweight(to_tsvector('english', immutable_to_string(count, '')), 'B') ||
setweight(to_tsvector('english', immutable_to_string(date, '')), 'C')
) STORED
"""
execute("CREATE INDEX shot_groups_trgm_idx ON shot_groups USING GIN (search)")
end
def down do
alter table(:ammo_groups), do: remove(:search)
alter table(:containers), do: remove(:search)
alter table(:tags), do: remove(:search)
alter table(:ammo_types), do: remove(:search)
alter table(:shot_groups), do: remove(:search)
execute("DROP FUNCTION immutable_to_string(double precision, text)")
execute("DROP FUNCTION immutable_to_string(integer, text)")
execute("DROP FUNCTION immutable_to_string(date, text)")
execute("DROP FUNCTION boolean_to_string(boolean, text, text)")
end
end

View File

@ -104,7 +104,7 @@ defmodule Cannery.AccountsTest do
describe "change_user_registration/2" do describe "change_user_registration/2" do
test "returns a changeset" do test "returns a changeset" do
assert %Changeset{} = changeset = Accounts.change_user_registration(%User{}) assert %Changeset{} = changeset = Accounts.change_user_registration()
assert changeset.required == [:password, :email] assert changeset.required == [:password, :email]
end end
@ -112,8 +112,7 @@ defmodule Cannery.AccountsTest do
email = unique_user_email() email = unique_user_email()
password = valid_user_password() password = valid_user_password()
changeset = changeset = Accounts.change_user_registration(%{"email" => email, "password" => password})
Accounts.change_user_registration(%User{}, %{"email" => email, "password" => password})
assert changeset.valid? assert changeset.valid?
assert get_change(changeset, :email) == email assert get_change(changeset, :email) == email

View File

@ -38,17 +38,56 @@ defmodule Cannery.ActivityLogTest do
] ]
end end
test "list_shot_groups/0 returns all shot_groups", test "list_shot_groups/1 returns all shot_groups",
%{shot_group: shot_group, current_user: current_user} do %{shot_group: shot_group, current_user: current_user} do
assert ActivityLog.list_shot_groups(current_user) == [shot_group] assert ActivityLog.list_shot_groups(current_user) == [shot_group]
end end
test "get_shot_group!/1 returns the shot_group with given id", test "list_shot_groups/2 returns relevant shot_groups for a user", %{
ammo_type: ammo_type,
ammo_group: ammo_group,
container: container,
current_user: current_user
} do
shot_group_a = shot_group_fixture(%{"notes" => "amazing"}, current_user, ammo_group)
{1, [another_ammo_group]} =
ammo_group_fixture(%{"notes" => "stupendous"}, ammo_type, container, current_user)
shot_group_b = shot_group_fixture(current_user, another_ammo_group)
another_ammo_type = ammo_type_fixture(%{"name" => "fabulous ammo"}, current_user)
{1, [yet_another_ammo_group]} =
ammo_group_fixture(another_ammo_type, container, current_user)
shot_group_c = shot_group_fixture(current_user, yet_another_ammo_group)
random_user = user_fixture()
random_container = container_fixture(random_user)
random_ammo_type = ammo_type_fixture(random_user)
{1, [random_ammo_group]} =
ammo_group_fixture(random_ammo_type, random_container, random_user)
_shouldnt_return = shot_group_fixture(random_user, random_ammo_group)
# notes
assert ActivityLog.list_shot_groups("amazing", current_user) == [shot_group_a]
# ammo group attributes
assert ActivityLog.list_shot_groups("stupendous", current_user) == [shot_group_b]
# ammo type attributes
assert ActivityLog.list_shot_groups("fabulous", current_user) == [shot_group_c]
end
test "get_shot_group!/2 returns the shot_group with given id",
%{shot_group: shot_group, current_user: current_user} do %{shot_group: shot_group, current_user: current_user} do
assert ActivityLog.get_shot_group!(shot_group.id, current_user) == shot_group assert ActivityLog.get_shot_group!(shot_group.id, current_user) == shot_group
end end
test "get_shot_group!/1 does not return a shot_group of another user", test "get_shot_group!/2 does not return a shot_group of another user",
%{shot_group: shot_group} do %{shot_group: shot_group} do
another_user = user_fixture() another_user = user_fixture()
@ -57,7 +96,7 @@ defmodule Cannery.ActivityLogTest do
end end
end end
test "create_shot_group/1 with valid data creates a shot_group", test "create_shot_group/3 with valid data creates a shot_group",
%{current_user: current_user, ammo_group: ammo_group} do %{current_user: current_user, ammo_group: ammo_group} do
valid_attrs = %{"count" => 10, "date" => ~D[2022-02-13], "notes" => "some notes"} valid_attrs = %{"count" => 10, "date" => ~D[2022-02-13], "notes" => "some notes"}
@ -69,7 +108,7 @@ defmodule Cannery.ActivityLogTest do
assert shot_group.notes == "some notes" assert shot_group.notes == "some notes"
end end
test "create_shot_group/1 removes corresponding count from ammo group", test "create_shot_group/3 removes corresponding count from ammo group",
%{ %{
current_user: current_user, current_user: current_user,
ammo_group: %{id: ammo_group_id, count: org_count} = ammo_group ammo_group: %{id: ammo_group_id, count: org_count} = ammo_group
@ -85,7 +124,7 @@ defmodule Cannery.ActivityLogTest do
assert new_count == 10 assert new_count == 10
end end
test "create_shot_group/1 does not remove more than ammo group amount", test "create_shot_group/3 does not remove more than ammo group amount",
%{current_user: current_user, ammo_group: %{id: ammo_group_id} = ammo_group} do %{current_user: current_user, ammo_group: %{id: ammo_group_id} = ammo_group} do
valid_attrs = %{"count" => 20, "date" => ~D[2022-02-13], "notes" => "some notes"} valid_attrs = %{"count" => 20, "date" => ~D[2022-02-13], "notes" => "some notes"}
@ -100,7 +139,7 @@ defmodule Cannery.ActivityLogTest do
ActivityLog.create_shot_group(%{"count" => 1}, current_user, ammo_group) ActivityLog.create_shot_group(%{"count" => 1}, current_user, ammo_group)
end end
test "create_shot_group/1 with invalid data returns error changeset", test "create_shot_group/3 with invalid data returns error changeset",
%{current_user: current_user, ammo_group: ammo_group} do %{current_user: current_user, ammo_group: ammo_group} do
invalid_params = %{"count" => nil, "date" => nil, "notes" => nil} invalid_params = %{"count" => nil, "date" => nil, "notes" => nil}
@ -108,7 +147,7 @@ defmodule Cannery.ActivityLogTest do
ActivityLog.create_shot_group(invalid_params, current_user, ammo_group) ActivityLog.create_shot_group(invalid_params, current_user, ammo_group)
end end
test "update_shot_group/2 with valid data updates the shot_group and ammo_group", test "update_shot_group/3 with valid data updates the shot_group and ammo_group",
%{ %{
shot_group: shot_group, shot_group: shot_group,
ammo_group: %{id: ammo_group_id}, ammo_group: %{id: ammo_group_id},
@ -149,7 +188,7 @@ defmodule Cannery.ActivityLogTest do
assert ammo_group.count == 0 assert ammo_group.count == 0
end end
test "update_shot_group/2 with invalid data returns error changeset", test "update_shot_group/3 with invalid data returns error changeset",
%{shot_group: shot_group, current_user: current_user} do %{shot_group: shot_group, current_user: current_user} do
assert {:error, %Ecto.Changeset{}} = assert {:error, %Ecto.Changeset{}} =
ActivityLog.update_shot_group( ActivityLog.update_shot_group(
@ -168,7 +207,7 @@ defmodule Cannery.ActivityLogTest do
assert shot_group == ActivityLog.get_shot_group!(shot_group.id, current_user) assert shot_group == ActivityLog.get_shot_group!(shot_group.id, current_user)
end end
test "delete_shot_group/1 deletes the shot_group and adds value back", test "delete_shot_group/2 deletes the shot_group and adds value back",
%{shot_group: shot_group, current_user: current_user, ammo_group: %{id: ammo_group_id}} do %{shot_group: shot_group, current_user: current_user, ammo_group: %{id: ammo_group_id}} do
assert {:ok, %ShotGroup{}} = ActivityLog.delete_shot_group(shot_group, current_user) assert {:ok, %ShotGroup{}} = ActivityLog.delete_shot_group(shot_group, current_user)

Some files were not shown because too many files have changed in this diff Show More