Skip to content

Commit

Permalink
Merge pull request #1009 from sbwalker/dev
Browse files Browse the repository at this point in the history
allow developers to use custom icon libraries (Open Iconic is the default)
  • Loading branch information
sbwalker authored Dec 22, 2020
2 parents 3f8b9ef + df382ce commit 8ab0122
Show file tree
Hide file tree
Showing 13 changed files with 41 additions and 20 deletions.
4 changes: 2 additions & 2 deletions Oqtane.Client/Modules/Admin/Dashboard/Index.razor
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@namespace Oqtane.Modules.Admin.Dashboard
@namespace Oqtane.Modules.Admin.Dashboard
@inherits ModuleBase
@inject IPageService PageService
@inject IUserService UserService
Expand All @@ -11,7 +11,7 @@
string url = NavigateUrl(p.Path);
<div class="col-md-2 mx-auto text-center">
<NavLink class="nav-link" href="@url" Match="NavLinkMatch.All">
<h2><span class="oi oi-@p.Icon" aria-hidden="true"></span></h2>@p.Name
<h2><span class="@p.Icon" aria-hidden="true"></span></h2>@p.Name
</NavLink>
</div>
}
Expand Down
2 changes: 1 addition & 1 deletion Oqtane.Client/Modules/Admin/Pages/Add.razor
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@
</tr>
<tr>
<td>
<Label For="Icon" HelpText="Optionally provide an icon for this page which will be displayed in the site navigation" ResourceKey="Icon">Icon: </Label>
<Label For="Icon" HelpText="Optionally provide an icon class name for this page which will be displayed in the site navigation" ResourceKey="Icon">Icon: </Label>
</td>
<td>
<input id="Icon" class="form-control" @bind="@_icon" />
Expand Down
2 changes: 1 addition & 1 deletion Oqtane.Client/Modules/Admin/Pages/Edit.razor
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@
</tr>
<tr>
<td>
<Label For="Icon" HelpText="Optionally provide an icon for this page which will be displayed in the site navigation" ResourceKey="Icon">Icon: </Label>
<Label For="Icon" HelpText="Optionally provide an icon class name for this page which will be displayed in the site navigation" ResourceKey="Icon">Icon: </Label>
</td>
<td>
<input id="Icon" class="form-control" @bind="@_icon" />
Expand Down
6 changes: 5 additions & 1 deletion Oqtane.Client/Modules/Controls/ActionDialog.razor
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,11 @@

if (!string.IsNullOrEmpty(IconName))
{
_iconSpan = $"<span class=\"oi oi-{IconName}\"></span>&nbsp;";
if (!IconName.Contains(" "))
{
IconName = "oi oi-" + IconName;
}
_iconSpan = $"<span class=\"{IconName}\"></span>&nbsp;";
}

Text = Localize(nameof(Text), Text);
Expand Down
6 changes: 5 additions & 1 deletion Oqtane.Client/Modules/Controls/ActionLink.razor
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,11 @@

if (!string.IsNullOrEmpty(IconName))
{
_iconSpan = $"<span class=\"oi oi-{IconName}\"></span>{(IconOnly ? "" : "&nbsp")}";
if (!IconName.Contains(" "))
{
IconName = "oi oi-" + IconName;
}
_iconSpan = $"<span class=\"{IconName}\"></span>{(IconOnly ? "" : "&nbsp")}";

}

Expand Down
6 changes: 3 additions & 3 deletions Oqtane.Client/Themes/Controls/MenuHorizontal.razor
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@namespace Oqtane.Themes.Controls
@namespace Oqtane.Themes.Controls
@inherits MenuBase

@if (MenuPages.Any())
Expand All @@ -19,7 +19,7 @@
<a class="nav-link" href="@GetUrl(p)" target="@GetTarget(p)" >
@if (p.Icon != string.Empty)
{
<span class="oi oi-@p.Icon" aria-hidden="true"></span>
<span class="@p.Icon" aria-hidden="true"></span>
}
@p.Name<span class="sr-only">(current)</span>
</a>
Expand All @@ -31,7 +31,7 @@
<a class="nav-link" href="@GetUrl(p)" target="@GetTarget(p)" >
@if (p.Icon != string.Empty)
{
<span class="oi oi-@p.Icon" aria-hidden="true"></span>
<span class="@p.Icon" aria-hidden="true"></span>
}
@p.Name
</a>
Expand Down
4 changes: 2 additions & 2 deletions Oqtane.Client/Themes/Controls/MenuVertical.razor
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@namespace Oqtane.Themes.Controls
@namespace Oqtane.Themes.Controls
@inherits MenuBase

