settings: Can display a global message on all pages

This commit is contained in:
nemunaire 2022-06-08 04:55:19 +02:00
parent e9dd35f8ac
commit 750db69b06
3 changed files with 34 additions and 0 deletions

View File

@ -98,6 +98,31 @@
</div>
</div>
<hr>
<div class="form-group row">
<label for="globalTopMessage" class="col-sm-3 col-form-label col-form-label-sm">Message global (top)</label>
<div class="col-sm-9">
<input type="text" class="form-control form-control-sm" id="globalTopMessage" ng-model="config.globaltopmessage">
</div>
</div>
<div class="form-group row">
<label for="globalTopMessageVariant" class="col-sm-3 col-form-label col-form-label-sm">Variant message global</label>
<div class="col-sm-9">
<select class="form-control form-control-sm" id="globalTopMessage" ng-model="config.globaltopmessagevariant">
<option value=""></option>
<option value="primary">primary</option>
<option value="secondary">secondary</option>
<option value="info">info</option>
<option value="success">success</option>
<option value="danger">danger</option>
<option value="warning">warning</option>
<option value="light">light</option>
<option value="dark">dark</option>
</select>
</div>
</div>
</div>
<div class="card-body pl-0 pt-3 border-top" style="columns: 2;">
<div class="form-check">

View File

@ -156,6 +156,11 @@
<!--Styles /-->
{#if $settings.globaltopmessage}
<div class={'position-fixed w-100 text-center fw-bolder p-0 alert alert-' + ($settings.globaltopmessagevariant?$settings.globaltopmessagevariant:'primary')} style="z-index:1024; border-radius:0">
{$settings.globaltopmessage}
</div>
{/if}
<Header />
<slot></slot>

View File

@ -79,6 +79,10 @@ type Settings struct {
EventKindness bool `json:"eventKindness,omitempty"`
// DisableSubmitButton replace button by this text (eg. scheduled updates, ...).
DisableSubmitButton string `json:"disablesubmitbutton,omitempty"`
// GlobalTopMessage display a message on top of each pages.
GlobalTopMessage string `json:"globaltopmessage,omitempty"`
// GlobalTopMessageVariant control the variant/color of the previous message.
GlobalTopMessageVariant string `json:"globaltopmessagevariant,omitempty"`
}
// ExistsSettings checks if the settings file can by found at the given path.