Control panel state persistence
This commit is contained in:
parent
2f8a15fb89
commit
ddbb08ea75
|
@ -1,5 +1,5 @@
|
||||||
@namespace Oqtane.Themes.Controls
|
@namespace Oqtane.Themes.Controls
|
||||||
@inherits ThemeControlBase
|
@inherits ThemeControlBase
|
||||||
@attribute [OqtaneIgnore]
|
@attribute [OqtaneIgnore]
|
||||||
@inject NavigationManager NavigationManager
|
@inject NavigationManager NavigationManager
|
||||||
@inject IUserService UserService
|
@inject IUserService UserService
|
||||||
|
@ -9,8 +9,9 @@
|
||||||
@inject IPageService PageService
|
@inject IPageService PageService
|
||||||
@inject IPageModuleService PageModuleService
|
@inject IPageModuleService PageModuleService
|
||||||
@inject ILogService logger
|
@inject ILogService logger
|
||||||
|
@inject ISettingService SettingService
|
||||||
|
|
||||||
@if (_moduleDefinitions != null && UserSecurity.IsAuthorized(PageState.User,PermissionNames.Edit, PageState.Page.Permissions))
|
@if (_moduleDefinitions != null && UserSecurity.IsAuthorized(PageState.User, PermissionNames.Edit, PageState.Page.Permissions))
|
||||||
{
|
{
|
||||||
<div class="app-controlpanel" style="@_display">
|
<div class="app-controlpanel" style="@_display">
|
||||||
|
|
||||||
|
@ -31,7 +32,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<hr class="app-rule" />
|
<hr class="app-rule"/>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col text-center">
|
<div class="col text-center">
|
||||||
|
@ -73,23 +74,23 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
<hr class="app-rule" />
|
<hr class="app-rule"/>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col text-center">
|
<div class="col text-center">
|
||||||
<label for="Module" class="control-label">Module Management: </label>
|
<label for="Module" class="control-label">Module Management: </label>
|
||||||
<select class="form-control" @bind="@_moduleType">
|
<select class="form-control" @bind="@ModuleType">
|
||||||
<option value="new">Add New Module</option>
|
<option value="new">Add New Module</option>
|
||||||
<option value="existing">Add Existing Module</option>
|
<option value="existing">Add Existing Module</option>
|
||||||
</select>
|
</select>
|
||||||
@if (_moduleType == "new")
|
@if (ModuleType == "new")
|
||||||
{
|
{
|
||||||
@if (_moduleDefinitions != null)
|
@if (_moduleDefinitions != null)
|
||||||
{
|
{
|
||||||
<select class="form-control" @onchange="(e => CategoryChanged(e))">
|
<select class="form-control" @onchange="(e => CategoryChanged(e))">
|
||||||
@foreach (var category in _categories)
|
@foreach (var category in _categories)
|
||||||
{
|
{
|
||||||
if (category == _category)
|
if (category == Category)
|
||||||
{
|
{
|
||||||
<option value="@category" selected>@category Modules</option>
|
<option value="@category" selected>@category Modules</option>
|
||||||
}
|
}
|
||||||
|
@ -100,7 +101,7 @@
|
||||||
}
|
}
|
||||||
</select>
|
</select>
|
||||||
<select class="form-control" @onchange="(e => ModuleChanged(e))">
|
<select class="form-control" @onchange="(e => ModuleChanged(e))">
|
||||||
@if (_moduleDefinitionName == "-")
|
@if (ModuleDefinitionName == "-")
|
||||||
{
|
{
|
||||||
<option value="-" selected><Select Module></option>
|
<option value="-" selected><Select Module></option>
|
||||||
}
|
}
|
||||||
|
@ -116,7 +117,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</select>
|
</select>
|
||||||
@((MarkupString)@_description)
|
@((MarkupString) Description)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -128,7 +129,7 @@
|
||||||
<option value="@p.PageId">@p.Name</option>
|
<option value="@p.PageId">@p.Name</option>
|
||||||
}
|
}
|
||||||
</select>
|
</select>
|
||||||
<select class="form-control" @bind="@_moduleId">
|
<select class="form-control" @bind="@ModuleId">
|
||||||
<option value="-"><Select Module></option>
|
<option value="-"><Select Module></option>
|
||||||
@foreach (Module module in _modules)
|
@foreach (Module module in _modules)
|
||||||
{
|
{
|
||||||
|
@ -141,13 +142,13 @@
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col text-center">
|
<div class="col text-center">
|
||||||
<label for="Title" class="control-label">Title: </label>
|
<label for="Title" class="control-label">Title: </label>
|
||||||
<input type="text" name="Title" class="form-control" @bind="@_title" />
|
<input type="text" name="Title" class="form-control" @bind="@Title"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col text-center">
|
<div class="col text-center">
|
||||||
<label for="Pane" class="control-label">Pane: </label>
|
<label for="Pane" class="control-label">Pane: </label>
|
||||||
<select class="form-control" @bind="@_pane">
|
<select class="form-control" @bind="@Pane">
|
||||||
<option value=""><Select Pane></option>
|
<option value=""><Select Pane></option>
|
||||||
@foreach (string pane in PageState.Page.Panes)
|
@foreach (string pane in PageState.Page.Panes)
|
||||||
{
|
{
|
||||||
|
@ -159,7 +160,7 @@
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col text-center">
|
<div class="col text-center">
|
||||||
<label for="Container" class="control-label">Container: </label>
|
<label for="Container" class="control-label">Container: </label>
|
||||||
<select class="form-control" @bind="@_containerType">
|
<select class="form-control" @bind="@ContainerType">
|
||||||
@foreach (KeyValuePair<string, string> container in _containers)
|
@foreach (KeyValuePair<string, string> container in _containers)
|
||||||
{
|
{
|
||||||
<option value="@container.Key">@container.Value</option>
|
<option value="@container.Key">@container.Value</option>
|
||||||
|
@ -168,16 +169,16 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<br />
|
<br/>
|
||||||
|
|
||||||
<button type="button" class="btn btn-primary btn-block mx-auto" @onclick="@AddModule">Add Module To Page</button>
|
<button type="button" class="btn btn-primary btn-block mx-auto" @onclick="@AddModule">Add Module To Page</button>
|
||||||
@((MarkupString) _message)
|
@((MarkupString) Message)
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
|
||||||
@if (UserSecurity.IsAuthorized(PageState.User,PermissionNames.Edit, PageState.Page.Permissions) || (PageState.Page.IsPersonalizable && PageState.User != null))
|
@if (UserSecurity.IsAuthorized(PageState.User, PermissionNames.Edit, PageState.Page.Permissions) || (PageState.Page.IsPersonalizable && PageState.User != null))
|
||||||
{
|
{
|
||||||
@if (PageState.Page.EditMode)
|
@if (PageState.Page.EditMode)
|
||||||
{
|
{
|
||||||
|
@ -202,32 +203,52 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@if (UserSecurity.IsAuthorized(PageState.User,PermissionNames.Edit, PageState.Page.Permissions))
|
@if (UserSecurity.IsAuthorized(PageState.User, PermissionNames.Edit, PageState.Page.Permissions))
|
||||||
{
|
{
|
||||||
<button type="button" class="btn @ButtonClass" @onclick="ShowControlPanel">
|
<button type="button" class="btn @ButtonClass" @onclick="ShowControlPanel">
|
||||||
<span class="oi oi-cog"></span>
|
<span class="oi oi-cog"></span>
|
||||||
</button>
|
</button>
|
||||||
}
|
}
|
||||||
|
|
||||||
@code {
|
@code{
|
||||||
|
|
||||||
private bool _deleteConfirmation = false;
|
private bool _deleteConfirmation = false;
|
||||||
private string _moduleType = "new";
|
|
||||||
private List<string> _categories = new List<string>();
|
private List<string> _categories = new List<string>();
|
||||||
private List<ModuleDefinition> _allModuleDefinitions;
|
private List<ModuleDefinition> _allModuleDefinitions;
|
||||||
private List<ModuleDefinition> _moduleDefinitions;
|
private List<ModuleDefinition> _moduleDefinitions;
|
||||||
private List<Page> _pages = new List<Page>();
|
private List<Page> _pages = new List<Page>();
|
||||||
private string _pageId = "-";
|
|
||||||
private string _moduleId = "-";
|
|
||||||
private List<Module> _modules = new List<Module>();
|
private List<Module> _modules = new List<Module>();
|
||||||
private Dictionary<string, string> _containers = new Dictionary<string, string>();
|
private Dictionary<string, string> _containers = new Dictionary<string, string>();
|
||||||
private string _moduleDefinitionName = "-";
|
|
||||||
private string _category = "Common";
|
|
||||||
private string _description = "";
|
|
||||||
private string _pane = "";
|
|
||||||
private string _title = "";
|
|
||||||
private string _containerType = "";
|
|
||||||
private string _display = "display: none;";
|
private string _display = "display: none;";
|
||||||
private string _message = "";
|
private string _category = "Common";
|
||||||
|
|
||||||
|
protected string PageId { get; private set; } = "-";
|
||||||
|
protected string ModuleId { get; private set; } = "-";
|
||||||
|
protected string ModuleType { get; private set; } = "new";
|
||||||
|
protected string ModuleDefinitionName { get; private set; } = "-";
|
||||||
|
|
||||||
|
protected string Category
|
||||||
|
{
|
||||||
|
get => _category;
|
||||||
|
private set
|
||||||
|
{
|
||||||
|
if (_category != value)
|
||||||
|
{
|
||||||
|
_category = value;
|
||||||
|
_moduleDefinitions = _allModuleDefinitions.Where(item => item.Categories.Contains(Category)).ToList();
|
||||||
|
ModuleDefinitionName = "-";
|
||||||
|
Description = "";
|
||||||
|
StateHasChanged();
|
||||||
|
_ = UpdateSettingsAsync();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected string Description { get; private set; } = "";
|
||||||
|
protected string Pane { get; private set; } = "";
|
||||||
|
protected string Title { get; private set; } = "";
|
||||||
|
protected string ContainerType { get; private set; } = "";
|
||||||
|
protected string Message { get; private set; } = "";
|
||||||
|
|
||||||
[Parameter]
|
[Parameter]
|
||||||
public string ButtonClass { get; set; }
|
public string ButtonClass { get; set; }
|
||||||
|
@ -241,7 +262,8 @@
|
||||||
[Parameter]
|
[Parameter]
|
||||||
public string BodyClass { get; set; }
|
public string BodyClass { get; set; }
|
||||||
|
|
||||||
protected override async Task OnParametersSetAsync()
|
|
||||||
|
protected override async Task OnInitializedAsync()
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(ButtonClass))
|
if (string.IsNullOrEmpty(ButtonClass))
|
||||||
{
|
{
|
||||||
|
@ -263,131 +285,107 @@
|
||||||
BodyClass = "card-body";
|
BodyClass = "card-body";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (UserSecurity.IsAuthorized(PageState.User,PermissionNames.Edit, PageState.Page.Permissions))
|
if (UserSecurity.IsAuthorized(PageState.User, PermissionNames.Edit, PageState.Page.Permissions))
|
||||||
{
|
{
|
||||||
_pages?.Clear();
|
_pages?.Clear();
|
||||||
|
|
||||||
foreach (Page p in PageState.Pages)
|
foreach (Page p in PageState.Pages)
|
||||||
{
|
{
|
||||||
if (UserSecurity.IsAuthorized(PageState.User,PermissionNames.View, p.Permissions))
|
if (UserSecurity.IsAuthorized(PageState.User, PermissionNames.View, p.Permissions))
|
||||||
{
|
{
|
||||||
_pages.Add(p);
|
_pages.Add(p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
await LoadSettingsAsync();
|
||||||
|
|
||||||
var panes = PageState.Page.Panes;
|
var panes = PageState.Page.Panes;
|
||||||
_pane = panes.Count() == 1 ? panes.SingleOrDefault() : "";
|
Pane = panes.Count() == 1 ? panes.SingleOrDefault() : "";
|
||||||
var themes = await ThemeService.GetThemesAsync();
|
var themes = await ThemeService.GetThemesAsync();
|
||||||
_containers = ThemeService.GetContainerTypes(themes);
|
_containers = ThemeService.GetContainerTypes(themes);
|
||||||
_containerType = PageState.Site.DefaultContainerType;
|
ContainerType = PageState.Site.DefaultContainerType;
|
||||||
|
|
||||||
_allModuleDefinitions = await ModuleDefinitionService.GetModuleDefinitionsAsync(PageState.Site.SiteId);
|
_allModuleDefinitions = await ModuleDefinitionService.GetModuleDefinitionsAsync(PageState.Site.SiteId);
|
||||||
|
_moduleDefinitions = _allModuleDefinitions.Where(item => item.Categories.Contains(Category)).ToList();
|
||||||
|
|
||||||
_categories = new List<string>();
|
_categories = _allModuleDefinitions.SelectMany(m => m.Categories.Split(',')).Distinct().ToList();
|
||||||
foreach (ModuleDefinition moduledefinition in _allModuleDefinitions)
|
|
||||||
{
|
|
||||||
if (moduledefinition.Categories != "")
|
|
||||||
{
|
|
||||||
foreach (string category in moduledefinition.Categories.Split(','))
|
|
||||||
{
|
|
||||||
if (!_categories.Contains(category))
|
|
||||||
{
|
|
||||||
_categories.Add(category);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
_category = "Common";
|
|
||||||
_moduleDefinitions = _allModuleDefinitions.Where(item => item.Categories.Contains(_category)).ToList();
|
|
||||||
_moduleDefinitionName = "-";
|
|
||||||
_description = "";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CategoryChanged(ChangeEventArgs e)
|
private void CategoryChanged(ChangeEventArgs e)
|
||||||
{
|
{
|
||||||
_category = (string) e.Value;
|
Category = (string) e.Value;
|
||||||
_moduleDefinitions = _allModuleDefinitions.Where(item => item.Categories.Contains(_category)).ToList();
|
|
||||||
_moduleDefinitionName = "-";
|
|
||||||
_description = "";
|
|
||||||
StateHasChanged();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ModuleChanged(ChangeEventArgs e)
|
private void ModuleChanged(ChangeEventArgs e)
|
||||||
{
|
{
|
||||||
_moduleDefinitionName = (string)e.Value;
|
ModuleDefinitionName = (string) e.Value;
|
||||||
if (_moduleDefinitionName != "-")
|
if (ModuleDefinitionName != "-")
|
||||||
{
|
{
|
||||||
var moduleDefinition = _moduleDefinitions.FirstOrDefault(item => item.ModuleDefinitionName == _moduleDefinitionName);
|
var moduleDefinition = _moduleDefinitions.FirstOrDefault(item => item.ModuleDefinitionName == ModuleDefinitionName);
|
||||||
_description = "<br /><div class=\"alert alert-info\" role=\"alert\">" + moduleDefinition.Description + "</div>";
|
Description = "<br /><div class=\"alert alert-info\" role=\"alert\">" + moduleDefinition.Description + "</div>";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_description = "";
|
Description = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
StateHasChanged();
|
StateHasChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void PageChanged(ChangeEventArgs e)
|
private void PageChanged(ChangeEventArgs e)
|
||||||
{
|
{
|
||||||
_pageId = (string) e.Value;
|
PageId = (string) e.Value;
|
||||||
_modules?.Clear();
|
if (PageId != "-")
|
||||||
|
|
||||||
if (_pageId != "-")
|
|
||||||
{
|
{
|
||||||
foreach (Module module in PageState.Modules.Where(item => item.PageId == int.Parse(_pageId) && !item.IsDeleted))
|
_modules = PageState.Modules
|
||||||
{
|
.Where(module => module.PageId == int.Parse(PageId)
|
||||||
if (UserSecurity.IsAuthorized(PageState.User,PermissionNames.View, module.Permissions))
|
&& !module.IsDeleted
|
||||||
{
|
&& UserSecurity.IsAuthorized(PageState.User, PermissionNames.View, module.Permissions))
|
||||||
_modules.Add(module);
|
.ToList();
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
ModuleId = "-";
|
||||||
_moduleId = "-";
|
|
||||||
StateHasChanged();
|
StateHasChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task AddModule()
|
private async Task AddModule()
|
||||||
{
|
{
|
||||||
if (UserSecurity.IsAuthorized(PageState.User,PermissionNames.Edit, PageState.Page.Permissions))
|
if (UserSecurity.IsAuthorized(PageState.User, PermissionNames.Edit, PageState.Page.Permissions))
|
||||||
{
|
{
|
||||||
if ((_moduleType == "new" && _moduleDefinitionName != "-") || (_moduleType != "new" && _moduleId != "-"))
|
if ((ModuleType == "new" && ModuleDefinitionName != "-") || (ModuleType != "new" && ModuleId != "-"))
|
||||||
{
|
{
|
||||||
if (_moduleType == "new")
|
if (ModuleType == "new")
|
||||||
{
|
{
|
||||||
Module module = new Module();
|
Module module = new Module();
|
||||||
module.SiteId = PageState.Site.SiteId;
|
module.SiteId = PageState.Site.SiteId;
|
||||||
module.PageId = PageState.Page.PageId;
|
module.PageId = PageState.Page.PageId;
|
||||||
module.ModuleDefinitionName = _moduleDefinitionName;
|
module.ModuleDefinitionName = ModuleDefinitionName;
|
||||||
module.AllPages = false;
|
module.AllPages = false;
|
||||||
module.Permissions = PageState.Page.Permissions;
|
module.Permissions = PageState.Page.Permissions;
|
||||||
module = await ModuleService.AddModuleAsync(module);
|
module = await ModuleService.AddModuleAsync(module);
|
||||||
_moduleId = module.ModuleId.ToString();
|
ModuleId = module.ModuleId.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
var pageModule = new PageModule
|
var pageModule = new PageModule
|
||||||
{
|
{
|
||||||
PageId = PageState.Page.PageId,
|
PageId = PageState.Page.PageId,
|
||||||
ModuleId = int.Parse(_moduleId),
|
ModuleId = int.Parse(ModuleId),
|
||||||
Title = _title
|
Title = Title
|
||||||
};
|
};
|
||||||
if (pageModule.Title == "")
|
if (pageModule.Title == "")
|
||||||
{
|
{
|
||||||
if (_moduleType == "new")
|
if (ModuleType == "new")
|
||||||
{
|
{
|
||||||
pageModule.Title = _moduleDefinitions.FirstOrDefault(item => item.ModuleDefinitionName == _moduleDefinitionName)?.Name;
|
pageModule.Title = _moduleDefinitions.FirstOrDefault(item => item.ModuleDefinitionName == ModuleDefinitionName)?.Name;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pageModule.Title = _modules.FirstOrDefault(item => item.ModuleId == int.Parse(_moduleId))?.Title;
|
pageModule.Title = _modules.FirstOrDefault(item => item.ModuleId == int.Parse(ModuleId))?.Title;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pageModule.Pane = _pane;
|
pageModule.Pane = Pane;
|
||||||
pageModule.Order = int.MaxValue;
|
pageModule.Order = int.MaxValue;
|
||||||
pageModule.ContainerType = _containerType;
|
pageModule.ContainerType = ContainerType;
|
||||||
|
|
||||||
if (pageModule.ContainerType == PageState.Site.DefaultContainerType)
|
if (pageModule.ContainerType == PageState.Site.DefaultContainerType)
|
||||||
{
|
{
|
||||||
|
@ -397,32 +395,23 @@
|
||||||
await PageModuleService.AddPageModuleAsync(pageModule);
|
await PageModuleService.AddPageModuleAsync(pageModule);
|
||||||
await PageModuleService.UpdatePageModuleOrderAsync(pageModule.PageId, pageModule.Pane);
|
await PageModuleService.UpdatePageModuleOrderAsync(pageModule.PageId, pageModule.Pane);
|
||||||
|
|
||||||
_message = "<br /><div class=\"alert alert-success\" role=\"alert\">Module Added To Page</div>";
|
Message = "<br /><div class=\"alert alert-success\" role=\"alert\">Module Added To Page</div>";
|
||||||
|
|
||||||
_moduleDefinitionName = "-";
|
|
||||||
_description = "";
|
|
||||||
_pane = "";
|
|
||||||
_title = "";
|
|
||||||
_containerType = "";
|
|
||||||
_pageId = "-";
|
|
||||||
_moduleId = "-";
|
|
||||||
|
|
||||||
NavigationManager.NavigateTo(NavigateUrl());
|
NavigationManager.NavigateTo(NavigateUrl());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_message = "<br /><div class=\"alert alert-warning\" role=\"alert\">You Must Select A Module</div>";
|
Message = "<br /><div class=\"alert alert-warning\" role=\"alert\">You Must Select A Module</div>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_message = "<br /><div class=\"alert alert-error\" role=\"alert\">Not Authorized</div>";
|
Message = "<br /><div class=\"alert alert-error\" role=\"alert\">Not Authorized</div>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task ToggleEditMode(bool EditMode)
|
private async Task ToggleEditMode(bool EditMode)
|
||||||
{
|
{
|
||||||
if (UserSecurity.IsAuthorized(PageState.User,PermissionNames.Edit, PageState.Page.Permissions))
|
if (UserSecurity.IsAuthorized(PageState.User, PermissionNames.Edit, PageState.Page.Permissions))
|
||||||
{
|
{
|
||||||
if (EditMode)
|
if (EditMode)
|
||||||
{
|
{
|
||||||
|
@ -432,6 +421,7 @@
|
||||||
{
|
{
|
||||||
PageState.EditMode = true;
|
PageState.EditMode = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
NavigationManager.NavigateTo(NavigateUrl(PageState.Page.Path, "edit=" + ((PageState.EditMode) ? "1" : "0")));
|
NavigationManager.NavigateTo(NavigateUrl(PageState.Page.Path, "edit=" + ((PageState.EditMode) ? "1" : "0")));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -447,14 +437,14 @@
|
||||||
|
|
||||||
private void ShowControlPanel()
|
private void ShowControlPanel()
|
||||||
{
|
{
|
||||||
_message = "";
|
Message = "";
|
||||||
_display = "width: 25%; min-width: 375px;";
|
_display = "width: 25%; min-width: 375px;";
|
||||||
StateHasChanged();
|
StateHasChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void HideControlPanel()
|
private void HideControlPanel()
|
||||||
{
|
{
|
||||||
_message = "";
|
Message = "";
|
||||||
_display = "width: 0%;";
|
_display = "width: 0%;";
|
||||||
StateHasChanged();
|
StateHasChanged();
|
||||||
}
|
}
|
||||||
|
@ -466,7 +456,7 @@
|
||||||
switch (location)
|
switch (location)
|
||||||
{
|
{
|
||||||
case "Admin":
|
case "Admin":
|
||||||
// get admin dashboard moduleid
|
// get admin dashboard moduleid
|
||||||
module = PageState.Modules.FirstOrDefault(item => item.ModuleDefinitionName == Constants.AdminDashboardModule);
|
module = PageState.Modules.FirstOrDefault(item => item.ModuleDefinitionName == Constants.AdminDashboardModule);
|
||||||
|
|
||||||
if (module != null)
|
if (module != null)
|
||||||
|
@ -478,7 +468,7 @@
|
||||||
case "Add":
|
case "Add":
|
||||||
case "Edit":
|
case "Edit":
|
||||||
string url = "";
|
string url = "";
|
||||||
// get page management moduleid
|
// get page management moduleid
|
||||||
module = PageState.Modules.FirstOrDefault(item => item.ModuleDefinitionName == Constants.PageManagementModule);
|
module = PageState.Modules.FirstOrDefault(item => item.ModuleDefinitionName == Constants.PageManagementModule);
|
||||||
|
|
||||||
if (module != null)
|
if (module != null)
|
||||||
|
@ -536,4 +526,18 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private string settingName = "CP-category";
|
||||||
|
|
||||||
|
private async Task LoadSettingsAsync()
|
||||||
|
{
|
||||||
|
Dictionary<string, string> settings = await SettingService.GetUserSettingsAsync(PageState.User.UserId);
|
||||||
|
_category = SettingService.GetSetting(settings, settingName, "Common");
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task UpdateSettingsAsync()
|
||||||
|
{
|
||||||
|
Dictionary<string, string> settings = await SettingService.GetUserSettingsAsync(PageState.User.UserId);
|
||||||
|
SettingService.SetSetting(settings, settingName, _category);
|
||||||
|
await SettingService.UpdateUserSettingsAsync(settings, PageState.User.UserId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user