@if (MenuPages.Any())
Expand All @@ -22,7 +22,7 @@
}
@if (p.Icon != string.Empty)
{
<span class="oi oi-@p.Icon" aria-hidden="true"></span>
<span class="@p.Icon" aria-hidden="true"></span>
}
@p.Name
</a>
Expand Down
4 changes: 2 additions & 2 deletions Oqtane.Client/Themes/Controls/ModuleActions.razor
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@namespace Oqtane.Themes.Controls
@namespace Oqtane.Themes.Controls
@inherits ModuleActionsBase
@attribute [OqtaneIgnore]

Expand All @@ -22,7 +22,7 @@
}
else
{
<span class="oi oi-@action.Icon" aria-hidden="true"></span>
<span class="@action.Icon" aria-hidden="true"></span>
}
&nbsp;
@action.Name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public List<PageTemplate> CreateSite(Site site)
Name = "Home",
Parent = "",
Path = "",
Icon = "home",
Icon = "oi oi-home",
IsNavigation = true,
IsPersonalizable = false,
PagePermissions = new List<Permission> {
Expand Down Expand Up @@ -85,7 +85,7 @@ public List<PageTemplate> CreateSite(Site site)
Name = "Private",
Parent = "",
Path = "private",
Icon = "lock-locked",
Icon = "oi oi-lock-locked",
IsNavigation = true,
IsPersonalizable = false,
PagePermissions = new List<Permission> {
Expand All @@ -109,7 +109,7 @@ public List<PageTemplate> CreateSite(Site site)
Name = "My Page",
Parent = "",
Path = "mypage",
Icon = "target",
Icon = "oi oi-target",
IsNavigation = true,
IsPersonalizable = true,
PagePermissions = new List<Permission> {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Oqtane.Models;
using Oqtane.Models;
using Oqtane.Infrastructure;
using System.Collections.Generic;
using Oqtane.Extensions;
Expand Down Expand Up @@ -27,7 +27,7 @@ public List<PageTemplate> CreateSite(Site site)
Name = "Home",
Parent = "",
Path = "",
Icon = "home",
Icon = "oi oi-home",
IsNavigation = true,
IsPersonalizable = false,
PagePermissions = new List<Permission> {
Expand Down
4 changes: 4 additions & 0 deletions Oqtane.Server/Oqtane.Server.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
<EmbeddedResource Include="Scripts\Master.00.00.00.00.sql" />
<EmbeddedResource Include="Scripts\Master.00.09.00.00.sql" />
<EmbeddedResource Include="Scripts\Master.01.00.01.00.sql" />
<EmbeddedResource Include="Scripts\Tenant.02.00.01.01.sql" />
<EmbeddedResource Include="Scripts\Tenant.00.00.00.00.sql" />
<EmbeddedResource Include="Scripts\Tenant.00.09.00.00.sql" />
<EmbeddedResource Include="Scripts\Tenant.00.09.01.00.sql" />
Expand Down Expand Up @@ -60,6 +61,9 @@
<UpgradeFiles Include="$(ProjectDir)bin\Release\net5.0\Oqtane.Upgrade.runtimeconfig.json" />
<TemplateFiles Include="$(ProjectDir)wwwroot\Modules\Templates\**\*.*" />
</ItemGroup>
<ItemGroup>
<None Remove="Scripts\Tenant.02.00.01.01.sql" />
</ItemGroup>
<Target Name="AddPayloadsFolder" AfterTargets="Publish">
<Copy SourceFiles="@(UpgradeFiles)" DestinationFiles="@(UpgradeFiles->'$(PublishDir)%(RecursiveDir)%(Filename)%(Extension)')" SkipUnchangedFiles="false" />
<Copy SourceFiles="@(TemplateFiles)" DestinationFiles="@(TemplateFiles->'$(PublishDir)wwwroot\Modules\Templates\%(RecursiveDir)%(Filename)%(Extension)')" SkipUnchangedFiles="false" />
Expand Down
9 changes: 9 additions & 0 deletions Oqtane.Server/Scripts/Tenant.02.00.01.01.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/*
Version 2.0.1 Tenant migration script
*/

UPDATE [dbo].[Page] SET Icon = IIF(Icon <> '', 'oi oi-' + Icon, '');
GO

4 changes: 2 additions & 2 deletions Oqtane.Shared/Shared/Icons.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
namespace Oqtane.Shared
namespace Oqtane.Shared
{
//Open Iconic icons set
public static class Icons
{
private const string Prefix = ""; //oi-
private const string Prefix = "oi oi-";
public const string AccountLogin = Prefix + "account-login";
public const string AccountLogout = Prefix + "account-logout";
public const string ActionRedo = Prefix + "action-redo";
Expand Down

0 comments on commit 8ab0122

Please sign in to comment.