Normalise trailing whitespace and line endings everywhere

This commit is contained in:
SteveSandersonMS
2016-03-01 01:10:43 +00:00
parent c425137423
commit 74cac774f8
174 changed files with 782 additions and 783 deletions

View File

@@ -27,4 +27,4 @@ namespace MusicStore.Apis
return Json(artists);
}
}
}
}

View File

@@ -67,4 +67,4 @@ namespace MusicStore.Apis
return Json(albums);
}
}
}
}

View File

@@ -60,4 +60,4 @@ namespace MusicStore.Models
[Compare("Password", ErrorMessage = "The password and confirmation password do not match.")]
public string ConfirmPassword { get; set; }
}
}
}

View File

@@ -7,7 +7,7 @@ namespace MusicStore.Models
{
public Album()
{
// TODO: Temporary hack to populate the orderdetails until EF does this automatically.
// TODO: Temporary hack to populate the orderdetails until EF does this automatically.
OrderDetails = new List<OrderDetail>();
}
@@ -37,4 +37,4 @@ namespace MusicStore.Models
public virtual ICollection<OrderDetail> OrderDetails { get; set; }
}
}
}

View File

@@ -9,4 +9,4 @@ namespace MusicStore.Models
[Required]
public string Name { get; set; }
}
}
}

View File

@@ -18,4 +18,4 @@ namespace MusicStore.Models
public virtual Album Album { get; set; }
}
}
}

View File

@@ -21,4 +21,4 @@ namespace MusicStore.Models
[JsonIgnore]
public virtual ICollection<Album> Albums { get; set; }
}
}
}

View File

@@ -31,4 +31,4 @@ namespace MusicStore.Models
base.OnModelCreating(builder);
}
}
}
}

View File

@@ -70,4 +70,4 @@ namespace MusicStore.Models
public ICollection<OrderDetail> OrderDetails { get; set; }
}
}
}

View File

@@ -11,4 +11,4 @@
public virtual Album Album { get; set; }
public virtual Order Order { get; set; }
}
}
}

View File

@@ -42,13 +42,13 @@ namespace MusicStore.Models
{
// Query in a separate context so that we can attach existing entities as modified
List<TEntity> existingData;
using (var scope = serviceProvider.GetRequiredService<IServiceScopeFactory>().CreateScope())
using (var db = scope.ServiceProvider.GetService<MusicStoreContext>())
{
existingData = db.Set<TEntity>().ToList();
}
using (var scope = serviceProvider.GetRequiredService<IServiceScopeFactory>().CreateScope())
using (var db = scope.ServiceProvider.GetService<MusicStoreContext>())
{
@@ -65,8 +65,8 @@ namespace MusicStore.Models
private static Album[] GetAlbums(string imgUrl, Dictionary<string, Genre> genres, Dictionary<string, Artist> artists)
{
var albums = new Album[]
{
var albums = new Album[]
{
new Album { Title = "The Best Of The Men At Work", Genre = genres["Pop"], Price = 8.99M, Artist = artists["Men At Work"], AlbumArtUrl = imgUrl },
new Album { Title = "...And Justice For All", Genre = genres["Metal"], Price = 8.99M, Artist = artists["Metallica"], AlbumArtUrl = imgUrl },
new Album { Title = "עד גבול האור", Genre = genres["World"], Price = 8.99M, Artist = artists["אריק אינשטיין"], AlbumArtUrl = imgUrl },
@@ -912,4 +912,4 @@ namespace MusicStore.Models
}
}
}
}
}

View File

@@ -8,9 +8,9 @@ namespace MusicStore.Models
public static class SentimentAnalysis
{
private static string[] positiveSentimentWords = new[] { "happy", "fun", "joy", "love", "delight", "bunny", "bunnies", "asp.net" };
private static string[] negativeSentimentWords = new[] { "sad", "pain", "despair", "hate", "scorn", "death", "package management" };
public static SentimentResult GetSentiment(string text) {
var numPositiveWords = CountWordOccurrences(text, positiveSentimentWords);
var numNegativeWords = CountWordOccurrences(text, negativeSentimentWords);
@@ -35,4 +35,4 @@ namespace MusicStore.Models
Positive,
}
}
}
}

View File

