Skip to content

Instantly share code, notes, and snippets.

View AshleyGrant's full-sized avatar

Ashley Grant AshleyGrant

  • Vagabond
View GitHub Profile
@AshleyGrant
AshleyGrant / app.html
Last active February 28, 2017 22:32 — forked from lstarky/app.html
Aurelia Validation with JSON rules
<template>
<form role="form" class="form-horizontal" with.bind="user">
<div class="form-group">
<label class="col-sm-2 control-label">First Name</label>
<div class="col-sm-3">
<input value.bind="firstName & validate" type="text" placeholder="first name" class="form-control">
</div>
</div>
<div class="form-group">
@AshleyGrant
AshleyGrant / ajv-validator.js
Created February 28, 2017 21:47
Aurelia Validation using AJV
import {ValidateResult} from 'aurelia-validation';
export class AjvValidator {
cache = new Map;
ajv = new Ajv({ v5: true, allErrors: true, format: 'full' });
validateObject(object) {
this.parseSchema(object);
let schemaId = this._schemaId(object);
if (!this.cache.has(schemaId)) {
@AshleyGrant
AshleyGrant / ajv-validator.js
Last active March 16, 2017 22:24 — forked from mbroadst/ajv-validator.js
Aurelia Validation using AJV
import {ValidateResult} from 'aurelia-validation';
export class AjvValidator {
cache = new Map;
ajv = new Ajv({ v5: true, allErrors: true, format: 'full' });
validateObject(object) {
this.parseSchema(object);
let schemaId = this._schemaId(object);
if (!this.cache.has(schemaId)) {
@AshleyGrant
AshleyGrant / app.html
Last active November 28, 2017 10:57
Aurelia Dynamic and Static Elements
<template>
<require from="./text-box"></require>
<require from="./date-picker"></require>
<div>
Text Box
<text-box value.bind="text"></text-box>
</div>
<div>
Date Picker
@AshleyGrant
AshleyGrant / app.html
Created February 27, 2017 16:09
Aurelia Gist
<template>
<require from="bootstrap/css/bootstrap.css"></require>
<ul>
<li repeat.for="nav of router.navigation">
<a href="nav.href">${nav.tile}</a>
</li>
</ul>
<router-view layout-view="layout-with-sidebar.html"></router-view>
</template>
@AshleyGrant
AshleyGrant / app.html
Created February 24, 2017 14:19 — forked from brylie/app.html
Aurelia Gist
<template>
<require from="bootstrap/css/bootstrap.css"></require>
<nav class="navbar navbar-default" role="navigation">
<div class="navbar-header">
<a class="navbar-brand" href="#">
<i class="fa fa-user"></i>
<span>
Open API Designer
</span>
</a>
@AshleyGrant
AshleyGrant / app.html
Last active February 24, 2017 17:43
Grouped and Sorted Array Using a Value Converter
<template>
<require from="./grouped-sort"></require>
<table>
<template repeat.for="[group, items] of myArray | groupedSort">
<tr>
<td>
${group}
</td>
</tr>
<tr repeat.for="item of items">
@AshleyGrant
AshleyGrant / alert.html
Last active February 14, 2017 14:22
Dynamic components in Aurelia
<template>
<h1>Alert ${type}</h1>
</template>
@AshleyGrant
AshleyGrant / app.html
Last active February 12, 2017 23:28 — forked from lstarky/app.html
Displaying the Json result in Table with some logic
<template>
<div class="container-fluid">
<div class="container-fluid">
<h1>Bootstrap Method (Responsive)</h1>
<p><i>The second column will wrap down below on smaller screens...
if you see it in one column, try widening the screen</i></p>
<div class="row">
<div class="col-xs-6">
<div repeat.for="field of myData | odds">
<p><b>${field.Key}:</b> ${field.value}</p>
@AshleyGrant
AshleyGrant / app.html
Created January 10, 2017 21:26
Sub-menus in navigation bar
<template>
<ul>
<li repeat.for="row of router.navigation" class="${row.isActive ? 'active' : ''}">
<a href.bind="row.href">${row.title}</a>
<ul>
<li repeat.for="sub of row.settings.subRoutes">
<a route-href="route.bind: row.config.name; params.bind: sub.params">${sub.name}</a>
</li>
</ul>
</li>