Initial commit
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
@page "/settings"
|
||||
@attribute [Authorize]
|
||||
@inject IUserSessionService Session
|
||||
@rendermode InteractiveServer
|
||||
|
||||
<h1 class="page-title">Settings</h1>
|
||||
|
||||
<div class="card">
|
||||
<div class="card-title">Display</div>
|
||||
<div class="form-group">
|
||||
<label class="form-label">Language</label>
|
||||
<select class="form-select" style="width:160px" @bind="_lang" @bind:after="Save">
|
||||
<option value="en">English</option>
|
||||
<option value="fr">Français</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="form-label">Theme</label>
|
||||
<select class="form-select" style="width:160px" @bind="_theme" @bind:after="Save">
|
||||
<option value="System">System</option>
|
||||
<option value="Light">Light</option>
|
||||
<option value="Dark">Dark</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<div class="card-title">Behavior</div>
|
||||
<div class="form-group">
|
||||
<label style="display:flex;align-items:center;gap:8px;cursor:pointer">
|
||||
<input type="checkbox" @bind="_autoTakeOwnership" @bind:after="Save" />
|
||||
Auto-elevate ownership when permission scan is denied
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@if (_saved) { <div class="alert alert-success">Settings saved.</div> }
|
||||
|
||||
@code {
|
||||
private string _lang = "en", _theme = "System";
|
||||
private bool _autoTakeOwnership, _saved;
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
var s = Session.Settings;
|
||||
_lang = s.Lang;
|
||||
_theme = s.Theme;
|
||||
_autoTakeOwnership = s.AutoTakeOwnership;
|
||||
}
|
||||
|
||||
private void Save()
|
||||
{
|
||||
Session.UpdateSettings(new AppSettings { Lang = _lang, Theme = _theme, AutoTakeOwnership = _autoTakeOwnership });
|
||||
SharepointToolbox.Web.Localization.TranslationSource.Instance.SetCulture(_lang);
|
||||
_saved = true;
|
||||
StateHasChanged();
|
||||
_ = Task.Delay(2000).ContinueWith(_ => { _saved = false; InvokeAsync(StateHasChanged); });
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user