-
-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from erossini/feature/widgets
New widgets
- Loading branch information
Showing
472 changed files
with
104,046 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
AdminLTEWithASPNETCore/Controllers/ServicePageController.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
using Microsoft.AspNetCore.Identity; | ||
using Microsoft.AspNetCore.Mvc; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Threading.Tasks; | ||
|
||
namespace AdminLTEWithASPNETCore.Controllers | ||
{ | ||
public class ServicePageController : Controller | ||
{ | ||
private readonly SignInManager<IdentityUser> _signInManager; | ||
|
||
public ServicePageController(SignInManager<IdentityUser> signInManager) | ||
{ | ||
_signInManager = signInManager; | ||
} | ||
|
||
public IActionResult Lockscreen() | ||
{ | ||
ViewBag.Reason = "lockscreen"; | ||
return View(); | ||
} | ||
|
||
public async Task<IActionResult> LockscreenCheck(string password) | ||
{ | ||
if (ModelState.IsValid && !string.IsNullOrEmpty(password)) | ||
{ | ||
var result = await _signInManager.PasswordSignInAsync(User.Identity?.Name, password, false, lockoutOnFailure: true); | ||
if (result.Succeeded) | ||
{ | ||
return LocalRedirectPermanent("/Home"); | ||
} | ||
if (result.RequiresTwoFactor) | ||
{ | ||
return RedirectToPage("./LoginWith2fa", new { ReturnUrl = "/Home" }); | ||
} | ||
else | ||
{ | ||
return LocalRedirectPermanent("/ServicePage/Lockscreen"); | ||
} | ||
} | ||
|
||
return LocalRedirectPermanent("/ServicePage/Lockscreen"); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.ComponentModel; | ||
using System.Linq; | ||
using System.Threading.Tasks; | ||
|
||
namespace AdminLTEWithASPNETCore.Enums.Components | ||
{ | ||
/// <summary> | ||
/// Enum PositionType | ||
/// </summary> | ||
public enum PositionType | ||
{ | ||
/// <summary> | ||
/// The bottom | ||
/// </summary> | ||
[Description("bottom")] | ||
Bottom, | ||
/// <summary> | ||
/// The left | ||
/// </summary> | ||
[Description("left")] | ||
Left, | ||
/// <summary> | ||
/// The right | ||
/// </summary> | ||
[Description("right")] | ||
Right, | ||
/// <summary> | ||
/// The top | ||
/// </summary> | ||
[Description("top")] | ||
Top | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.ComponentModel; | ||
using System.Linq; | ||
using System.Threading.Tasks; | ||
|
||
namespace AdminLTEWithASPNETCore.Enums.Components | ||
{ | ||
/// <summary> | ||
/// Enum ShadowType | ||
/// </summary> | ||
public enum ShadowType | ||
{ | ||
/// <summary> | ||
/// The none | ||
/// </summary> | ||
[Description("")] | ||
None, | ||
/// <summary> | ||
/// The small | ||
/// </summary> | ||
[Description("shadow-sm")] | ||
Small, | ||
/// <summary> | ||
/// The regular | ||
/// </summary> | ||
[Description("shadow")] | ||
Regular, | ||
/// <summary> | ||
/// The large | ||
/// </summary> | ||
[Description("shadow-lg")] | ||
Large | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.ComponentModel; | ||
using System.Linq; | ||
using System.Threading.Tasks; | ||
|
||
namespace AdminLTEWithASPNETCore.Extensions | ||
{ | ||
/// <summary> | ||
/// Class EnumExtensions. | ||
/// </summary> | ||
public static class EnumExtensions | ||
{ | ||
/// <summary> | ||
/// Gets the description. | ||
/// </summary> | ||
/// <typeparam name="T"></typeparam> | ||
/// <param name="enumerationValue">The enumeration value.</param> | ||
/// <returns>System.String.</returns> | ||
/// <exception cref="ArgumentException">enumerationValue</exception> | ||
public static string GetDescription<T>(this T enumerationValue) where T : struct | ||
{ | ||
var type = enumerationValue.GetType(); | ||
if (!type.IsEnum) | ||
{ | ||
throw new ArgumentException($"{nameof(enumerationValue)} must be of Enum type", nameof(enumerationValue)); | ||
} | ||
var memberInfo = type.GetMember(enumerationValue.ToString()); | ||
if (memberInfo.Length > 0) | ||
{ | ||
var attrs = memberInfo[0].GetCustomAttributes(typeof(DescriptionAttribute), false); | ||
|
||
if (attrs.Length > 0) | ||
{ | ||
return ((DescriptionAttribute)attrs[0]).Description; | ||
} | ||
} | ||
return enumerationValue.ToString(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
using Microsoft.AspNetCore.Razor.TagHelpers; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace AdminLTEWithASPNETCore.Helpers | ||
{ | ||
[HtmlTargetElement("script", Attributes = "on-content-loaded")] | ||
public class ScriptTagHelper : TagHelper | ||
{ | ||
/// <summary> | ||
/// Execute script only once document is loaded. | ||
/// </summary> | ||
public bool OnContentLoaded { get; set; } = false; | ||
|
||
public override void Process(TagHelperContext context, TagHelperOutput output) | ||
{ | ||
if (!OnContentLoaded) | ||
{ | ||
base.Process(context, output); | ||
} | ||
else | ||
{ | ||
var content = output.GetChildContentAsync().Result; | ||
var javascript = content.GetContent(); | ||
|
||
var sb = new StringBuilder(); | ||
sb.Append("document.addEventListener('DOMContentLoaded',"); | ||
sb.Append("function() {"); | ||
sb.Append(javascript); | ||
sb.Append("});"); | ||
|
||
output.Content.SetHtmlContent(sb.ToString()); | ||
} | ||
} | ||
} | ||
} |
49 changes: 49 additions & 0 deletions
49
AdminLTEWithASPNETCore/Models/Components/Boxes/BoxModel.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
using AdminLTEWithASPNETCore.Enums.Components; | ||
using AdminLTEWithASPNETCore.Extensions; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.ComponentModel.DataAnnotations; | ||
using System.Linq; | ||
using System.Reflection; | ||
using System.Threading.Tasks; | ||
|
||
namespace AdminLTEWithASPNETCore.Models.Components.Boxes | ||
{ | ||
/// <summary> | ||
/// Class BoxModel. | ||
/// </summary> | ||
public class BoxModel | ||
{ | ||
/// <summary> | ||
/// Gets or sets the color of the background. | ||
/// </summary> | ||
/// <value>The color of the background.</value> | ||
public string BackgroundColor { get; set; } = "bg-blue"; | ||
/// <summary> | ||
/// Gets or sets the icon. | ||
/// </summary> | ||
/// <value>The icon.</value> | ||
public string Icon { get; set; } = "fa-info"; | ||
/// <summary> | ||
/// Gets or sets the text. | ||
/// </summary> | ||
/// <value>The text.</value> | ||
public string Text { get; set; } | ||
/// <summary> | ||
/// Gets or sets the shadow. | ||
/// </summary> | ||
/// <value>The shadow.</value> | ||
public ShadowType Shadow { get; set; } = ShadowType.None; | ||
/// <summary> | ||
/// Gets or sets the sub text. | ||
/// </summary> | ||
/// <value>The sub text.</value> | ||
public string SubText { get; set; } | ||
|
||
/// <summary> | ||
/// Gets the CSS for the shadow | ||
/// </summary> | ||
/// <returns>Returns the CSS for the requested shadow</returns> | ||
public string ShadowText => Shadow.GetDescription(); | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
AdminLTEWithASPNETCore/Models/Components/Boxes/ProgressBoxModel.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Threading.Tasks; | ||
|
||
namespace AdminLTEWithASPNETCore.Models.Components.Boxes | ||
{ | ||
public class ProgressBoxModel : BoxModel | ||
{ | ||
public int Percent { get; set; } | ||
public string PercentDescription { get; set; } | ||
} | ||
} |
Oops, something went wrong.