Skip to content
This repository was archived by the owner on Apr 8, 2020. It is now read-only.

Commit e60ea04

Browse files
kmkatsmaSteveSandersonMS
authored andcommitted
Add AureliaSpa template (#398)
1 parent 867e60d commit e60ea04

31 files changed

+722
-0
lines changed

templates/AureliaSpa/Aurelia.xproj

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup>
4+
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
5+
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
6+
<TypeScriptCompileBlocked>true</TypeScriptCompileBlocked>
7+
</PropertyGroup>
8+
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.Props" Condition="'$(VSToolsPath)' != ''" />
9+
<PropertyGroup Label="Globals">
10+
<ProjectGuid>33d8dad9-74f9-471d-8bad-55f828faa736</ProjectGuid>
11+
<RootNamespace>AureliaSpa</RootNamespace>
12+
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">.\obj</BaseIntermediateOutputPath>
13+
<OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath>
14+
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
15+
</PropertyGroup>
16+
<PropertyGroup>
17+
<SchemaVersion>2.0</SchemaVersion>
18+
</PropertyGroup>
19+
<Import Project="$(VSToolsPath)\DotNet.Web\Microsoft.DotNet.Web.targets" Condition="'$(VSToolsPath)' != ''" />
20+
</Project>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
@media (max-width: 767px) {
2+
/* On small screens, the nav menu spans the full width of the screen. Leave a space for it. */
3+
.body-content {
4+
padding-top: 50px;
5+
}
6+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<template>
2+
<require from="../navmenu/navmenu.html"></require>
3+
<require from="./app.css"></require>
4+
<div class="container-fluid">
5+
<div class="row">
6+
<div class="col-sm-3">
7+
<navmenu router.bind="router"></navmenu>
8+
</div>
9+
<div class="col-sm-9 body-content">
10+
<router-view></router-view>
11+
</div>
12+
</div>
13+
</div>
14+
</template>
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import { Aurelia } from 'aurelia-framework';
2+
import { Router, RouterConfiguration } from 'aurelia-router';
3+
4+
export class App {
5+
router: Router;
6+
7+
configureRouter(config: RouterConfiguration, router: Router) {
8+
config.title = 'Aurelia';
9+
config.map([{
10+
route: [ '', 'home' ],
11+
name: 'home',
12+
settings: { icon: 'home' },
13+
moduleId: '../home/home',
14+
nav: true,
15+
title: 'Home'
16+
}, {
17+
route: 'counter',
18+
name: 'counter',
19+
settings: { icon: 'education' },
20+
moduleId: '../counter/counter',
21+
nav: true,
22+
title: 'Counter'
23+
}, {
24+
route: 'fetch-data',
25+
name: 'fetchdata',
26+
settings: { icon: 'th-list' },
27+
moduleId: '../fetchdata/fetchdata',
28+
nav: true,
29+
title: 'Fetch data'
30+
}]);
31+
32+
this.router = router;
33+
}
34+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<template>
2+
<h2>Counter</h2>
3+
4+
<p>This is a simple example of an Aurelia component.</p>
5+
6+
<p>Current count: <strong>${currentCount}</strong></p>
7+
8+
<button click.delegate="incrementCounter()">Increment</button>
9+
</template>
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
export class Counter {
2+
public currentCount = 0;
3+
4+
public incrementCounter() {
5+
this.currentCount++;
6+
}
7+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<template>
2+
<h1>Weather forecast</h1>
3+
4+
<p>This component demonstrates fetching data from the server.</p>
5+
6+
<p if.bind="!forecasts"><em>Loading...</em></p>
7+
8+
<table if.bind="forecasts" class="table">
9+
<thead>
10+
<tr>
11+
<th>Date</th>
12+
<th>Temp. (C)</th>
13+
<th>Temp. (F)</th>
14+
<th>Summary</th>
15+
</tr>
16+
</thead>
17+
<tbody>
18+
<tr repeat.for="forecast of forecasts">
19+
<td>${ forecast.dateFormatted }</td>
20+
<td>${ forecast.temperatureC }</td>
21+
<td>${ forecast.temperatureF }</td>
22+
<td>${ forecast.summary }</td>
23+
</tr>
24+
</tbody>
25+
</table>
26+
</template>
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/// <reference path="../../../../node_modules/aurelia-fetch-client/doc/whatwg-fetch.d.ts" />
2+
/// <reference path="../../../../node_modules/aurelia-fetch-client/doc/url.d.ts" />
3+
import { HttpClient } from 'aurelia-fetch-client';
4+
import { inject } from 'aurelia-framework';
5+
6+
@inject(HttpClient)
7+
export class Fetchdata {
8+
public forecasts: WeatherForecast[];
9+
10+
constructor(http: HttpClient) {
11+
http.fetch('/api/SampleData/WeatherForecasts')
12+
.then(result => result.json())
13+
.then(data => {
14+
this.forecasts = data;
15+
});
16+
}
17+
}
18+
19+
interface WeatherForecast {
20+
dateFormatted: string;
21+
temperatureC: number;
22+
temperatureF: number;
23+
summary: string;
24+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<template>
2+
<h1>Hello, world!</h1>
3+
<p>Welcome to your new single-page application, built with:</p>
4+
<ul>
5+
<li><a href="https://get.asp.net/">ASP.NET Core</a> and <a href="https://msdn.microsoft.com/en-us/library/67ef8sbd.aspx">C#</a> for cross-platform server-side code</li>
6+
<li><a href="https://aurelia.io/">Aurelia</a> and <a href="http://www.typescriptlang.org/">TypeScript</a> for client-side code</li>
7+
<li><a href="https://webpack.github.io/">Webpack</a> for building and bundling client-side resources</li>
8+
<li><a href="http://getbootstrap.com/">Bootstrap</a> for layout and styling</li>
9+
</ul>
10+
<p>To help you get started, we've also set up:</p>
11+
<ul>
12+
<li><strong>Client-side navigation</strong>. For example, click <em>Counter</em> then <em>Back</em> to return here.</li>
13+
<li><strong>Webpack dev middleware</strong>. In development mode, there's no need to run the <code>webpack</code> build tool. Your client-side resources are dynamically built on demand. Updates are available as soon as you modify any file.</li>
14+
<li><strong>Efficient production builds</strong>. In production mode, development-time features are disabled, and the <code>webpack</code> build tool produces minified static CSS and JavaScript files.</li>
15+
</ul>
16+
</template>
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export class Home {
2+
}

0 commit comments

Comments
 (0)