Claude set up a '/labels' endpoint

This commit is contained in:
Gavin McDonald
2025-10-17 18:25:45 -04:00
parent 679c7c75d8
commit 4a7e966744
5 changed files with 222 additions and 0 deletions

View File

@@ -0,0 +1,16 @@
defmodule LabelmakerWeb.LabelsHTML do
use LabelmakerWeb, :html
embed_templates "labels_html/*"
def format_size(bytes) when bytes < 1024, do: "#{bytes} B"
def format_size(bytes) when bytes < 1024 * 1024, do: "#{Float.round(bytes / 1024, 1)} KB"
def format_size(bytes), do: "#{Float.round(bytes / (1024 * 1024), 1)} MB"
def format_datetime({{year, month, day}, {hour, minute, second}}) do
"#{year}-#{pad(month)}-#{pad(day)} #{pad(hour)}:#{pad(minute)}:#{pad(second)}"
end
defp pad(num) when num < 10, do: "0#{num}"
defp pad(num), do: "#{num}"
end