Introduce the menuless mode

This commit is contained in:
Filip Gralinski 2021-08-21 11:48:05 +02:00
parent 9c4a751bf2
commit 041e39b676
7 changed files with 23 additions and 1 deletions

View File

@ -128,6 +128,13 @@ the token and adds a record to the Gonito database.
You can simulate a front-end by going to `/static/test-gonito-as-backend.html`.
### Menuless mode
If you want to combine an external front-end with some features of the
Gonito native front-end, you can run Gonito in a _menuless_ mode
setting `MENULESS` to `true`. This way, you will not show all the
functions of native Gonito.
Gonito & git
------------

View File

@ -115,6 +115,11 @@ data AppSettings = AppSettings
-- The team for which the user is the captain
-- will be preferred
, appAutoTeam :: Bool
-- ^ Do not show the menu
-- (Unless the user is an admin). Can be used to combine Gonito
-- with an external front-end.
, appMenuless :: Bool
}
instance FromJSON AppSettings where
@ -168,6 +173,8 @@ instance FromJSON AppSettings where
appAutoTeam <- o .:? "auto-team" .!= False
appMenuless <- o .:? "menuless" .!= False
return AppSettings {..}
-- just in case, not sure if needed

View File

@ -16,6 +16,7 @@ leaderboard-style: "_env:LEADERBOARD_STYLE:by-submitter"
announcement-hook: "_env:ANNOUNCEMENT_HOOK:"
server-ssh-public-key: "_env:SERVER_SSH_PUBLIC_KEY:"
is-public: "_env:IS_PUBLIC:true"
menuless: "_env:MENULESS:false"
# How the output of asynchronous operations is presented
# - with-plain-text - just plain text shown by the browser;

View File

@ -17,6 +17,7 @@ services:
- IS_PUBLIC=${GONITO_IS_PUBLIC:-true}
- JSON_WEB_KEY=${JSON_WEB_KEY}
- ANNOUNCEMENT_HOOK=${GONITO_ANNOUNCEMENT_HOOK}
- MENULESS=${GONITO_MENULESS}
ports:
- 3000:3000
volumes:

View File

@ -30,6 +30,7 @@ services:
- AUTO_TEAM=${GONITO_AUTO_TEAM:-false}
- TEAM_FIELD=$GONITO_TEAM_FIELD
- ANNOUNCEMENT_HOOK=${GONITO_ANNOUNCEMENT_HOOK}
- MENULESS=${GONITO_MENULESS}
expose:
- "3000"
volumes:

View File

@ -29,3 +29,6 @@ JSON_WEB_KEY={"kty":"RSA", "alg":"RS256", "use":"sig", "kid":"h01jmt_bD-1Di8i_GY
# Announcements can be sent to Slack or Discord via a given web hook
GONITO_ANNOUNCEMENT_HOOK=https://discord.com/api/webhooks/123456789/abcdefghijklmnopqrstuvwxz123456789
# Do not show the menu if set to true. Can be useful when combined with an external front-end.
GONITO_MENULESS=false

View File

@ -4,7 +4,9 @@
<div class="row">
<div class="col-xs-12">
<img src="#{banner}">
<nav class="navbar navbar-default navbar-fixed-top">
$if (not (appMenuless (appSettings master))) || (fromMaybe False ((fmap userIsAdmin) ((fmap entityVal) maybeUser)))
<nav class="navbar navbar-default navbar-fixed-top">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">