@@ -123,7 +123,7 @@ namespace MusicStore.Models
public decimal GetTotal()
{
// Multiply album price by count of that album to get
// Multiply album price by count of that album to get
// the current price for each of those albums in the cart
// sum all album price totals to get the cart total
@@ -190,7 +190,7 @@ namespace MusicStore.Models
if (string.IsNullOrWhiteSpace(sessionCookie))
{
//A GUID to hold the cartId.
//A GUID to hold the cartId.
cartId = Guid.NewGuid().ToString();
// Send cart Id as a cookie to the client.
@@ -204,4 +204,4 @@ namespace MusicStore.Models
return cartId;
}
}
}
}

View File

@@ -16,4 +16,4 @@ namespace MusicStore.Infrastructure
base.OnResultExecuting(context);
}
}
}
}

View File

@@ -147,4 +147,4 @@ namespace MusicStore.Infrastructure
public int PageSize { get; set; }
}
}
}
}

View File

@@ -16,4 +16,4 @@
<DevelopmentServerPort>5068</DevelopmentServerPort>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.targets" Condition="'$(VSToolsPath)' != ''" />
</Project>
</Project>

View File

@@ -44,7 +44,7 @@ namespace MusicStore
// Uncomment the following line to add Web API services which makes it easier to port Web API 2 controllers.
// You will also need to add the Microsoft.AspNet.Mvc.WebApiCompatShim package to the 'dependencies' section of project.json.
// services.AddWebApiConventions();
// Add EF services to the service container
services.AddEntityFramework()
.AddSqlite()
@@ -82,7 +82,7 @@ namespace MusicStore
{
// Initialize the sample data
SampleData.InitializeMusicStoreDatabaseAsync(app.ApplicationServices).Wait();
loggerFactory.MinimumLevel = LogLevel.Warning;
loggerFactory.AddConsole();
loggerFactory.AddDebug();
@@ -103,7 +103,7 @@ namespace MusicStore
// send the request to the following path or controller action.
app.UseExceptionHandler("/Home/Error");
}
// Add static files to the request pipeline.
app.UseStaticFiles();
@@ -112,7 +112,7 @@ namespace MusicStore
{
// Matches requests that correspond to an existent controller/action pair
routes.MapRoute("default", "{controller}/{action}/{id:int?}");
// Matches any other request that doesn't appear to have a filename extension (defined as 'having a dot in the last URI segment').
// This means you'll correctly get 404s for /some/dir/non-existent-image.png instead of returning the SPA HTML.
// However, it means requests like /customers/isaac.newton will *not* be mapped into the SPA, so if you need to accept

View File

@@ -1,26 +1,26 @@
@{
ViewData["Title"] = "Home Page";
}
<cache vary-by="@Context.Request.Path">
<app asp-ng2-prerender-module="wwwroot/ng-app/components/app/app">
Loading...
</app>
</cache>
@section scripts {
@await Html.PrimeCache(Url.Action("GenreMenuList", "GenresApi"))
@await Html.PrimeCache(Url.Action("MostPopular", "AlbumsApi"))
<script src="~/lib/angular2/bundles/angular2-polyfills.js"></script>
<script src="~/lib/traceur/bin/traceur-runtime.js"></script>
<script src="~/lib/es6-module-loader/dist/es6-module-loader-sans-promises.js"></script>
<script src="~/lib/systemjs/dist/system.src.js"></script>
<script src="~/system.config.js"></script>
<script src="~/lib/rxjs/bundles/Rx.js"></script>
<script src="~/lib/angular2/bundles/angular2.dev.js"></script>
<script src="~/lib/angular2/bundles/router.dev.js"></script>
<script src="~/lib/angular2/bundles/http.dev.js"></script>
<script src="~/lib/angular2-aspnet/bundles/angular2-aspnet.js"></script>
<script>System.import('./ng-app/components/app/bootstrap');</script>
}
@{
ViewData["Title"] = "Home Page";
}
<cache vary-by="@Context.Request.Path">
<app asp-ng2-prerender-module="wwwroot/ng-app/components/app/app">
Loading...
</app>
</cache>
@section scripts {
@await Html.PrimeCache(Url.Action("GenreMenuList", "GenresApi"))
@await Html.PrimeCache(Url.Action("MostPopular", "AlbumsApi"))
<script src="~/lib/angular2/bundles/angular2-polyfills.js"></script>
<script src="~/lib/traceur/bin/traceur-runtime.js"></script>
<script src="~/lib/es6-module-loader/dist/es6-module-loader-sans-promises.js"></script>
<script src="~/lib/systemjs/dist/system.src.js"></script>
<script src="~/system.config.js"></script>
<script src="~/lib/rxjs/bundles/Rx.js"></script>
<script src="~/lib/angular2/bundles/angular2.dev.js"></script>
<script src="~/lib/angular2/bundles/router.dev.js"></script>
<script src="~/lib/angular2/bundles/http.dev.js"></script>
<script src="~/lib/angular2-aspnet/bundles/angular2-aspnet.js"></script>
<script>System.import('./ng-app/components/app/bootstrap');</script>
}

View File

@@ -1,6 +1,6 @@
@{
ViewData["Title"] = "Error";
}
<h1 class="text-danger">Error.</h1>
<h2 class="text-danger">An error occurred while processing your request.</h2>
@{
ViewData["Title"] = "Error";
}
<h1 class="text-danger">Error.</h1>
<h2 class="text-danger">An error occurred while processing your request.</h2>

View File

@@ -1,40 +1,40 @@
<!doctype html>
<html lang="">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Music Store</title>
<base href="/" />
<environment names="Development">
<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.css" />
<link rel="stylesheet" href="~/css/site.css" />
</environment>
<environment names="Staging,Production">
<link rel="stylesheet" href="https://ajax.aspnetcdn.com/ajax/bootstrap/3.0.0/css/bootstrap.min.css"
asp-fallback-href="~/lib/bootstrap/dist/css/bootstrap.min.css"
asp-fallback-test-class="hidden" asp-fallback-test-property="visibility" asp-fallback-test-value="hidden" />
<link rel="stylesheet" href="~/css/site.css" asp-append-version="true" />
</environment>
</head>
<body>
@RenderBody()
<environment names="Development">
<script src="~/lib/jquery/dist/jquery.js"></script>
<script src="~/lib/bootstrap/dist/js/bootstrap.js"></script>
</environment>
<environment names="Staging,Production">
<script src="https://ajax.aspnetcdn.com/ajax/jquery/jquery-2.1.4.min.js"
asp-fallback-src="~/lib/jquery/dist/jquery.min.js"
asp-fallback-test="window.jQuery">
</script>
<script src="https://ajax.aspnetcdn.com/ajax/bootstrap/3.0.0/bootstrap.min.js"
asp-fallback-src="~/lib/bootstrap/dist/js/bootstrap.min.js"
asp-fallback-test="window.jQuery && window.jQuery.fn && window.jQuery.fn.modal">
</script>
</environment>
@RenderSection("scripts", required: false)
</body>
</html>
<!doctype html>
<html lang="">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Music Store</title>
<base href="/" />
<environment names="Development">
<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.css" />
<link rel="stylesheet" href="~/css/site.css" />
</environment>
<environment names="Staging,Production">
<link rel="stylesheet" href="https://ajax.aspnetcdn.com/ajax/bootstrap/3.0.0/css/bootstrap.min.css"
asp-fallback-href="~/lib/bootstrap/dist/css/bootstrap.min.css"
asp-fallback-test-class="hidden" asp-fallback-test-property="visibility" asp-fallback-test-value="hidden" />
<link rel="stylesheet" href="~/css/site.css" asp-append-version="true" />
</environment>
</head>
<body>
@RenderBody()
<environment names="Development">
<script src="~/lib/jquery/dist/jquery.js"></script>
<script src="~/lib/bootstrap/dist/js/bootstrap.js"></script>
</environment>
<environment names="Staging,Production">
<script src="https://ajax.aspnetcdn.com/ajax/jquery/jquery-2.1.4.min.js"
asp-fallback-src="~/lib/jquery/dist/jquery.min.js"
asp-fallback-test="window.jQuery">
</script>
<script src="https://ajax.aspnetcdn.com/ajax/bootstrap/3.0.0/bootstrap.min.js"
asp-fallback-src="~/lib/bootstrap/dist/js/bootstrap.min.js"
asp-fallback-test="window.jQuery && window.jQuery.fn && window.jQuery.fn.modal">
</script>
</environment>
@RenderSection("scripts", required: false)
</body>
</html>

View File

@@ -1,4 +1,4 @@
@using MusicStore
@using Microsoft.AspNet.AngularServices
@addTagHelper "*, Microsoft.AspNet.Mvc.TagHelpers"
@addTagHelper "*, Microsoft.AspNet.AngularServices"
@using MusicStore
@using Microsoft.AspNet.AngularServices
@addTagHelper "*, Microsoft.AspNet.Mvc.TagHelpers"
@addTagHelper "*, Microsoft.AspNet.AngularServices"

View File

@@ -1,3 +1,3 @@
@{
Layout = "_Layout";
}
@{
Layout = "_Layout";
}

View File

@@ -44,4 +44,4 @@
"gulp"
]
}
}
}

