Skip to content

Instantly share code, notes, and snippets.

View freshcutdevelopment's full-sized avatar

Sean Hunter freshcutdevelopment

View GitHub Profile
@freshcutdevelopment
freshcutdevelopment / country-picker.js
Created October 1, 2017 02:37
Country picker view-model
import {HttpClient} from 'aurelia-fetch-client';
import {bindable} from 'aurelia-framework';
export class CountryPicker{
@bindable country;
constructor(){
this.selected = {"name" : 'Australia', "code" : 'AU'};
this.templateUrl = 'templates/country-template.html';
@freshcutdevelopment
freshcutdevelopment / country-picker.html
Created October 1, 2017 02:29
country-picker.html
<template>
<require from="../attributes/ux-selectize"></require>
<require from="selectize/dist/css/selectize.default.css"></require>
<require from="flag-icon-css/flag-icon.css"></require>
<label for="options">Select country</label>
<select id="select-country" if.bind="selected"
ux-selectize="httpQuery.bind: getCountries; selected.bind: selected; templateUrl.bind:templateUrl; valueField: code; labelField:name; searchField:name; "
class="demo-default"
@freshcutdevelopment
freshcutdevelopment / ux-selectize.js
Created October 1, 2017 02:13
ux-selectize Aurelia custom element
import selectize from "selectize";
import {
inject,
bindable,
Container,
ViewEngine,
bindingMode,
dynamicOptions
} from "aurelia-framework";
import { DOM } from "aurelia-pal";
@freshcutdevelopment
freshcutdevelopment / build.js
Created October 1, 2017 02:08
Modify the build.js file to include the copy flags step
import gulp from 'gulp';
import {CLIOptions, build as buildCLI} from 'aurelia-cli';
import transpile from './transpile';
import processMarkup from './process-markup';
import processCSS from './process-css';
import copyFiles from './copy-files';
import watch from './watch';
import project from '../aurelia.json';
import copyFlags from './copy-flags';
@freshcutdevelopment
freshcutdevelopment / copy-flags.js
Created October 1, 2017 02:07
Copy the flags into the root of the Aurelia project
import gulp from 'gulp';
import project from '../aurelia.json';
export default function copyFlags() {
console.log("copying flags");
return gulp.src(project.paths.flagsInput)
.pipe(gulp.dest(project.paths.flagsOutput));
}
@freshcutdevelopment
freshcutdevelopment / aurelia.json
Last active October 1, 2017 04:02
Country-picker aurelia.json file
...
"jquery",
"text",
{
"name": "selectize",
"main": "dist/js/standalone/selectize.js",
"path": "../node_modules/selectize",
"deps": [
"jquery"
],
@freshcutdevelopment
freshcutdevelopment / app.html
Last active September 29, 2017 02:22
Aurelia Gist - Disabled binding
<template>
<require from="style.css"></require>
<section>
<h1>${message}</h1>
<hr/>
<div class="form-inline">
<div class="input-group input-group mb-2 mr-sm-2 mb-sm-0">
<input class="form-control mb-2 mr-sm-2 mb-sm-0"
@freshcutdevelopment
freshcutdevelopment / app.html
Created September 24, 2017 02:37
app view - blog
<template>
<require from="style.css"></require>
<require from="list-group"></require>
<require from="pokemon.html"></require>
<section>
<h1>${message}</h1>
<hr/>
<h3>custom template</h3>
@freshcutdevelopment
freshcutdevelopment / pokemon.html
Created September 24, 2017 02:37
Pokemon component - blog
<template bindable="model">
<div class="d-flex w-100 justify-content-between">
<h5 class="mb-1 ${model.color}">${model.name}</h5>
<small>${model.category}</small>
</div>
<hr/>
<div class="d-flex w-100 justify-content-between">
<img src="${model.imageSource}"/>
<p class="mb-1">
${model.description}
@freshcutdevelopment
freshcutdevelopment / list-group.html
Created September 24, 2017 02:36
List group - Blog
<template>
<ul class="list-group">
<li repeat.for="item of itemsSource" class="list-group-item">
<template replaceable part="item-template">${defaultValue(item)}</template>
</li>
</ul>
</template>