Refactoring (#314)

* Refactoring

* Refactoring

* Check for a valid email.

* Fixed missing character.

* Moved logic to  the Utilities class.

* Rename template .sql file

* Modified null and empty string check.

* Check for a valid email.

* Fixed missing character.

* Moved logic to  the Utilities class.

* Added Favicon support, Progressive Web App support, page title and url support, and private/public user registration options

* Refactoring

* Refactoring

* Check for a valid email.

* Moved logic to  the Utilities class.

Co-authored-by: Aubrey <aubrey.b@treskcow.tech>
Co-authored-by: MIchael Atwood <matwood@dragonmastery.com>
Co-authored-by: Shaun Walker <shaun.walker@siliqon.com>
This commit is contained in:
Hisham Bin Ateya
2020-03-31 17:21:05 +03:00
committed by GitHub
parent c9baa2bb56
commit 66ad089088
82 changed files with 958 additions and 829 deletions

View File

@ -1,7 +1,7 @@
@namespace Oqtane.Themes.Controls
@inherits ThemeControlBase
@if (menu != "")
@if (menu != string.Empty)
{
<div class="app-menu">
@((MarkupString)menu)
@ -9,11 +9,11 @@
}
@code {
private string menu = string.Empty;
[Parameter]
public string Orientation { get; set; }
string menu = "";
protected override void OnParametersSet()
{
switch (Orientation)
@ -29,8 +29,8 @@
private void CreateVerticalMenu()
{
int level = -1;
int securitylevel = int.MaxValue;
var level = -1;
var securitylevel = int.MaxValue;
menu = "<ul class=\"nav flex-column\">\n";
@ -47,21 +47,25 @@
}
else
{
string target = "";
string target = String.Empty;
if (p.Url.StartsWith("http"))
{
target = " target=\"_new\"";
}
menu += "<a href=\"" + p.Url + "\" class=\"nav-link\" style=\"padding-left: " + ((p.Level + 1) * 15).ToString() + "px !important;\"" + target + ">";
}
menu += "<a href=\string.Empty + NavigateUrl(p.Path) + "\" class=\"nav-link\" style=\"padding-left: " + ((p.Level + 1) * 15).ToString() + "px !important;\">";
if (p.HasChildren)
{
menu += "<i class=\"oi oi-chevron-right\"></i>";
}
if (p.Icon != "")
if (p.Icon != string.Empty)
{
menu += "<span class=\"oi oi-" + p.Icon + "\" aria-hidden=\"true\"></span>";
}
menu += p.Name;
menu += "</a>\n";
menu += "</li>\n";
@ -76,17 +80,19 @@
}
}
}
menu += "</ul>";
}
private void CreateHorizontalMenu()
{
string url = "";
string target = "";
var url = String.Empty;
var target = String.Empty;
menu = "<button class=\"navbar-toggler\" type=\"button\" data-toggle=\"collapse\" data-target=\"#Menu\" aria-controls=\"Menu\" aria-expanded=\"false\" aria-label=\"Toggle navigation\"><span class=\"navbar-toggler-icon\"></span></button>";
menu += "<div class=\"collapse navbar-collapse\" id=\"Menu\">";
menu += "<ul class=\"navbar-nav mr-auto\">";
foreach (Page p in PageState.Pages.Where(item => item.IsNavigation && !item.IsDeleted))
{
if (UserSecurity.IsAuthorized(PageState.User,PermissionNames.View, p.Permissions) && p.ParentId == PageState.Page.ParentId && p.Level == PageState.Page.Level)
@ -94,7 +100,7 @@
if (string.IsNullOrEmpty(p.Url))
{
url = NavigateUrl(p.Path);
target = "";
target = String.Empty;
}
else
{
@ -108,19 +114,20 @@
if (p.PageId == PageState.Page.PageId)
{
menu += "<li class=\"nav-item active\">" +
"<a class=\"nav-link\" href=\"" + url + "\"" + target + ">" +
((p.Icon != "") ? "<span class=\"oi oi-" + p.Icon + "\" aria-hidden=\"true\"></span> " : "") +
"<a class=\"nav-link\" href=\string.Empty + NavigateUrl(p.Path) + "\">" +
((p.Icon != string.Empty) ? "<span class=\"oi oi-" + p.Icon + "\" aria-hidden=\"true\"></span> " : string.Empty) +
p.Name + " <span class=\"sr-only\">(current)</span></a></li>";
}
else
{
menu += "<li class=\"nav-item\">" +
"<a class=\"nav-link\" href=\"" + url + "\"" + target + ">" +
((p.Icon != "") ? "<span class=\"oi oi-" + p.Icon + "\" aria-hidden=\"true\"></span> " : "") +
"<a class=\"nav-link\" href=\string.Empty + NavigateUrl(p.Path) + "\">" +
((p.Icon != string.Empty) ? "<span class=\"oi oi-" + p.Icon + "\" aria-hidden=\"true\"></span> " : string.Empty) +
p.Name + "</a></li>";
}
}
}
menu += "</ul>";
menu += "</div>";
}