Added functionality to add icons to the ActionLinks.

This commit is contained in:
Mike Casas 2020-03-23 10:24:54 -04:00
parent 0988321b37
commit ad031cb375

View File

@ -6,11 +6,11 @@
{
if (Disabled)
{
<NavLink class="@_classname" href="@_url" style="@_style" disabled>@_text</NavLink>
<NavLink class="@_classname" href="@_url" style="@_style" disabled>@((MarkupString)_iconSpan) @_text</NavLink>
}
else
{
<NavLink class="@_classname" href="@_url" style="@_style">@_text</NavLink>
<NavLink class="@_classname" href="@_url" style="@_style">@((MarkupString)_iconSpan) @_text</NavLink>
}
}
@ -39,6 +39,9 @@
[Parameter]
public string EditMode { get; set; } // optional - specifies if a user must be in edit mode to see the action - default is true
[Parameter]
public string IconName { get; set; } // optional - specifies an icon for the link - default is no icon
string _text = "";
string _url = "";
string _parameters = "";
@ -46,6 +49,7 @@
string _style = "";
bool _editmode = true;
bool _authorized = false;
string _iconSpan = "";
protected override void OnParametersSet()
{
@ -75,6 +79,11 @@
_editmode = bool.Parse(EditMode);
}
if (!string.IsNullOrEmpty(IconName))
{
_iconSpan = $"<span class=\"oi oi-{IconName}\"></span>&nbsp;";
}
_url = EditUrl(Action, _parameters);
_authorized = IsAuthorized();
}