fixed theme/layout handling in Add/Edit Page

This commit is contained in:
Shaun Walker 2020-05-03 11:39:34 -04:00
parent 45aeb17020
commit bf84f12471
2 changed files with 26 additions and 21 deletions

View File

@ -101,7 +101,7 @@
</td> </td>
<td> <td>
<select id="Theme" class="form-control" @onchange="(e => ThemeChanged(e))"> <select id="Theme" class="form-control" @onchange="(e => ThemeChanged(e))">
<option value="">&lt;Select Theme&gt;</option> <option value="-">&lt;Select Theme&gt;</option>
@foreach (KeyValuePair<string, string> item in _themes) @foreach (KeyValuePair<string, string> item in _themes)
{ {
if (item.Key == _themetype) if (item.Key == _themetype)
@ -122,7 +122,7 @@
</td> </td>
<td> <td>
<select id="Layout" class="form-control" @bind="@_layouttype"> <select id="Layout" class="form-control" @bind="@_layouttype">
<option value="">&lt;Select Layout&gt;</option> <option value="-">&lt;Select Layout&gt;</option>
@foreach (KeyValuePair<string, string> panelayout in _panelayouts) @foreach (KeyValuePair<string, string> panelayout in _panelayouts)
{ {
if (panelayout.Key == _layouttype) if (panelayout.Key == _layouttype)
@ -200,8 +200,8 @@
private string _url; private string _url;
private string _ispersonalizable = "False"; private string _ispersonalizable = "False";
private string _mode = "view"; private string _mode = "view";
private string _themetype = string.Empty; private string _themetype = "-";
private string _layouttype = string.Empty; private string _layouttype = "-";
private string _icon = string.Empty; private string _icon = string.Empty;
private string _permissions = string.Empty; private string _permissions = string.Empty;
private PermissionGrid _permissionGrid; private PermissionGrid _permissionGrid;
@ -271,7 +271,7 @@
try try
{ {
_themetype = (string)e.Value; _themetype = (string)e.Value;
if (_themetype != string.Empty) if (_themetype != "-")
{ {
_panelayouts = ThemeService.GetPaneLayoutTypes(_themeList, _themetype); _panelayouts = ThemeService.GetPaneLayoutTypes(_themeList, _themetype);
} }
@ -350,11 +350,8 @@
page.IsNavigation = (_isnavigation == null ? true : Boolean.Parse(_isnavigation)); page.IsNavigation = (_isnavigation == null ? true : Boolean.Parse(_isnavigation));
page.Url = _url; page.Url = _url;
page.EditMode = (_mode == "edit" ? true : false); page.EditMode = (_mode == "edit" ? true : false);
page.ThemeType = _themetype; page.ThemeType = (_themetype != "-") ? _themetype : string.Empty;
page.LayoutType = (_layouttype == null ? string.Empty : _layouttype); page.LayoutType = (_layouttype != "-") ? _layouttype : string.Empty;
page.Icon = (_icon == null ? string.Empty : _icon);
page.Permissions = _permissionGrid.GetPermissions();
if (page.ThemeType == PageState.Site.DefaultThemeType) if (page.ThemeType == PageState.Site.DefaultThemeType)
{ {
page.ThemeType = string.Empty; page.ThemeType = string.Empty;
@ -364,7 +361,8 @@
{ {
page.LayoutType = string.Empty; page.LayoutType = string.Empty;
} }
page.Icon = (_icon == null ? string.Empty : _icon);
page.Permissions = _permissionGrid.GetPermissions();
page.IsPersonalizable = (_ispersonalizable == null ? false : Boolean.Parse(_ispersonalizable)); page.IsPersonalizable = (_ispersonalizable == null ? false : Boolean.Parse(_ispersonalizable));
page.UserId = null; page.UserId = null;

View File

@ -112,7 +112,7 @@
</td> </td>
<td> <td>
<select id="Theme" class="form-control" @onchange="(e => ThemeChanged(e))"> <select id="Theme" class="form-control" @onchange="(e => ThemeChanged(e))">
<option value="">&lt;Select Theme&gt;</option> <option value="-">&lt;Select Theme&gt;</option>
@foreach (KeyValuePair<string, string> item in _themes) @foreach (KeyValuePair<string, string> item in _themes)
{ {
if (item.Key == _themetype) if (item.Key == _themetype)
@ -133,7 +133,7 @@
</td> </td>
<td> <td>
<select id="Layout" class="form-control" @bind="@_layouttype"> <select id="Layout" class="form-control" @bind="@_layouttype">
<option value="">&lt;Select Layout&gt;</option> <option value="-">&lt;Select Layout&gt;</option>
@foreach (KeyValuePair<string, string> panelayout in _panelayouts) @foreach (KeyValuePair<string, string> panelayout in _panelayouts)
{ {
if (panelayout.Key == _layouttype) if (panelayout.Key == _layouttype)
@ -215,8 +215,8 @@
private string _url; private string _url;
private string _ispersonalizable; private string _ispersonalizable;
private string _mode; private string _mode;
private string _themetype; private string _themetype = "-";
private string _layouttype; private string _layouttype = "-";
private string _icon; private string _icon;
private string _permissions; private string _permissions;
private string _createdby; private string _createdby;
@ -272,6 +272,14 @@
_themetype = page.ThemeType; _themetype = page.ThemeType;
_panelayouts = ThemeService.GetPaneLayoutTypes(_themeList, _themetype); _panelayouts = ThemeService.GetPaneLayoutTypes(_themeList, _themetype);
_layouttype = page.LayoutType; _layouttype = page.LayoutType;
if (_themetype == PageState.Site.DefaultThemeType)
{
_themetype = "-";
}
if (_layouttype == PageState.Site.DefaultLayoutType)
{
_layouttype = "-";
}
_icon = page.Icon; _icon = page.Icon;
_permissions = page.Permissions; _permissions = page.Permissions;
_createdby = page.CreatedBy; _createdby = page.CreatedBy;
@ -337,7 +345,7 @@
try try
{ {
_themetype = (string)e.Value; _themetype = (string)e.Value;
if (_themetype != string.Empty) if (_themetype != "-")
{ {
_panelayouts = ThemeService.GetPaneLayoutTypes(_themeList, _themetype); _panelayouts = ThemeService.GetPaneLayoutTypes(_themeList, _themetype);
} }
@ -417,11 +425,8 @@
page.IsNavigation = (_isnavigation == null || Boolean.Parse(_isnavigation)); page.IsNavigation = (_isnavigation == null || Boolean.Parse(_isnavigation));
page.Url = _url; page.Url = _url;
page.EditMode = (_mode == "edit"); page.EditMode = (_mode == "edit");
page.ThemeType = _themetype; page.ThemeType = (_themetype != "-") ? _themetype : string.Empty;
page.LayoutType = _layouttype ?? string.Empty; page.LayoutType = (_layouttype != "-") ? _layouttype : string.Empty;
page.Icon = _icon ?? string.Empty;
page.Permissions = _permissionGrid.GetPermissions();
if (page.ThemeType == PageState.Site.DefaultThemeType) if (page.ThemeType == PageState.Site.DefaultThemeType)
{ {
page.ThemeType = string.Empty; page.ThemeType = string.Empty;
@ -430,6 +435,8 @@
{ {
page.LayoutType = string.Empty; page.LayoutType = string.Empty;
} }
page.Icon = _icon ?? string.Empty;
page.Permissions = _permissionGrid.GetPermissions();
page.IsPersonalizable = (_ispersonalizable != null && Boolean.Parse(_ispersonalizable)); page.IsPersonalizable = (_ispersonalizable != null && Boolean.Parse(_ispersonalizable));
page.UserId = null; page.UserId = null;