diff --git a/.gitignore b/.gitignore index a18c5236186937c8b64147fabbf2f2368dbd9186..fadcdf3e705e135d093a939930a20394cc140a83 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ build/ public/ log/ storage/ +version.txt diff --git a/front/Containerfile b/front/Containerfile index 3c501fb34d40a7dde2a9f89bfda2be576785900b..4889e4ede45254da9b626d2b76e6abc062c6cfed 100644 --- a/front/Containerfile +++ b/front/Containerfile @@ -20,8 +20,8 @@ RUN export HOME="$JULIA_PROJECT" \ ENV PATH "$PATH:$JULIA_PROJECT/.juliaup/bin" RUN cd "$JULIA_PROJECT" \ - && rm -rf public \ - && rm -rf storage \ + && git rev-parse --short HEAD > src/version.txt \ + && rm -rf .git public storage \ && cp front/Manifest.toml . \ && julia -e 'using Pkg; Pkg.instantiate()' \ && mkdir -p public \ diff --git a/routes.jl b/routes.jl index 92aee8d3e6ff436d85e3559227a94778a6904de0..3e6bc03f7bc64ea4600ede766529f57d98e427be 100755 --- a/routes.jl +++ b/routes.jl @@ -30,19 +30,23 @@ if Genie.Configuration.isprod() @error "GENIE_ENV=prod is not implemented" end +function modelview(model, view) + page(model, NyxUI.add_footer(view); title=nyxui_title) +end + Stipple.Layout.add_css(nyxui_css) include("src/apps/catalog/app.jl") route("/") do - AppCatalog.handler(nyxui_title) + AppCatalog.handler(modelview) end include("src/apps/muscles/app.jl") MuscleApp.bonito_app.name = "muscles" route("/muscles") do - MuscleApp.handler(nyxui_title) + MuscleApp.handler(modelview) end run_as_script = isinteractive() diff --git a/src/GenieExtras.jl b/src/GenieExtras.jl index 8441d9c8c8ab52b0110e50a8bfe3f7016f7b1dd3..a46484bba044b81b36cb6355bc49ea1cf36bbd96 100644 --- a/src/GenieExtras.jl +++ b/src/GenieExtras.jl @@ -1,6 +1,8 @@ module GenieExtras -export publish_css +import Genie.Renderer.Html + +export publish_css, add_footer const project_root = dirname(Base.current_project()) @@ -28,4 +30,21 @@ function publish_css(; clear=true) return css_dir end +function footer() + version = string(pkgversion(@__MODULE__)) + if endswith(version, ".0") + version = version[1:end-2] + end + versionfile = joinpath(@__DIR__, "version.txt") + version = if isfile(versionfile) + join((version, readchomp(versionfile)), "-") + end + tagurl = "https://gitlab.com/dbc-nyx/NyxUI.jl/-/tags" + Html.footer("NyxUI.jl <a href=\"$tagurl\">v$version</a>") +end + +add_footer(ui::AbstractString) = "$ui$(footer())" + +add_footer(ui::Function) = () -> add_footer(ui()) + end diff --git a/src/apps/catalog/app.jl b/src/apps/catalog/app.jl index 50eabd2ad1532ab66a3c283d3c282118a52749a2..240cf82bb95dd1eefd6c767f6ebab700d3ad2162 100644 --- a/src/apps/catalog/app.jl +++ b/src/apps/catalog/app.jl @@ -46,11 +46,11 @@ end const ui = app_catalog_view -function handler(title) +function handler(modelview) Stipple.Layout.add_css("/css/appcatalog.css") publish_images() empty_model = @init - page(empty_model, app_catalog_view; title=title) + modelview(empty_model, app_catalog_view) end function publish_images() diff --git a/src/apps/muscles/app.jl b/src/apps/muscles/app.jl index 57347c6d3e3cc9d2c63d62894f6c57296e896b05..4a70c66b29d94adcab2afefc91d8c10a567e8e58 100644 --- a/src/apps/muscles/app.jl +++ b/src/apps/muscles/app.jl @@ -298,13 +298,13 @@ end const ui = muscle_view -function handler(title) +function handler(modelview) muscle_model = @init url = "" #muscle_model, url = init_model() Stipple.Layout.add_css("/css/muscleapp.css") channel = muscle_model.channel__ - page(muscle_model, muscle_view(url; channel=channel); title=title) + modelview(muscle_model, muscle_view(url; channel=channel)) end function init_model(muscle_model=nothing) diff --git a/src/nyxui.css b/src/nyxui.css index 2eefde50fe7beae17599bd2040a9990b107b1100..12eb97966aee199dd1718486bdf93ff6be27dda1 100644 --- a/src/nyxui.css +++ b/src/nyxui.css @@ -49,3 +49,8 @@ div.no-file-listing .q-icon { .disabled { pointer-events: none; } + +footer { + text-align: right; + padding-right: 1rem; +}