Skip to content

Commit

Permalink
Experiment: Create ui module override system, allow passing ui module…
Browse files Browse the repository at this point in the history
… as parameter.
  • Loading branch information
Josh Williams committed Feb 23, 2016
1 parent 50c3660 commit 009aeed
Show file tree
Hide file tree
Showing 84 changed files with 3,020 additions and 4 deletions.
32 changes: 30 additions & 2 deletions app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@ var AspnetGenerator = yeoman.generators.Base.extend({
defaults: false,
desc: 'Use the Grunt JavaScript task runner instead of Gulp in web projects.'
});

this.argument('type', { type: String, required: false, desc: 'the project type to create' });
this.argument('applicationName', { type: String, required: false, desc: 'the name of the application' });
this.argument('ui', {type: String, required: false, defaults: 'bootstrap', desc: 'the ui library to use (bootstrap OR semantic)'});
},


Expand Down Expand Up @@ -59,7 +60,7 @@ var AspnetGenerator = yeoman.generators.Base.extend({
name: 'Console Application',
value: 'console'
}, {
name: 'Web Application w/ Semantic UI',
name: 'Web Application',
value: 'web'
}, {
name: 'Web Application Basic [without Membership and Authorization]',
Expand Down Expand Up @@ -94,6 +95,19 @@ var AspnetGenerator = yeoman.generators.Base.extend({
this.templatedata.guid = guid.v4();
this.templatedata.grunt = this.options.grunt || false;
this.templatedata.coreclr = this.options.coreclr || false;
this.templatedata.ui = this.ui;
this.templatedata.uiversion = this._getUIVersion();
},

_getUIVersion: function(){
switch (this.ui){
case 'bootstrap':
return '3.3.5';
case 'semantic':
return '2.1.8';
default:
return '3.3.5';
}
},

askForName: function() {
Expand Down Expand Up @@ -212,9 +226,16 @@ var AspnetGenerator = yeoman.generators.Base.extend({
this.fs.copyTpl(this.templatePath('ViewModels/**/*'), this.applicationName + '/ViewModels', this.templatedata);
// Views
this.fs.copyTpl(this.templatePath('Views/**/*'), this.applicationName + '/Views', this.templatedata);

// wwwroot
// wwwroot - the content in the wwwroot does not include any direct references or imports
// So again it is copied 1-to-1 - but tests cover list of all files
this.fs.copy(this.templatePath('wwwroot/**/*'), this.applicationName + '/wwwroot');

// UI Component Overrides
// If the developer has placed anything in common/ui-module/project-type/**/* then use it
this.fs.copyTpl(this.templatePath('/../../common/' + this.ui + '/' + this.type + '/**/*'), this.applicationName + '/', this.templatedata);

break;
case 'webbasic':
this.sourceRoot(path.join(__dirname, '../templates/projects/' + this.type));
Expand All @@ -238,9 +259,16 @@ var AspnetGenerator = yeoman.generators.Base.extend({
this.fs.copyTpl(this.templatePath('Controllers/HomeController.cs'), this.applicationName + '/Controllers/HomeController.cs', this.templatedata);
// Views
this.fs.copyTpl(this.templatePath('Views/**/*'), this.applicationName + '/Views', this.templatedata);


// wwwroot - the content in the wwwroot does not include any direct references or imports
// So again it is copied 1-to-1 - but tests cover list of all files
this.fs.copy(this.templatePath('wwwroot/**/*'), this.applicationName + '/wwwroot');

// UI Component Overrides
// If the developer has placed anything in common/ui-module/project-type/**/* then use it
this.fs.copyTpl(this.templatePath('/../../common/' + this.ui + '/' + this.type + '/**/*'), this.applicationName + '/', this.templatedata);

break;
case 'nancy':
this.sourceRoot(path.join(__dirname, '../templates/projects/' + this.type));
Expand Down
10 changes: 10 additions & 0 deletions templates/common/bootstrap/web/Views/Account/ConfirmEmail.cshtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
@{
ViewData["Title"] = "Confirm Email";
}

<h2>@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>
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
@model ExternalLoginConfirmationViewModel
@{
ViewData["Title"] = "Register";
}

<h2>@ViewData["Title"].</h2>
<h3>Associate your @ViewData["LoginProvider"] account.</h3>

<form asp-controller="Account" asp-action="ExternalLoginConfirmation" asp-route-returnurl="@ViewData["ReturnUrl"]" method="post" class="form-horizontal" role="form">
<h4>Association Form</h4>
<hr />
<div asp-validation-summary="ValidationSummary.All" class="text-danger"></div>

<p class="text-info">
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="form-group">
<label asp-for="Email" class="col-md-2 control-label"></label>
<div class="col-md-10">
<input asp-for="Email" class="form-control" />
<span asp-validation-for="Email" class="text-danger"></span>
</div>
</div>
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<button type="submit" class="btn btn-default">Register</button>
</div>
</div>
</form>

@section Scripts {
@{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
@{
ViewData["Title"] = "Login Failure";
}

<hgroup>
<h2>@ViewData["Title"].</h2>
<h3 class="text-danger">Unsuccessful login with service.</h3>
</hgroup>
31 changes: 31 additions & 0 deletions templates/common/bootstrap/web/Views/Account/ForgotPassword.cshtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
@model ForgotPasswordViewModel
@{
ViewData["Title"] = "Forgot your password?";
}

<h2>@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>

@*<form asp-controller="Account" asp-action="ForgotPassword" method="post" class="form-horizontal" role="form">
<h4>Enter your email.</h4>
<hr />
<div asp-validation-summary="ValidationSummary.All" class="text-danger"></div>
<div class="form-group">
<label asp-for="Email" class="col-md-2 control-label"></label>
<div class="col-md-10">
<input asp-for="Email" class="form-control" />
<span asp-validation-for="Email" class="text-danger"></span>
</div>
</div>
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<button type="submit" class="btn btn-default">Submit</button>
</div>
</div>
</form>*@

@section Scripts {
@{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
@{
ViewData["Title"] = "Forgot Password Confirmation";
}

<h2>@ViewData["Title"].</h2>
<p>
Please check your email to reset your password.
</p>
8 changes: 8 additions & 0 deletions templates/common/bootstrap/web/Views/Account/Lockout.cshtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
@{
ViewData["Title"] = "Locked out";
}

<hgroup>
<h1 class="text-danger">Locked out.</h1>
<h2 class="text-danger">This account has been locked out, please try again later.</h2>
</hgroup>
90 changes: 90 additions & 0 deletions templates/common/bootstrap/web/Views/Account/Login.cshtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
@using System.Collections.Generic
@using Microsoft.AspNet.Http
@using Microsoft.AspNet.Http.Authentication
@model LoginViewModel
@inject SignInManager<ApplicationUser> SignInManager

@{
ViewData["Title"] = "Log in";
}

<h2>@ViewData["Title"].</h2>
<div class="row">
<div class="col-md-8">
<section>
<form asp-controller="Account" asp-action="Login" asp-route-returnurl="@ViewData["ReturnUrl"]" method="post" class="form-horizontal" role="form">
<h4>Use a local account to log in.</h4>
<hr />
<div asp-validation-summary="ValidationSummary.All" class="text-danger"></div>
<div class="form-group">
<label asp-for="Email" class="col-md-2 control-label"></label>
<div class="col-md-10">
<input asp-for="Email" class="form-control" />
<span asp-validation-for="Email" class="text-danger"></span>
</div>
</div>
<div class="form-group">
<label asp-for="Password" class="col-md-2 control-label"></label>
<div class="col-md-10">
<input asp-for="Password" class="form-control" />
<span asp-validation-for="Password" class="text-danger"></span>
</div>
</div>
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<div class="checkbox">
<input asp-for="RememberMe" />
<label asp-for="RememberMe"></label>
</div>
</div>
</div>
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<button type="submit" class="btn btn-default">Log in</button>
</div>
</div>
<p>
<a asp-action="Register">Register as a new user?</a>
</p>
<p>
<a asp-action="ForgotPassword">Forgot your password?</a>
</p>
</form>
</section>
</div>
<div class="col-md-4">
<section>
<h4>Use another service to log in.</h4>
<hr />
@{
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="btn btn-default" name="provider" value="@provider.AuthenticationScheme" title="Log in using your @provider.DisplayName account">@provider.AuthenticationScheme</button>
}
</p>
</div>
</form>
}
}
</section>
</div>
</div>

@section Scripts {
@{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); }
}
42 changes: 42 additions & 0 deletions templates/common/bootstrap/web/Views/Account/Register.cshtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
@model RegisterViewModel
@{
ViewData["Title"] = "Register";
}

<h2>@ViewData["Title"].</h2>

<form asp-controller="Account" asp-action="Register" method="post" class="form-horizontal" role="form">
<h4>Create a new account.</h4>
<hr />
<div asp-validation-summary="ValidationSummary.All" class="text-danger"></div>
<div class="form-group">
<label asp-for="Email" class="col-md-2 control-label"></label>
<div class="col-md-10">
<input asp-for="Email" class="form-control" />
<span asp-validation-for="Email" class="text-danger"></span>
</div>
</div>
<div class="form-group">
<label asp-for="Password" class="col-md-2 control-label"></label>
<div class="col-md-10">
<input asp-for="Password" class="form-control" />
<span asp-validation-for="Password" class="text-danger"></span>
</div>
</div>
<div class="form-group">
<label asp-for="ConfirmPassword" class="col-md-2 control-label"></label>
<div class="col-md-10">
<input asp-for="ConfirmPassword" class="form-control" />
<span asp-validation-for="ConfirmPassword" class="text-danger"></span>
</div>
</div>
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<button type="submit" class="btn btn-default">Register</button>
</div>
</div>
</form>

@section Scripts {
@{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); }
}
43 changes: 43 additions & 0 deletions templates/common/bootstrap/web/Views/Account/ResetPassword.cshtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
@model ResetPasswordViewModel
@{
ViewData["Title"] = "Reset password";
}

<h2>@ViewData["Title"].</h2>

<form asp-controller="Account" asp-action="ResetPassword" method="post" class="form-horizontal" role="form">
<h4>Reset your password.</h4>
<hr />
<div asp-validation-summary="ValidationSummary.All" class="text-danger"></div>
<input asp-for="Code" type="hidden" />
<div class="form-group">
<label asp-for="Email" class="col-md-2 control-label"></label>
<div class="col-md-10">
<input asp-for="Email" class="form-control" />
<span asp-validation-for="Email" class="text-danger"></span>
</div>
</div>
<div class="form-group">
<label asp-for="Password" class="col-md-2 control-label"></label>
<div class="col-md-10">
<input asp-for="Password" class="form-control" />
<span asp-validation-for="Password" class="text-danger"></span>
</div>
</div>
<div class="form-group">
<label asp-for="ConfirmPassword" class="col-md-2 control-label"></label>
<div class="col-md-10">
<input asp-for="ConfirmPassword" class="form-control" />
<span asp-validation-for="ConfirmPassword" class="text-danger"></span>
</div>
</div>
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<button type="submit" class="btn btn-default">Reset</button>
</div>
</div>
</form>

@section Scripts {
@{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
@{
ViewData["Title"] = "Reset password confirmation";
}

<h1>@ViewData["Title"].</h1>
<p>
Your password has been reset. Please <a asp-controller="Account" asp-action="Login">Click here to log in</a>.
</p>
21 changes: 21 additions & 0 deletions templates/common/bootstrap/web/Views/Account/SendCode.cshtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
@model SendCodeViewModel
@{
ViewData["Title"] = "Send Verification Code";
}

<h2>@ViewData["Title"].</h2>

<form asp-controller="Account" asp-action="SendCode" asp-route-returnurl="@Model.ReturnUrl" method="post" class="form-horizontal" role="form">
<input asp-for="RememberMe" type="hidden" />
<div class="row">
<div class="col-md-8">
Select Two-Factor Authentication Provider:
<select asp-for="SelectedProvider" asp-items="Model.Providers"></select>
<button type="submit" class="btn btn-default">Submit</button>
</div>
</div>
</form>

@section Scripts {
@{await Html.RenderPartialAsync("_ValidationScriptsPartial"); }
}
Loading

0 comments on commit 009aeed

Please sign in to comment.