Merge pull request #302 from mikecasas/feature-icon
Added functionality to add icons to the ActionLinks.
This commit is contained in:
commit
7ee920bb8b
|
@ -6,11 +6,11 @@
|
||||||
{
|
{
|
||||||
if (Disabled)
|
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
|
else
|
||||||
{
|
{
|
||||||
<NavLink class="@_classname" href="@_url" style="@_style">@_text</NavLink>
|
<NavLink class="@_classname" href="@_url" style="@_style">@((MarkupString)_iconSpan) @_text</NavLink>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,12 +33,15 @@
|
||||||
[Parameter]
|
[Parameter]
|
||||||
public string Style { get; set; } // optional
|
public string Style { get; set; } // optional
|
||||||
|
|
||||||
[Parameter]
|
[Parameter]
|
||||||
public bool Disabled { get; set; } // optional
|
public bool Disabled { get; set; } // optional
|
||||||
|
|
||||||
[Parameter]
|
[Parameter]
|
||||||
public string EditMode { get; set; } // optional - specifies if a user must be in edit mode to see the action - default is true
|
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 _text = "";
|
||||||
string _url = "";
|
string _url = "";
|
||||||
string _parameters = "";
|
string _parameters = "";
|
||||||
|
@ -46,6 +49,7 @@
|
||||||
string _style = "";
|
string _style = "";
|
||||||
bool _editmode = true;
|
bool _editmode = true;
|
||||||
bool _authorized = false;
|
bool _authorized = false;
|
||||||
|
string _iconSpan = "";
|
||||||
|
|
||||||
protected override void OnParametersSet()
|
protected override void OnParametersSet()
|
||||||
{
|
{
|
||||||
|
@ -75,6 +79,11 @@
|
||||||
_editmode = bool.Parse(EditMode);
|
_editmode = bool.Parse(EditMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(IconName))
|
||||||
|
{
|
||||||
|
_iconSpan = $"<span class=\"oi oi-{IconName}\"></span> ";
|
||||||
|
}
|
||||||
|
|
||||||
_url = EditUrl(Action, _parameters);
|
_url = EditUrl(Action, _parameters);
|
||||||
_authorized = IsAuthorized();
|
_authorized = IsAuthorized();
|
||||||
}
|
}
|
||||||
|
@ -110,10 +119,10 @@
|
||||||
authorized = true;
|
authorized = true;
|
||||||
break;
|
break;
|
||||||
case SecurityAccessLevel.View:
|
case SecurityAccessLevel.View:
|
||||||
authorized = UserSecurity.IsAuthorized(PageState.User,PermissionNames.View, ModuleState.Permissions);
|
authorized = UserSecurity.IsAuthorized(PageState.User, PermissionNames.View, ModuleState.Permissions);
|
||||||
break;
|
break;
|
||||||
case SecurityAccessLevel.Edit:
|
case SecurityAccessLevel.Edit:
|
||||||
authorized = UserSecurity.IsAuthorized(PageState.User,PermissionNames.Edit, ModuleState.Permissions);
|
authorized = UserSecurity.IsAuthorized(PageState.User, PermissionNames.Edit, ModuleState.Permissions);
|
||||||
break;
|
break;
|
||||||
case SecurityAccessLevel.Admin:
|
case SecurityAccessLevel.Admin:
|
||||||
authorized = UserSecurity.IsAuthorized(PageState.User, Constants.AdminRole);
|
authorized = UserSecurity.IsAuthorized(PageState.User, Constants.AdminRole);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user