commit
ec11587b28
|
@ -6,7 +6,7 @@ using Oqtane.UI;
|
||||||
|
|
||||||
namespace Oqtane.Themes
|
namespace Oqtane.Themes
|
||||||
{
|
{
|
||||||
public class ContainerBase : ComponentBase, IContainerControl
|
public abstract class ContainerBase : ComponentBase, IContainerControl
|
||||||
{
|
{
|
||||||
[Inject]
|
[Inject]
|
||||||
protected IJSRuntime JSRuntime { get; set; }
|
protected IJSRuntime JSRuntime { get; set; }
|
||||||
|
|
|
@ -145,18 +145,20 @@
|
||||||
<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">
|
@if (_pane.Length > 1)
|
||||||
<div class="col text-center">
|
{
|
||||||
<label for="Pane" class="control-label">Pane: </label>
|
<div class="row">
|
||||||
<select class="form-control" @bind="@Pane">
|
<div class="col text-center">
|
||||||
<option value=""><Select Pane></option>
|
<label for="Pane" class="control-label">Pane: </label>
|
||||||
@foreach (string pane in PageState.Page.Panes)
|
<select class="form-control" @bind="@Pane">
|
||||||
{
|
@foreach (string pane in PageState.Page.Panes)
|
||||||
<option value="@pane">@pane Pane</option>
|
{
|
||||||
}
|
<option value="@pane">@pane Pane</option>
|
||||||
</select>
|
}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
}
|
||||||
<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>
|
||||||
|
@ -244,47 +246,41 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected string Pane
|
||||||
|
{
|
||||||
|
get => _pane;
|
||||||
|
private set
|
||||||
|
{
|
||||||
|
if (_pane != value)
|
||||||
|
{
|
||||||
|
_pane = value;
|
||||||
|
_ = UpdateSettingsAsync();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
protected string Description { get; private set; } = "";
|
protected string Description { get; private set; } = "";
|
||||||
protected string Pane { get; private set; } = "";
|
|
||||||
protected string Title { get; private set; } = "";
|
protected string Title { get; private set; } = "";
|
||||||
protected string ContainerType { get; private set; } = "";
|
protected string ContainerType { get; private set; } = "";
|
||||||
protected string Message { get; private set; } = "";
|
protected string Message { get; private set; } = "";
|
||||||
|
|
||||||
[Parameter]
|
[Parameter]
|
||||||
public string ButtonClass { get; set; }
|
public string ButtonClass { get; set; } = "btn-outline-secondary";
|
||||||
|
|
||||||
[Parameter]
|
[Parameter]
|
||||||
public string CardClass { get; set; }
|
public string CardClass { get; set; } = "card border-secondary mb-3";
|
||||||
|
|
||||||
[Parameter]
|
[Parameter]
|
||||||
public string HeaderClass { get; set; }
|
public string HeaderClass { get; set; } = "card-header";
|
||||||
|
|
||||||
[Parameter]
|
[Parameter]
|
||||||
public string BodyClass { get; set; }
|
public string BodyClass { get; set; } = "card-body";
|
||||||
|
|
||||||
|
|
||||||
protected override async Task OnInitializedAsync()
|
protected override async Task OnInitializedAsync()
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(ButtonClass))
|
|
||||||
{
|
|
||||||
ButtonClass = "btn-outline-secondary";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(CardClass))
|
|
||||||
{
|
|
||||||
CardClass = "card border-secondary mb-3";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(HeaderClass))
|
|
||||||
{
|
|
||||||
HeaderClass = "card-header";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(BodyClass))
|
|
||||||
{
|
|
||||||
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();
|
||||||
|
@ -298,15 +294,11 @@
|
||||||
}
|
}
|
||||||
await LoadSettingsAsync();
|
await LoadSettingsAsync();
|
||||||
|
|
||||||
var panes = PageState.Page.Panes;
|
|
||||||
Pane = panes.Count() == 1 ? panes.SingleOrDefault() : "";
|
|
||||||
var themes = await ThemeService.GetThemesAsync();
|
var themes = await ThemeService.GetThemesAsync();
|
||||||
_containers = ThemeService.GetContainerControls(themes, PageState.Page.ThemeType);
|
_containers = ThemeService.GetContainerControls(themes, PageState.Page.ThemeType);
|
||||||
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();
|
_moduleDefinitions = _allModuleDefinitions.Where(item => item.Categories.Contains(Category)).ToList();
|
||||||
|
|
||||||
_categories = _allModuleDefinitions.SelectMany(m => m.Categories.Split(',')).Distinct().ToList();
|
_categories = _allModuleDefinitions.SelectMany(m => m.Categories.Split(',')).Distinct().ToList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -526,18 +518,24 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private string settingName = "CP-category";
|
private string settingCategory = "CP-category";
|
||||||
|
private string settingPane = "CP-pane";
|
||||||
|
private string _pane = "";
|
||||||
|
|
||||||
private async Task LoadSettingsAsync()
|
private async Task LoadSettingsAsync()
|
||||||
{
|
{
|
||||||
Dictionary<string, string> settings = await SettingService.GetUserSettingsAsync(PageState.User.UserId);
|
Dictionary<string, string> settings = await SettingService.GetUserSettingsAsync(PageState.User.UserId);
|
||||||
_category = SettingService.GetSetting(settings, settingName, "Common");
|
_category = SettingService.GetSetting(settings, settingCategory, "Common");
|
||||||
|
var pane = SettingService.GetSetting(settings, settingPane, "");
|
||||||
|
_pane = PageState.Page.Panes.Contains(pane) ? pane : PageState.Page.Panes.FirstOrDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task UpdateSettingsAsync()
|
private async Task UpdateSettingsAsync()
|
||||||
{
|
{
|
||||||
Dictionary<string, string> settings = await SettingService.GetUserSettingsAsync(PageState.User.UserId);
|
Dictionary<string, string> settings = await SettingService.GetUserSettingsAsync(PageState.User.UserId);
|
||||||
SettingService.SetSetting(settings, settingName, _category);
|
SettingService.SetSetting(settings, settingCategory, _category);
|
||||||
|
SettingService.SetSetting(settings, settingPane, _pane);
|
||||||
await SettingService.UpdateUserSettingsAsync(settings, PageState.User.UserId);
|
await SettingService.UpdateUserSettingsAsync(settings, PageState.User.UserId);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ using Oqtane.UI;
|
||||||
|
|
||||||
namespace Oqtane.Themes
|
namespace Oqtane.Themes
|
||||||
{
|
{
|
||||||
public class LayoutBase : ComponentBase, ILayoutControl
|
public abstract class LayoutBase : ComponentBase, ILayoutControl
|
||||||
{
|
{
|
||||||
[CascadingParameter]
|
[CascadingParameter]
|
||||||
protected PageState PageState { get; set; }
|
protected PageState PageState { get; set; }
|
||||||
|
|
|
@ -8,7 +8,7 @@ using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Oqtane.Themes
|
namespace Oqtane.Themes
|
||||||
{
|
{
|
||||||
public class ThemeBase : ComponentBase, IThemeControl
|
public abstract class ThemeBase : ComponentBase, IThemeControl
|
||||||
{
|
{
|
||||||
[Inject]
|
[Inject]
|
||||||
protected IJSRuntime JSRuntime { get; set; }
|
protected IJSRuntime JSRuntime { get; set; }
|
||||||
|
|
|
@ -4,7 +4,7 @@ using Oqtane.UI;
|
||||||
|
|
||||||
namespace Oqtane.Themes
|
namespace Oqtane.Themes
|
||||||
{
|
{
|
||||||
public class ThemeControlBase : ComponentBase
|
public abstract class ThemeControlBase : ComponentBase
|
||||||
{
|
{
|
||||||
[CascadingParameter]
|
[CascadingParameter]
|
||||||
protected PageState PageState { get; set; }
|
protected PageState PageState { get; set; }
|
||||||
|
|
|
@ -193,11 +193,7 @@ namespace Oqtane.Repository
|
||||||
foreach (Type modulecontroltype in modulecontroltypes)
|
foreach (Type modulecontroltype in modulecontroltypes)
|
||||||
{
|
{
|
||||||
// Check if type should be ignored
|
// Check if type should be ignored
|
||||||
if (modulecontroltype.Name == "ModuleBase"
|
if (modulecontroltype.IsOqtaneIgnore()) continue;
|
||||||
|| modulecontroltype.IsGenericType
|
|
||||||
|| modulecontroltype.IsAbstract
|
|
||||||
|| modulecontroltype.IsOqtaneIgnore()
|
|
||||||
) continue;
|
|
||||||
|
|
||||||
// create namespace root typename
|
// create namespace root typename
|
||||||
string qualifiedModuleType = modulecontroltype.Namespace + ", " + modulecontroltype.Assembly.GetName().Name;
|
string qualifiedModuleType = modulecontroltype.Namespace + ", " + modulecontroltype.Assembly.GetName().Name;
|
||||||
|
|
|
@ -50,10 +50,7 @@ namespace Oqtane.Repository
|
||||||
foreach (Type themeControlType in themeControlTypes)
|
foreach (Type themeControlType in themeControlTypes)
|
||||||
{
|
{
|
||||||
// Check if type should be ignored
|
// Check if type should be ignored
|
||||||
if (themeControlType.Name == "ThemeBase"
|
if (themeControlType.IsOqtaneIgnore()
|
||||||
|| themeControlType.IsGenericType
|
|
||||||
|| themeControlType.IsAbstract
|
|
||||||
|| themeControlType.IsOqtaneIgnore()
|
|
||||||
) continue;
|
) continue;
|
||||||
|
|
||||||
// create namespace root typename
|
// create namespace root typename
|
||||||
|
|
|
@ -80,9 +80,14 @@ namespace System.Reflection
|
||||||
.Where(a => Utilities.GetFullTypeName(a.GetName().Name) != "Oqtane.Client");
|
.Where(a => Utilities.GetFullTypeName(a.GetName().Name) != "Oqtane.Client");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Checks if type should be ignored by oqtane dynamic loader
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="type">Checked type</param>
|
||||||
|
/// <returns></returns>
|
||||||
public static bool IsOqtaneIgnore(this Type type)
|
public static bool IsOqtaneIgnore(this Type type)
|
||||||
{
|
{
|
||||||
return Attribute.IsDefined(type, typeof(OqtaneIgnoreAttribute));
|
return Attribute.IsDefined(type, typeof(OqtaneIgnoreAttribute)) || type.IsAbstract || type.IsGenericType;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user