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
/** | |
* Extension Types for the BootstrapV3DatetimePicker tsd files | |
* Thanks to : https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/bootstrap.v3.datetimepicker | |
*/ | |
/// <reference path="../../jquery/jquery.d.ts"/> | |
/// <reference path="../../moment/moment.d.ts"/> | |
declare module BootstrapV3DatetimePicker { | |
interface DatetimepickerChangeEventObject extends DatetimepickerEventObject { |
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
gulp.task('tscompile', function (done) { | |
return gulp.src('app/**/*.ts') | |
.pipe(sourcemaps.init()) | |
.pipe(ts({ | |
target: "es5", | |
module: "system", | |
emitDecoratorMetadata: true, | |
experimentalDecorators: true | |
})).js | |
.pipe(sourcemaps.write('.',{ includeContent: true, sourceRoot: "/" })) |
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
<template> | |
<form submit.delegate="submit()"> | |
<!--<ul><li repeat.for="error of controller.errors">${error.message}</li></ul>--> | |
<div class="form-group"> | |
<label class="control-label" for="first">First Name</label> | |
<input type="text" class="form-control" id="first" placeholder="First Name" | |
value.bind="firstName & validate"> | |
</div> |
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
<template> | |
<h1>${message}</h1> | |
<input value.bind="myText"/> | |
</template> |
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
<template> | |
<require from="components/navigation.html"></require> | |
<h1>Aurelia Router Demo</h1> | |
<navigation router.bind="router" class="primary-navigation"></navigation> | |
<div class="page-host"> | |
<router-view></router-view> | |
</div> | |
</template> |
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
public interface IMyValidator<T, V> : IValidator<T> | |
{ | |
} |
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
internal class MyInputTypeValidator : AbstractValidator<MyModel>, IMyValidator<MyModel, MyInputTypeValidator> | |
{ | |
public MyInputTypeValidator(IMyService myService) | |
{ | |
… // validation rules | |
} | |
} |
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
public class MyValidationMiddleware<T, V> | |
{ | |
private readonly FieldDelegate _next; | |
private readonly IMyValidator<T, V> _validator; | |
public MyValidationMiddleware(FieldDelegate next, IMyValidator<T, V> validator) | |
{ | |
_next = next; | |
_validator = validator; | |
} |
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
internal static class MyValidationMiddlewareFieldExtensions | |
{ | |
public static IObjectFieldDescriptor UseValidator<T, V>(this IObjectFieldDescriptor descriptor) | |
where V : AbstractValidator<T> | |
{ | |
return descriptor.Use<MyValidationMiddleware<T, V>>(); | |
} | |
} |
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
protected override void Configure(IObjectTypeDescriptor descriptor) | |
{ | |
descriptor.Field<MyField>(f => f.CreateModel(default)) | |
.Argument("input", a => a.Type<NonNullType<MyInputType>>()) | |
.UseValidator<MyModel, MyInputTypeValidator>() | |
.Type<NonNullType<MyModelResult>>(); | |
} |
OlderNewer