mirror of
https://github.com/aspnet/JavaScriptServices.git
synced 2025-12-23 01:58:29 +00:00
Normalise trailing whitespace and line endings everywhere
This commit is contained in:
@@ -17,5 +17,5 @@ import { AlbumEdit } from '../album-edit/album-edit';
|
||||
directives: [router.ROUTER_DIRECTIVES]
|
||||
})
|
||||
export class AdminHome {
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -47,4 +47,4 @@
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<album-delete-prompt #deleteprompt></album-delete-prompt>
|
||||
<album-delete-prompt #deleteprompt></album-delete-prompt>
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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 || {}) : [];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 }}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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 => {
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ export class GenresList {
|
||||
|
||||
constructor(http: Http) {
|
||||
http.get('/api/genres').subscribe(result => {
|
||||
this.genres = result.json();
|
||||
this.genres = result.json();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user