View File

@@ -17,5 +17,5 @@ import { AlbumEdit } from '../album-edit/album-edit';
directives: [router.ROUTER_DIRECTIVES]
})
export class AdminHome {
}

View File

@@ -9,13 +9,13 @@ import * as models from '../../../models/models';
})
export class AlbumDeletePrompt {
public album: models.Album;
constructor(@ng.Inject(ng.ElementRef) private _elementRef: ng.ElementRef) {
}
public show(album: models.Album) {
this.album = album;
// Consider rewriting this using Angular 2's "Renderer" API so as to avoid direct DOM access
(<any>window).jQuery(".modal", this._elementRef.nativeElement).modal();
}

View File

@@ -47,4 +47,4 @@
</div>
</form>
<album-delete-prompt #deleteprompt></album-delete-prompt>
<album-delete-prompt #deleteprompt></album-delete-prompt>

View File

@@ -13,7 +13,7 @@ import { AlbumDeletePrompt } from '../album-delete-prompt/album-delete-prompt';
})
export class AlbumDetails {
public albumData: models.Album;
constructor(http: Http, routeParam: router.RouteParams) {
http.get('/api/albums/' + routeParam.params['albumId']).subscribe(result => {
this.albumData = result.json();

View File

@@ -8,18 +8,18 @@
<option *ngFor="#artist of artists" [value]="artist.ArtistId">{{ artist.Name }}</option>
</select>
</form-field>
<form-field label="Genre" [validate]="form.controls.GenreId">
<select class="form-control" ngControl="GenreId">
<option value="0">-- choose Genre --</option>
<option *ngFor="#genre of genres" [value]="genre.GenreId">{{ genre.Name }}</option>
</select>
</form-field>
<form-field label="Title" [validate]="form.controls.Title">
<input class="form-control" type="text" ngControl="Title">
</form-field>
<form-field label="Price" [validate]="form.controls.Price">
<div class="input-group">
<span class="input-group-addon">$</span>
@@ -30,7 +30,7 @@
<form-field label="Album Art URL" [validate]="form.controls.AlbumArtUrl">
<input class="form-control" ngControl="AlbumArtUrl">
</form-field>
<form-field label="Album Art">
<img src="{{ form.controls.AlbumArtUrl.value }}">
</form-field>
@@ -44,4 +44,4 @@
</form-field>
</form>
<album-delete-prompt #deleteprompt></album-delete-prompt>
<album-delete-prompt #deleteprompt></album-delete-prompt>

View File

@@ -55,7 +55,7 @@ export class AlbumEdit {
Price: fb.control('', Validators.compose([Validators.required, AlbumEdit._validatePrice])),
AlbumArtUrl: fb.control('', Validators.required)
});
this.form.valueChanges.subscribe(() => {
this.changesSaved = false;
});
@@ -70,7 +70,7 @@ export class AlbumEdit {
if (this.form.valid) {
var controls = this.form.controls;
var albumId = this.originalAlbum.AlbumId;
this._putJson(`/api/albums/${ albumId }/update`, this.form.value).subscribe(successResponse => {
this.changesSaved = true;
}, errorResponse => {
@@ -82,7 +82,7 @@ export class AlbumEdit {
private static _validatePrice(control: Control): { [key: string]: boolean } {
return /^\d+\.\d+$/.test(control.value) ? null : { Price: true };
}
// Need feedback on whether this really is the easiest way to PUT some JSON
private _putJson(url: string, body: any): Observable<Response> {
return this._http.put(url, JSON.stringify(body), {
@@ -93,4 +93,4 @@ export class AlbumEdit {
private ngDoCheck() {
this.formErrors = this.form.dirty ? Object.keys(this.form.errors || {}) : [];
}
}
}

View File

@@ -32,7 +32,7 @@
<div class="btn-group">
<button class="btn btn-default" [disabled]="!canGoBack" (click)="goToPage(1)">First</button>
<button class="btn btn-default" [disabled]="!canGoBack" (click)="goToPage(pageIndex - 1)">Previous</button>
<button class="btn" *ngFor="#page of pageLinks"
<button class="btn" *ngFor="#page of pageLinks"
[ngClass]="{ 'btn-info': page.isCurrent, 'btn-default': !page.isCurrent }"
(click)="goToPage(page.index)">
{{ page.text }}

View File

@@ -20,7 +20,7 @@ export class AlbumsList {
public get pageIndex() {
return this._pageIndex;
}
private _http: Http;
private _pageIndex = 1;
private _sortBy = "Title";
@@ -30,28 +30,28 @@ export class AlbumsList {
this._http = http;
this.refreshData();
}
public sortBy(col: string) {
this._sortByDesc = col === this._sortBy ? !this._sortByDesc : false;
this._sortBy = col;
this.refreshData();
}
public goToPage(pageIndex: number) {
this._pageIndex = pageIndex;
this.refreshData();
}
public goToLast() {
this.goToPage(this.pageLinks[this.pageLinks.length - 1].index);
}
refreshData() {
var sortBy = this._sortBy + (this._sortByDesc ? ' DESC' : '');
this._http.get(`/api/albums?page=${ this._pageIndex }&pageSize=50&sortBy=${ sortBy }`).subscribe(result => {
var json = result.json();
this.rows = json.Data;
var numPages = Math.ceil(json.TotalCount / json.PageSize);
this.pageLinks = [];
for (var i = 1; i <= numPages; i++) {
@@ -61,7 +61,7 @@ export class AlbumsList {
isCurrent: i === json.Page
});
}
this.canGoBack = this.pageLinks.length && !this.pageLinks[0].isCurrent;
this.canGoForward = this.pageLinks.length && !this.pageLinks[this.pageLinks.length - 1].isCurrent;
this.totalCount = json.TotalCount;

View File

@@ -11,7 +11,7 @@ import { AbstractControl } from 'angular2/common';
export class FormField {
public errorMessages: string[] = [];
private validate: AbstractControl;
private ngDoCheck() {
var errors = (this.validate && this.validate.dirty && this.validate.errors) || {};
this.errorMessages = Object.keys(errors).map(key => {

View File

@@ -1,10 +1,10 @@
<div *ngIf="albumData">
<h2>{{ albumData.Title }}</h2>
<p>
<img alt="{{ albumData.Title }}" src="{{ albumData.AlbumArtUrl }}">
</p>
<div id="album-details">
<p>
<em>Genre:</em>
@@ -23,4 +23,4 @@
Add to cart
</p>
</div>
</div>
</div>

View File

@@ -11,7 +11,7 @@ import * as models from '../../../models/models';
})
export class AlbumDetails {
public albumData: models.Album;
constructor(http: Http, routeParam: router.RouteParams) {
http.get('/api/albums/' + routeParam.params['albumId']).subscribe(result => {
this.albumData = result.json();

View File

@@ -16,7 +16,7 @@ export class GenreContents {
constructor(http: Http, routeParam: router.RouteParams) {
http.get(`/api/genres/${ routeParam.params['genreId'] }/albums`).subscribe(result => {
this.albums = result.json();
this.albums = result.json();
});
}
}

View File

@@ -15,7 +15,7 @@ export class GenresList {
constructor(http: Http) {
http.get('/api/genres').subscribe(result => {
this.genres = result.json();
this.genres = result.json();
});
}
}

View File

@@ -2,7 +2,7 @@ import * as ng from 'angular2/core';
import { Http } from 'angular2/http';
import { AlbumTile } from '../album-tile/album-tile';
import * as models from '../../../models/models';
@ng.Component({
selector: 'home'
})
@@ -15,7 +15,7 @@ export class Home {
constructor(http: Http) {
http.get('/api/albums/mostPopular').subscribe(result => {
this.mostPopular = result.json();
this.mostPopular = result.json();
});
}
}

View File

@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="httpPlatformHandler" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified" />
</handlers>
<httpPlatform processPath="%DNX_PATH%" arguments="%DNX_ARGS%" stdoutLogEnabled="false" forwardWindowsAuthToken="false" startupTimeLimit="3600" />
</system.webServer>
</configuration>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="httpPlatformHandler" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified" />
</handlers>
<httpPlatform processPath="%DNX_PATH%" arguments="%DNX_ARGS%" stdoutLogEnabled="false" forwardWindowsAuthToken="false" startupTimeLimit="3600" />
</system.webServer>
</configuration>