[Initial commit]
This commit is contained in:
commit
6a5ee11de1
11 changed files with 303 additions and 0 deletions
51
data/database.sql
Normal file
51
data/database.sql
Normal file
|
@ -0,0 +1,51 @@
|
||||||
|
create table locations (
|
||||||
|
id integer primary key,
|
||||||
|
parent integer,
|
||||||
|
name text,
|
||||||
|
description text
|
||||||
|
);
|
||||||
|
|
||||||
|
insert into locations(id,parent,name,description) values(0,null,"Raum 1","Eingang / Kueche");
|
||||||
|
insert into locations(id,parent,name,description) values(1,null,"Raum 2","Server / Chillout-Area");
|
||||||
|
insert into locations(id,parent,name,description) values(2,null,"Raum 3","Hauptlager / Arbeitszimmer / Gemeinschaftsraum");
|
||||||
|
insert into locations(id,parent,name,description) values(3,null,"Raum 4","Chemie / Nebenlager / 3D-Druck / Plotter");
|
||||||
|
insert into locations(id,parent,name,description) values(4,null,"Raum 5","Maschinenraum / Werkstatt");
|
||||||
|
insert into locations(id,parent,name,description) values(5,2,"A",null);
|
||||||
|
insert into locations(id,parent,name,description) values(6,2,"B",null);
|
||||||
|
insert into locations(id,parent,name,description) values(7,2,"C",null);
|
||||||
|
insert into locations(id,parent,name,description) values(8,2,"D",null);
|
||||||
|
insert into locations(id,parent,name,description) values(9,2,"E",null);
|
||||||
|
insert into locations(id,parent,name,description) values(10,2,"F",null);
|
||||||
|
insert into locations(id,parent,name,description) values(11,2,"G",null);
|
||||||
|
|
||||||
|
create table containers (
|
||||||
|
id integer primary key,
|
||||||
|
name text
|
||||||
|
);
|
||||||
|
|
||||||
|
insert into containers(id,name) values(0,"Grosse Kiste");
|
||||||
|
insert into containers(id,name) values(1,"Flache Kiste");
|
||||||
|
insert into containers(id,name) values(2,"Komponentenschachtel");
|
||||||
|
insert into containers(id,name) values(3,"Regal");
|
||||||
|
insert into containers(id,name) values(4,"Tisch");
|
||||||
|
insert into containers(id,name) values(5,"Schublade");
|
||||||
|
|
||||||
|
create table parts (
|
||||||
|
id integer primary key,
|
||||||
|
name text,
|
||||||
|
tags text,
|
||||||
|
location integer not null,
|
||||||
|
container integer not null
|
||||||
|
);
|
||||||
|
|
||||||
|
insert into parts(name,tags,location,container) values("SMD-Rollen","smd;rolle",5,1);
|
||||||
|
insert into parts(name,tags,location,container) values("Grosse Elkos","gross,elko,kondensator",5,1);
|
||||||
|
insert into parts(name,tags,location,container) values("Wechselblinker Projekt fuer Kinder","wechselblinker;kinder;bausatz",5,1);
|
||||||
|
insert into parts(name,tags,location,container) values("Bausaetze","bausatz",5,1);
|
||||||
|
insert into parts(name,tags,location,container) values("Bausaetze fuer Kinder","bausatz;kinder",5,1);
|
||||||
|
insert into parts(name,tags,location,container) values("DVI-Kabel","dvi;kabel;video;monitor",5,1);
|
||||||
|
insert into parts(name,tags,location,container) values("VGA-Kabel","vga;kabel;video;monitor",5,1);
|
||||||
|
insert into parts(name,tags,location,container) values("HDMI-Kabel","hdmi;kabel;video;monitor",5,1);
|
||||||
|
insert into parts(name,tags,location,container) values("DP-Kabel","dp;displayport;kabel;video;monitor",5,1);
|
||||||
|
insert into parts(name,tags,location,container) values("USB","usb;usb3;micro;mini;usbc",5,1);
|
||||||
|
insert into parts(name,tags,location,container) values("USB-Hubs, -Reader, -Divers","usb;usb3;hub;reader;adapter",5,1);
|
24
go.mod
Normal file
24
go.mod
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
module fisch
|
||||||
|
|
||||||
|
go 1.23.6
|
||||||
|
|
||||||
|
require (
|
||||||
|
github.com/gofiber/fiber/v2 v2.52.6
|
||||||
|
github.com/gofiber/template/html/v2 v2.1.3
|
||||||
|
)
|
||||||
|
|
||||||
|
require (
|
||||||
|
github.com/andybalholm/brotli v1.1.0 // indirect
|
||||||
|
github.com/gofiber/template v1.8.3 // indirect
|
||||||
|
github.com/gofiber/utils v1.1.0 // indirect
|
||||||
|
github.com/google/uuid v1.6.0 // indirect
|
||||||
|
github.com/klauspost/compress v1.17.9 // indirect
|
||||||
|
github.com/mattn/go-colorable v0.1.13 // indirect
|
||||||
|
github.com/mattn/go-isatty v0.0.20 // indirect
|
||||||
|
github.com/mattn/go-runewidth v0.0.16 // indirect
|
||||||
|
github.com/rivo/uniseg v0.2.0 // indirect
|
||||||
|
github.com/valyala/bytebufferpool v1.0.0 // indirect
|
||||||
|
github.com/valyala/fasthttp v1.51.0 // indirect
|
||||||
|
github.com/valyala/tcplisten v1.0.0 // indirect
|
||||||
|
golang.org/x/sys v0.28.0 // indirect
|
||||||
|
)
|
41
go.sum
Normal file
41
go.sum
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
github.com/andybalholm/brotli v1.1.0 h1:eLKJA0d02Lf0mVpIDgYnqXcUn0GqVmEFny3VuID1U3M=
|
||||||
|
github.com/andybalholm/brotli v1.1.0/go.mod h1:sms7XGricyQI9K10gOSf56VKKWS4oLer58Q+mhRPtnY=
|
||||||
|
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||||
|
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
|
github.com/gofiber/fiber/v2 v2.52.6 h1:Rfp+ILPiYSvvVuIPvxrBns+HJp8qGLDnLJawAu27XVI=
|
||||||
|
github.com/gofiber/fiber/v2 v2.52.6/go.mod h1:YEcBbO/FB+5M1IZNBP9FO3J9281zgPAreiI1oqg8nDw=
|
||||||
|
github.com/gofiber/template v1.8.3 h1:hzHdvMwMo/T2kouz2pPCA0zGiLCeMnoGsQZBTSYgZxc=
|
||||||
|
github.com/gofiber/template v1.8.3/go.mod h1:bs/2n0pSNPOkRa5VJ8zTIvedcI/lEYxzV3+YPXdBvq8=
|
||||||
|
github.com/gofiber/template/html/v2 v2.1.3 h1:n1LYBtmr9C0V/k/3qBblXyMxV5B0o/gpb6dFLp8ea+o=
|
||||||
|
github.com/gofiber/template/html/v2 v2.1.3/go.mod h1:U5Fxgc5KpyujU9OqKzy6Kn6Qup6Tm7zdsISR+VpnHRE=
|
||||||
|
github.com/gofiber/utils v1.1.0 h1:vdEBpn7AzIUJRhe+CiTOJdUcTg4Q9RK+pEa0KPbLdrM=
|
||||||
|
github.com/gofiber/utils v1.1.0/go.mod h1:poZpsnhBykfnY1Mc0KeEa6mSHrS3dV0+oBWyeQmb2e0=
|
||||||
|
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
|
||||||
|
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||||
|
github.com/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA=
|
||||||
|
github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw=
|
||||||
|
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
|
||||||
|
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
|
||||||
|
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
|
||||||
|
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
|
||||||
|
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
|
||||||
|
github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6TULQc=
|
||||||
|
github.com/mattn/go-runewidth v0.0.16/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
|
||||||
|
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||||
|
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||||
|
github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY=
|
||||||
|
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
|
||||||
|
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
|
||||||
|
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
||||||
|
github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw=
|
||||||
|
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
|
||||||
|
github.com/valyala/fasthttp v1.51.0 h1:8b30A5JlZ6C7AS81RsWjYMQmrZG6feChmgAolCl1SqA=
|
||||||
|
github.com/valyala/fasthttp v1.51.0/go.mod h1:oI2XroL+lI7vdXyYoQk03bXBThfFl2cVdIA3Xl7cH8g=
|
||||||
|
github.com/valyala/tcplisten v1.0.0 h1:rBHj/Xf+E1tRGZyWIWwJDiRY0zc1Js+CV5DqwacVSA8=
|
||||||
|
github.com/valyala/tcplisten v1.0.0/go.mod h1:T0xQ8SeCZGxckz9qRXTfG43PvQ/mcWh7FwZEA7Ioqkc=
|
||||||
|
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
|
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
|
golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA=
|
||||||
|
golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||||
|
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||||
|
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
48
main.go
Normal file
48
main.go
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"log"
|
||||||
|
|
||||||
|
"github.com/gofiber/fiber/v2"
|
||||||
|
"github.com/gofiber/template/html/v2"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
engine := html.New("views", ".html")
|
||||||
|
|
||||||
|
app := fiber.New(fiber.Config{
|
||||||
|
Views: engine,
|
||||||
|
})
|
||||||
|
|
||||||
|
app.Static("/", "static")
|
||||||
|
|
||||||
|
navItems := []NavItem{
|
||||||
|
NewNavItem("Suche", "/search"),
|
||||||
|
}
|
||||||
|
|
||||||
|
app.Get("/", func(c *fiber.Ctx) error {
|
||||||
|
return c.Render("search", fiber.Map{
|
||||||
|
"Title": "Suche",
|
||||||
|
"Stylenames": NewStyleItemList("colors", "main", "search"),
|
||||||
|
"NavItems": navItems,
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
app.Get("/search", func(c *fiber.Ctx) error {
|
||||||
|
return c.Render("search", fiber.Map{
|
||||||
|
"Title": "Suche",
|
||||||
|
"Stylenames": NewStyleItemList("colors", "main", "search"),
|
||||||
|
"NavItems": navItems,
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
app.Post("/search", func(c *fiber.Ctx) error {
|
||||||
|
return c.Render("search", fiber.Map{
|
||||||
|
"Title": "Suche",
|
||||||
|
"Stylenames": NewStyleItemList("colors", "main", "search"),
|
||||||
|
"NavItems": navItems,
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
log.Fatal(app.Listen(":3000"))
|
||||||
|
}
|
28
static/css/colors.css
Normal file
28
static/css/colors.css
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
:root {
|
||||||
|
--fg: #e8e6e3;
|
||||||
|
--fg-inactive: #999999;
|
||||||
|
--bg: #181a1b;
|
||||||
|
--bg-light: black;
|
||||||
|
--bg-border: #888888;
|
||||||
|
--accent: #a9daef;
|
||||||
|
--danger: #e16363;
|
||||||
|
--invalid: #d73030;
|
||||||
|
--contrast: white;
|
||||||
|
--link: #6f6fff;
|
||||||
|
--link-visited: #bb88e9;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (prefers-color-scheme: light) {
|
||||||
|
:root {
|
||||||
|
--fg: #071419;
|
||||||
|
--fg-inactive: #4d636c;
|
||||||
|
--bg: #e0ecff;
|
||||||
|
--bg-light: #bcc5d5;
|
||||||
|
--bg-border: #888888;
|
||||||
|
--accent: #333333;
|
||||||
|
--danger: #be0000;
|
||||||
|
--contrast: black;
|
||||||
|
--link: #0000ee;
|
||||||
|
--link-visited: #551a8b;
|
||||||
|
}
|
||||||
|
}
|
59
static/css/main.css
Normal file
59
static/css/main.css
Normal file
|
@ -0,0 +1,59 @@
|
||||||
|
* {
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
html, body {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
font-family: monospace;
|
||||||
|
|
||||||
|
color: var(--fg);
|
||||||
|
background-color: var(--bg);
|
||||||
|
}
|
||||||
|
|
||||||
|
a {
|
||||||
|
color: var(--link);
|
||||||
|
text-decoration: none;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
a:visited {
|
||||||
|
color: var(--link-visited);
|
||||||
|
}
|
||||||
|
|
||||||
|
header, footer {
|
||||||
|
background-color: var(--bg-light);
|
||||||
|
height: 100px;
|
||||||
|
}
|
||||||
|
|
||||||
|
header {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: space-around;
|
||||||
|
}
|
||||||
|
|
||||||
|
header > h1 {
|
||||||
|
padding: 0;
|
||||||
|
margin: 0;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
header > nav, footer > nav {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
footer > nav {
|
||||||
|
height: 100%;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
footer > nav > a {
|
||||||
|
margin: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
main {
|
||||||
|
min-height: calc(100vh - 200px);
|
||||||
|
}
|
0
static/css/search.css
Normal file
0
static/css/search.css
Normal file
16
types.go
Normal file
16
types.go
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
type NavItem struct {
|
||||||
|
Caption string
|
||||||
|
Destination string
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewNavItem(caption, destination string) NavItem {
|
||||||
|
return NavItem{caption, destination}
|
||||||
|
}
|
||||||
|
|
||||||
|
type Stylename string
|
||||||
|
|
||||||
|
func NewStyleItemList(stylenames ...Stylename) []Stylename {
|
||||||
|
return stylenames
|
||||||
|
}
|
8
views/partials/base-bottom.html
Normal file
8
views/partials/base-bottom.html
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
</main>
|
||||||
|
<footer>
|
||||||
|
<nav>
|
||||||
|
<a href="#">Repository</a>
|
||||||
|
</nav>
|
||||||
|
</footer>
|
||||||
|
</body>
|
||||||
|
</html>
|
20
views/partials/base-top.html
Normal file
20
views/partials/base-top.html
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>fisch - {{ .Title }}</title>
|
||||||
|
{{ range .Stylenames }}
|
||||||
|
<link rel="stylesheet" href="css/{{ . }}.css">
|
||||||
|
{{ end }}
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<header>
|
||||||
|
<h1>fisch</h1>
|
||||||
|
<nav>
|
||||||
|
{{ range .NavItems }}
|
||||||
|
<a href="{{ .Destination }}">{{ .Caption }}</a>
|
||||||
|
{{ end }}
|
||||||
|
</nav>
|
||||||
|
</header>
|
||||||
|
<main>
|
8
views/search.html
Normal file
8
views/search.html
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
{{template "partials/base-top" .}}
|
||||||
|
|
||||||
|
<form action="/search" method="post">
|
||||||
|
<input type="text" name="search" placeholder="Suche . . .">
|
||||||
|
<button type="submit">🔍</button>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
{{template "partials/base-bottom" .}}
|
Loading…
Add table
Reference in a new issue