Skip to content

Commit

Permalink
Changes
Browse files Browse the repository at this point in the history
- Add semantic.validation.min.js for consistency
- Add tests for Semantic UI overrides per #9 and #6
- Add <% namespace %> to _Layout.cshtml (missing)
- Remove title from MenuLinkTagHelper rendering per #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 d8aeb70 commit 66b2dad
Show file tree
Hide file tree
Showing 84 changed files with 997 additions and 1,472 deletions.
42 changes: 24 additions & 18 deletions app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ var AspnetGenerator = yeoman.generators.Base.extend({


init: function() {
this.log(yosay('Welcome to the marvellous ASP.NET 5 + Semantic UI generator!'));
this.log(yosay('Welcome to the marvellous ASP.NET 5 generator!'));
this.templatedata = {};
},

Expand Down Expand Up @@ -79,11 +79,32 @@ var AspnetGenerator = yeoman.generators.Base.extend({
value: 'unittest'
}
]
}];
},
{
type: 'list',
name: 'ui',
message: 'Which UI framework would you like to use?',
default: 'bootstrap',
choices: [
{
name: 'Bootstrap (3.3.5)',
value: 'bootstrap'
},
{
name: 'Semantic UI (2.1.8)',
value: 'semantic'
}
],
when: function (answers){
return answers.type === 'web' || answers.type === 'webbasic';
}

}
];

