Embryo of web frontend

This commit is contained in:
2024-07-02 12:40:47 -03:00
parent baf60a1bf7
commit 4371444fa4
3 changed files with 29 additions and 28 deletions

View File

@ -10,7 +10,7 @@ module Funkos
end
end
get "/funkos/" do |_|
get "/funkos/" do |env|
docker_api = Docr::API.new(Docr::Client.new)
containers = docker_api.containers.list(all: true)
@ -20,7 +20,12 @@ module Funkos
next if names.empty?
funkos << Funko.new(name: names[0][7..])
}
funkos.sort! { |a, b| a.name <=> b.name}
funkos.to_json
funkos.sort! { |a, b| a.name <=> b.name }
if env.params.query.fetch("format", "json") == "html"
render "src/views/funkos.ecr"
else
funkos.to_json
end
end
end

5
src/views/funkos.ecr Normal file
View File

@ -0,0 +1,5 @@
<%- funkos.each do |funko| -%>
<td><%= funko.name %></td>
<td>sarasa</td>
<td><button>DOSTUFF</button></td>
<%- end -%>