forked from OmniSharp/generator-aspnet
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Add semantic.validation.min.js for consistency - Add tests for Semantic UI overrides per jjwilliams42/generator-aspnet-semanticui#9 and jjwilliams42/generator-aspnet-semanticui#6 - Add <% namespace %> to _Layout.cshtml (missing) - Remove title from MenuLinkTagHelper rendering per jjwilliams42/generator-aspnet-semanticui#5 - Remove commented out code and extra call to $('.class').checkbox() in Login.cshtml - Remove commented out code in various cshtml files - Merged in functionality to use Semantic OR Bootstrap libraries using yo menu selection or command line argument
- Loading branch information
Josh Williams
committed
Mar 5, 2016
1 parent
e2fde21
commit 5bb4742
Showing
53 changed files
with
1,963 additions
and
14 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
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
63 changes: 63 additions & 0 deletions
63
templates/overrides/semantic/web/TagHelpers/MenuLinkTagHelper.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,63 @@ | ||
using Microsoft.AspNet.Mvc; | ||
using Microsoft.AspNet.Mvc.Rendering; | ||
using Microsoft.AspNet.Razor.Runtime.TagHelpers; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using Microsoft.AspNet.Html.Abstractions; | ||
using Microsoft.AspNet.Mvc.TagHelpers; | ||
using Microsoft.AspNet.Mvc.ViewFeatures; | ||
using Microsoft.AspNet.Razor.TagHelpers; | ||
using Microsoft.Extensions.WebEncoders; | ||
|
||
namespace <%= namespace %>.TagHelpers | ||
{ | ||
[HtmlTargetElement("menulink", Attributes = "controller-name, action-name, menu-text")] | ||
public class MenuLinkTagHelper : TagHelper | ||
{ | ||
public string ControllerName { get; set; } | ||
public string ActionName { get; set; } | ||
public string MenuText { get; set; } | ||
|
||
[ViewContext] | ||
public ViewContext ViewContext { get; set; } | ||
|
||
public IUrlHelper _UrlHelper { get; set; } | ||
|
||
public MenuLinkTagHelper(IUrlHelper urlHelper) | ||
{ | ||
_UrlHelper = urlHelper; | ||
} | ||
|
||
public override void Process(TagHelperContext context, TagHelperOutput output) | ||
{ | ||
string menuUrl = _UrlHelper.Action(ActionName, ControllerName); | ||
|
||
output.TagName = ""; | ||
|
||
var a = new TagBuilder("a"); | ||
|
||
a.MergeAttribute("href", $"{menuUrl}"); | ||
a.MergeAttribute("class", "item"); | ||
|
||
a.InnerHtml.Append(MenuText); | ||
|
||
var routeData = ViewContext.RouteData.Values; | ||
var currentController = routeData["controller"]; | ||
var currentAction = routeData["action"]; | ||
|
||
if (String.Equals(ActionName, currentAction as string, StringComparison.OrdinalIgnoreCase) | ||
&& String.Equals(ControllerName, currentController as string, StringComparison.OrdinalIgnoreCase)) | ||
{ | ||
a.AddCssClass("active"); | ||
a.AddCssClass("blue"); | ||
} | ||
|
||
output.Content.SetContent(a); | ||
|
||
} | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
templates/overrides/semantic/web/Views/Account/ConfirmEmail.cshtml
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,10 @@ | ||
@{ | ||
ViewData["Title"] = "Confirm Email"; | ||
} | ||
|
||
<h2 class="ui header">@ViewData["Title"]</h2> | ||
<div> | ||
<p> | ||
Thank you for confirming your email. Please <a asp-controller="Account" asp-action="Login">Click here to Log in</a>. | ||
</p> | ||
</div> |
34 changes: 34 additions & 0 deletions
34
templates/overrides/semantic/web/Views/Account/ExternalLoginConfirmation.cshtml
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,34 @@ | ||
@model ExternalLoginConfirmationViewModel | ||
@{ | ||
ViewData["Title"] = "Register"; | ||
} | ||
|
||
<h2 class="ui header">@ViewData["Title"]</h2> | ||
<h3 class="ui sub header">Associate your @ViewData["LoginProvider"] account</h3> | ||
|
||
<form asp-controller="Account" asp-action="ExternalLoginConfirmation" asp-route-returnurl="@ViewData["ReturnUrl"]" method="post" class="ui small form validate-me" role="form"> | ||
|
||
|
||
<p class="content"> | ||
You've successfully authenticated with <strong>@ViewData["LoginProvider"]</strong>. | ||
Please enter a user name for this site below and click the Register button to finish | ||
logging in. | ||
</p> | ||
<div class="six wide field"> | ||
<div class="ui left icon input"> | ||
<i class="user icon"></i> | ||
<input asp-for="Email" placeholder="Email address"/> | ||
<div asp-validation-for="LoginModel.Email"></div> | ||
</div> | ||
</div> | ||
<br/> | ||
<input type="submit" class="ui large blue submit button" value="Register" /> | ||
<br /> | ||
|
||
<div asp-validation-summary="ValidationSummary.All" class="ui error message"></div> | ||
|
||
</form> | ||
|
||
@section Scripts { | ||
@{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); } | ||
} |
6 changes: 6 additions & 0 deletions
6
templates/overrides/semantic/web/Views/Account/ExternalLoginFailure.cshtml
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,6 @@ | ||
@{ | ||
ViewData["Title"] = "Login Failure"; | ||
} | ||
|
||
<h2 class="ui header">@ViewData["Title"]</h2> | ||
<h3 class="ui sub header">Unsuccessful login with service.</h3> |
13 changes: 13 additions & 0 deletions
13
templates/overrides/semantic/web/Views/Account/ForgotPassword.cshtml
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 @@ | ||
@model ForgotPasswordViewModel | ||
@{ | ||
ViewData["Title"] = "Forgot your password?"; | ||
} | ||
|
||
<h2 class="ui header">@ViewData["Title"]</h2> | ||
<p> | ||
For more information on how to enable reset password please see this <a href="http://go.microsoft.com/fwlink/?LinkID=532713">article</a>. | ||
</p> | ||
|
||
@section Scripts { | ||
@{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); } | ||
} |
8 changes: 8 additions & 0 deletions
8
templates/overrides/semantic/web/Views/Account/ForgotPasswordConfirmation.cshtml
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,8 @@ | ||
@{ | ||
ViewData["Title"] = "Forgot Password Confirmation"; | ||
} | ||
|
||
<h2 class="ui header">@ViewData["Title"]</h2> | ||
<p> | ||
Please check your email to reset your password. | ||
</p> |
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,5 @@ | ||
@{ | ||
ViewBag.Title = "Info"; | ||
} | ||
<h2>@ViewBag.Title.</h2> | ||
<h3>@ViewBag.Message</h3> |
6 changes: 6 additions & 0 deletions
6
templates/overrides/semantic/web/Views/Account/Lockout.cshtml
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,6 @@ | ||
@{ | ||
ViewData["Title"] = "Locked out"; | ||
} | ||
|
||
<h1 class="ui header red">Locked out</h1> | ||
<h2 class="ui sub header red">This account has been locked out, please try again later.</h2> |
82 changes: 82 additions & 0 deletions
82
templates/overrides/semantic/web/Views/Account/Login.cshtml
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,82 @@ | ||
@using System.Collections.Generic | ||
@using Microsoft.AspNet.Http | ||
@using Microsoft.AspNet.Http.Authentication | ||
@model LoginViewModel | ||
@inject SignInManager<ApplicationUser> SignInManager | ||
|
||
@{ | ||
ViewData["Title"] = "Log in"; | ||
} | ||
|
||
<div class="ui two column middle aligned very relaxed stackable grid" style="position:relative"> | ||
<div class="column"> | ||
<div class="ui form"> | ||
<h3 class="ui header centered">Local Account Log In</h3> | ||
|
||
<form asp-controller="Account" asp-action="Login" asp-route-returnurl="@ViewData["ReturnUrl"]" method="post" class="ui large form validate-me" role="form" id="loginForm"> | ||
<div class="field"> | ||
<div class="ui left icon input"> | ||
<i class="user icon"></i> | ||
<input asp-for="Email" placeholder="Email address"/> | ||
<div asp-validation-for="LoginModel.Email"></div> | ||
</div> | ||
</div> | ||
<div class="field"> | ||
<div class="ui left icon input"> | ||
<i class="lock icon"></i> | ||
<input asp-for="Password" placeholder="Password"/> | ||
</div> | ||
</div> | ||
<div class="field"> | ||
<div class="ui checkbox"> | ||
<input asp-for="RememberMe" type="checkbox" tabindex="0" class="hidden"/> | ||
<label>Remember Me</label> | ||
</div> | ||
</div> | ||
<input type="submit" class="ui large blue submit button" value="Login"/> | ||
<br/> | ||
<br/> | ||
Forgot your password? Click <a asp-action="ForgotPassword" asp-controller="Account">here</a>. | ||
<div asp-validation-summary="ValidationSummary.All" class="ui error message"></div> | ||
|
||
</form> | ||
</div> | ||
|
||
</div> | ||
<div class="ui vertical divider"> | ||
OR | ||
</div> | ||
<div class="center aligned column"> | ||
<h3 class="ui header centered">Use Another Service to Log In</h3> | ||
@{ | ||
var loginProviders = SignInManager.GetExternalAuthenticationSchemes().ToList(); | ||
if (loginProviders.Count == 0) | ||
{ | ||
<div> | ||
<p> | ||
There are no external authentication services configured. See <a href="http://go.microsoft.com/fwlink/?LinkID=532715">this article</a> | ||
for details on setting up this ASP.NET application to support logging in via external services. | ||
</p> | ||
</div> | ||
} | ||
else | ||
{ | ||
<form asp-controller="Account" asp-action="ExternalLogin" asp-route-returnurl="@ViewData["ReturnUrl"]" method="post" class="form-horizontal" role="form"> | ||
<div> | ||
<p> | ||
@foreach (var provider in loginProviders) | ||
{ | ||
|
||
<button type="submit" class="ui @provider.AuthenticationScheme.ToLower() button" name="provider" value="@provider.AuthenticationScheme" title="Log in using your @provider.DisplayName account"><i class="@provider.AuthenticationScheme.ToLower() icon"></i> @provider.AuthenticationScheme</button> | ||
} | ||
</p> | ||
</div> | ||
</form> | ||
} | ||
} | ||
</div> | ||
</div> | ||
|
||
@section Scripts { | ||
@{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); } | ||
} |
Oops, something went wrong.