this.prompt(prompts, function (props) {
this.type = props.type;

this.ui = props.ui;
done();
}.bind(this));
}
Expand All @@ -96,18 +117,6 @@ var AspnetGenerator = yeoman.generators.Base.extend({
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 @@ -220,8 +229,6 @@ var AspnetGenerator = yeoman.generators.Base.extend({
this.fs.copyTpl(this.templatePath('Services/IEmailSender.cs'), this.applicationName + '/Services/IEmailSender.cs', this.templatedata);
this.fs.copyTpl(this.templatePath('Services/ISmsSender.cs'), this.applicationName + '/Services/ISmsSender.cs', this.templatedata);
this.fs.copyTpl(this.templatePath('Services/MessageServices.cs'), this.applicationName + '/Services/MessageServices.cs', this.templatedata);
// Tag Helpers
this.fs.copyTpl(this.templatePath('TagHelpers/MenuLinkTagHelper.cs'), this.applicationName + '/TagHelpers/MenuLinkTagHelper.cs', this.templatedata);
// ViewModels
this.fs.copyTpl(this.templatePath('ViewModels/**/*'), this.applicationName + '/ViewModels', this.templatedata);
// Views
Expand Down Expand Up @@ -260,7 +267,6 @@ var AspnetGenerator = yeoman.generators.Base.extend({
// 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');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ public override void Process(TagHelperContext context, TagHelperOutput output)
var a = new TagBuilder("a");

a.MergeAttribute("href", $"{menuUrl}");
a.MergeAttribute("title", MenuText);
a.MergeAttribute("class", "item");

a.InnerHtml.Append(MenuText);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,6 @@
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="ui large form validate-me" role="form">
<div class="ui stacked segment">
<div class="field">
<div class="ui left icon input">
<i class="user icon"></i>
<input asp-for="Email" placeholder="Enter your email address"/>
</div>
</div>
<input type="submit" class="ui large blue submit button" value="Submit"/>
<div asp-validation-summary="ValidationSummary.All" class="ui error message"></div>
</div>
</form>*@

@section Scripts {
@{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); }
}
139 changes: 0 additions & 139 deletions templates/overrides/semantic/web/Views/Account/Login.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -77,145 +77,6 @@
</div>
</div>


<div class="ui raised very padded text container">


</div>


@*
<div class="ui text container" style="margin-top:10px">
<h2 class="ui header">@ViewData["Title"]</h2>
<form asp-controller="Account" asp-action="Login" asp-route-returnurl="@ViewData["ReturnUrl"]" method="post" class="ui large form" role="form">
<h4 class="ui header">Local Account Log In</h4>
<div asp-validation-summary="ValidationSummary.All" class="text-danger"></div>
<div class="ui stacked segment">
<div class="field">
<div class="ui left icon input">
<i class="user icon"></i>
<input asp-for="Email" placeholder="Email address"/>
</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 toggle 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"/>
</div>
</form>
</div>
<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"); }

<script>
$(function () {
$('.ui.checkbox').checkbox();
/*$('#loginForm')
.form({
fields: {
"LoginModel.Email": {
identifier: "LoginModel.Email",
rules: [
{type: 'empty', prompt: 'Email field is required'},
{type: 'email', prompt: 'Please enter a valid email'}
]
},
"LoginModel.Password": {
identifier: 'LoginModel.Password',
rules: [
{type: 'empty', prompt: 'Password field is required'}
]
}
}
});*/
})
</script>
}
111 changes: 0 additions & 111 deletions templates/overrides/semantic/web/Views/Home/Index.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -74,114 +74,3 @@
</div>




@*
<div class="ui horizontal segments">
<div class="ui segment">
<h1 class="ui header">Overview</h1>
<ol class="ui list">
<li><a href="http://go.microsoft.com/fwlink/?LinkId=518008">Conceptual overview of what is ASP.NET 5</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkId=699320">Fundamentals of ASP.NET 5 such as Startup and middleware.</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkId=398602">Working with Data</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkId=398603">Security</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkID=699321">Client side development</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkID=699322">Develop on different platforms</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkID=699323">Read more on the documentation site</a></li>
</ol>
</div>
<div class="ui segment">
<h1 class="ui header">Run & Deploy</h1>
<ol class="ui list">
<li><a href="http://go.microsoft.com/fwlink/?LinkID=517851">Run your app</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkID=517852">Run your app on .NET Core</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkID=517853">Run commands in your project.json</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkID=398609">Publish to Microsoft Azure Web Apps</a></li>
</ol>
</div>
</div>
<div class="ui vertical stripe segment how-to">
<div class="ui equal width stackable internally celled grid">
<div class="row">
<div class="right aligned middle aligned column">
<h1 class="ui header">How To</h1>
$1$<ol class="left aligned ui list">
<li>Sample pages using ASP.NET MVC 6</li>
<li><a href="http://go.microsoft.com/fwlink/?LinkId=518007">Gulp</a> and <a href="http://go.microsoft.com/fwlink/?LinkId=518004">Bower</a> for managing client-side libraries</li>
<li>Theming using <a href="http://go.microsoft.com/fwlink/?LinkID=398939">Bootstrap</a></li>
</ol>#1#
</div>
<div class="column">
<ol class="ui list">
<li><a href="http://go.microsoft.com/fwlink/?LinkID=398600">Add a Controller and View</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkID=699314">Add an appsetting in config and access it in app.</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkId=699315">Manage User Secrets using Secret Manager.</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkId=699316">Use logging to log a message.</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkId=699317">Add packages using NuGet.</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkId=699318">Add client packages using Bower.</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkId=699319">Target development, staging or production environment.</a></li>
</ol>
</div>
</div>
</div>
</div>
<div class="ui vertical stripe segment">
<div class="ui equal width stackable internally celled grid">
<div class="row">
<div class="right aligned middle aligned column">
<h1 class="ui header">Application Uses</h1>
</div>
<div class="column">
<ol class="left aligned ui list">
<li>Sample pages using ASP.NET MVC 6</li>
<li><a href="http://go.microsoft.com/fwlink/?LinkId=518007">Gulp</a> and <a href="http://go.microsoft.com/fwlink/?LinkId=518004">Bower</a> for managing client-side libraries</li>
<li>Theming using <a href="http://go.microsoft.com/fwlink/?LinkID=398939">Bootstrap</a></li>
</ol>
</div>
</div>
</div>
</div>
<div class="ui vertical stripe segment">
<div class="ui equal width stackable internally celled grid">
<div class="row">
<div class="right aligned middle aligned column">
<h1 class="ui header">Overview</h1>
</div>
<div class="column">
<ol class="ui list">
<li><a href="http://go.microsoft.com/fwlink/?LinkId=518008">Conceptual overview of what is ASP.NET 5</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkId=699320">Fundamentals of ASP.NET 5 such as Startup and middleware.</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkId=398602">Working with Data</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkId=398603">Security</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkID=699321">Client side development</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkID=699322">Develop on different platforms</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkID=699323">Read more on the documentation site</a></li>
</ol>
</div>
</div>
</div>
</div>
<div class="ui vertical stripe segment">
<div class="ui equal width stackable internally celled grid">
<div class="row">
<div class="right aligned middle aligned column">
<h1 class="ui header">Run & Deploy</h1>
</div>
<div class="column">
<ol class="ui list">
<li><a href="http://go.microsoft.com/fwlink/?LinkID=517851">Run your app</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkID=517852">Run your app on .NET Core</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkID=517853">Run commands in your project.json</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkID=398609">Publish to Microsoft Azure Web Apps</a></li>
</ol>
</div>
</div>
</div>
</div>*@
10 changes: 10 additions & 0 deletions templates/overrides/semantic/web/bower.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"name": "<%= namespace %>",
"private": true,
"dependencies": {
"jquery": "2.1.4",
"jquery-validation": "1.14.0",
"jquery-validation-unobtrusive": "3.2.4",
"semantic": "2.1.8"
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ public override void Process(TagHelperContext context, TagHelperOutput output)
var a = new TagBuilder("a");

a.MergeAttribute("href", $"{menuUrl}");
a.MergeAttribute("title", MenuText);
a.MergeAttribute("class", "item");

a.InnerHtml.Append(MenuText);
Expand Down
Loading

0 comments on commit 66b2dad

Please sign in to comment.