From 5a2ce71f3c9bb83d6859f507ef294327b5cf4174 Mon Sep 17 00:00:00 2001 From: Paul Mathieu Date: Wed, 28 Jun 2023 23:42:46 +0200 Subject: [PATCH] Small refactor into backend & frontend --- Dockerfile | 2 +- backend/data/tikettes.json | 1 + makeplanche.py => backend/makeplanche.py | 0 makesticker.py => backend/makesticker.py | 0 mkjam.sh => backend/mkjam.sh | 0 planche.svg.in => backend/planche.svg.in | 0 web.py => backend/web.py | 0 frontend/config.js | 1 + {static => frontend}/index.html | 0 {static => frontend}/newtikette.html | 0 {static => frontend}/newtikette.js | 7 +------ {static => frontend}/zetikettes.js | 24 ++++++++++++++++++------ static/config.js | 2 -- tikettes.json | 1 - 14 files changed, 22 insertions(+), 16 deletions(-) create mode 100644 backend/data/tikettes.json rename makeplanche.py => backend/makeplanche.py (100%) rename makesticker.py => backend/makesticker.py (100%) rename mkjam.sh => backend/mkjam.sh (100%) rename planche.svg.in => backend/planche.svg.in (100%) rename web.py => backend/web.py (100%) create mode 100644 frontend/config.js rename {static => frontend}/index.html (100%) rename {static => frontend}/newtikette.html (100%) rename {static => frontend}/newtikette.js (96%) rename {static => frontend}/zetikettes.js (88%) delete mode 100644 static/config.js delete mode 100644 tikettes.json diff --git a/Dockerfile b/Dockerfile index 53d3b7f..000313f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,7 @@ FROM alpine RUN apk --no-cache add python3 inkscape bash imagemagick -ADD . /root/zetikettes +ADD backend /root/zetikettes RUN apk --no-cache add ttf-opensans && cp /root/zetikettes/fonts/*.ttf /usr/share/fonts/TTF/ && fc-cache -fv diff --git a/backend/data/tikettes.json b/backend/data/tikettes.json new file mode 100644 index 0000000..fe51488 --- /dev/null +++ b/backend/data/tikettes.json @@ -0,0 +1 @@ +[] diff --git a/makeplanche.py b/backend/makeplanche.py similarity index 100% rename from makeplanche.py rename to backend/makeplanche.py diff --git a/makesticker.py b/backend/makesticker.py similarity index 100% rename from makesticker.py rename to backend/makesticker.py diff --git a/mkjam.sh b/backend/mkjam.sh similarity index 100% rename from mkjam.sh rename to backend/mkjam.sh diff --git a/planche.svg.in b/backend/planche.svg.in similarity index 100% rename from planche.svg.in rename to backend/planche.svg.in diff --git a/web.py b/backend/web.py similarity index 100% rename from web.py rename to backend/web.py diff --git a/frontend/config.js b/frontend/config.js new file mode 100644 index 0000000..d520fc4 --- /dev/null +++ b/frontend/config.js @@ -0,0 +1 @@ +const backend_api = 'http://localhost:8001/' \ No newline at end of file diff --git a/static/index.html b/frontend/index.html similarity index 100% rename from static/index.html rename to frontend/index.html diff --git a/static/newtikette.html b/frontend/newtikette.html similarity index 100% rename from static/newtikette.html rename to frontend/newtikette.html diff --git a/static/newtikette.js b/frontend/newtikette.js similarity index 96% rename from static/newtikette.js rename to frontend/newtikette.js index c23f8ca..f0479d4 100644 --- a/static/newtikette.js +++ b/frontend/newtikette.js @@ -1,8 +1,3 @@ -const backend_api = { - 'prod': '/zetikettes/srv/', - 'dev': '/zetikettes.dev/srv/', -}[config]; - const params = [ ['dluo', 'DLUO', true], ['lot', 'Nº de lot', true], @@ -65,7 +60,7 @@ $(document).ready(async () => { landscape`)); const subst = $('

'); for (let param of params) { - subst.append($(`