- Notifications
You must be signed in to change notification settings - Fork 517
Add AureliaSpa template #398
Changes from 1 commit
600aa17 f24fce8 28c778e 1563578 12120ef b363ed7 fe5059c 790b719 e8b2ba8 5747fb8 48a8162 68bf670 File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,246 @@ | ||
| /Properties/launchSettings.json | ||
| | ||
| ## Ignore Visual Studio temporary files, build results, and | ||
| ## files generated by popular Visual Studio add-ons. | ||
| | ||
| # User-specific files | ||
| *.suo | ||
| *.user | ||
| *.userosscache | ||
| *.sln.docstates | ||
| | ||
| # User-specific files (MonoDevelop/Xamarin Studio) | ||
| *.userprefs | ||
| | ||
| # Build results | ||
| [Dd]ebug/ | ||
| [Dd]ebugPublic/ | ||
| [Rr]elease/ | ||
| [Rr]eleases/ | ||
| x64/ | ||
| x86/ | ||
| build/ | ||
| bld/ | ||
| bin/ | ||
| Bin/ | ||
| obj/ | ||
| Obj/ | ||
| | ||
| # Visual Studio 2015 cache/options directory | ||
| .vs/ | ||
| /wwwroot/dist/** | ||
| /ClientApp/dist/** | ||
| | ||
| # Workaround for https://github.com/aspnet/JavaScriptServices/issues/235 | ||
| !/wwwroot/dist/_placeholder.txt | ||
| !/ClientApp/dist/_placeholder.txt | ||
| | ||
| | ||
| # MSTest test Results | ||
| [Tt]est[Rr]esult*/ | ||
| [Bb]uild[Ll]og.* | ||
| | ||
| # NUNIT | ||
| *.VisualState.xml | ||
| TestResult.xml | ||
| | ||
| # Build Results of an ATL Project | ||
| [Dd]ebugPS/ | ||
| [Rr]eleasePS/ | ||
| dlldata.c | ||
| | ||
| # DNX | ||
| project.lock.json | ||
| artifacts/ | ||
| | ||
| *_i.c | ||
| *_p.c | ||
| *_i.h | ||
| *.ilk | ||
| *.meta | ||
| *.obj | ||
| *.pch | ||
| *.pdb | ||
| *.pgc | ||
| *.pgd | ||
| *.rsp | ||
| *.sbr | ||
| *.tlb | ||
| *.tli | ||
| *.tlh | ||
| *.tmp | ||
| *.tmp_proj | ||
| *.log | ||
| *.vspscc | ||
| *.vssscc | ||
| .builds | ||
| *.pidb | ||
| *.svclog | ||
| *.scc | ||
| | ||
| # Chutzpah Test files | ||
| _Chutzpah* | ||
| | ||
| # Visual C++ cache files | ||
| ipch/ | ||
| *.aps | ||
| *.ncb | ||
| *.opendb | ||
| *.opensdf | ||
| *.sdf | ||
| *.cachefile | ||
| | ||
| # Visual Studio profiler | ||
| *.psess | ||
| *.vsp | ||
| *.vspx | ||
| *.sap | ||
| | ||
| # TFS 2012 Local Workspace | ||
| $tf/ | ||
| | ||
| # Guidance Automation Toolkit | ||
| *.gpState | ||
| | ||
| # ReSharper is a .NET coding add-in | ||
| _ReSharper*/ | ||
| *.[Rr]e[Ss]harper | ||
| *.DotSettings.user | ||
| | ||
| # JustCode is a .NET coding add-in | ||
| .JustCode | ||
| | ||
| # TeamCity is a build add-in | ||
| _TeamCity* | ||
| | ||
| # DotCover is a Code Coverage Tool | ||
| *.dotCover | ||
| | ||
| # NCrunch | ||
| _NCrunch_* | ||
| .*crunch*.local.xml | ||
| nCrunchTemp_* | ||
| | ||
| # MightyMoose | ||
| *.mm.* | ||
| AutoTest.Net/ | ||
| | ||
| # Web workbench (sass) | ||
| .sass-cache/ | ||
| | ||
| # Installshield output folder | ||
| [Ee]xpress/ | ||
| | ||
| # DocProject is a documentation generator add-in | ||
| DocProject/buildhelp/ | ||
| DocProject/Help/*.HxT | ||
| DocProject/Help/*.HxC | ||
| DocProject/Help/*.hhc | ||
| DocProject/Help/*.hhk | ||
| DocProject/Help/*.hhp | ||
| DocProject/Help/Html2 | ||
| DocProject/Help/html | ||
| | ||
| # Click-Once directory | ||
| publish/ | ||
| | ||
| # Publish Web Output | ||
| *.[Pp]ublish.xml | ||
| *.azurePubxml | ||
| # TODO: Comment the next line if you want to checkin your web deploy settings | ||
| # but database connection strings (with potential passwords) will be unencrypted | ||
| *.pubxml | ||
| *.publishproj | ||
| | ||
| # NuGet Packages | ||
| *.nupkg | ||
| # The packages folder can be ignored because of Package Restore | ||
| **/packages/* | ||
| # except build/, which is used as an MSBuild target. | ||
| !**/packages/build/ | ||
| # Uncomment if necessary however generally it will be regenerated when needed | ||
| #!**/packages/repositories.config | ||
| | ||
| # Microsoft Azure Build Output | ||
| csx/ | ||
| *.build.csdef | ||
| | ||
| # Microsoft Azure Emulator | ||
| ecf/ | ||
| rcf/ | ||
| | ||
| # Microsoft Azure ApplicationInsights config file | ||
| ApplicationInsights.config | ||
| | ||
| # Windows Store app package directory | ||
| AppPackages/ | ||
| BundleArtifacts/ | ||
| | ||
| # Visual Studio cache files | ||
| # files ending in .cache can be ignored | ||
| *.[Cc]ache | ||
| # but keep track of directories ending in .cache | ||
| !*.[Cc]ache/ | ||
| | ||
| # Others | ||
| ClientBin/ | ||
| ~$* | ||
| *~ | ||
| *.dbmdl | ||
| *.dbproj.schemaview | ||
| *.pfx | ||
| *.publishsettings | ||
| orleans.codegen.cs | ||
| | ||
| # Workaround for https://github.com/aspnet/JavaScriptServices/issues/235 | ||
| /node_modules/** | ||
| !/node_modules/_placeholder.txt | ||
| | ||
| # RIA/Silverlight projects | ||
| Generated_Code/ | ||
| | ||
| # Backup & report files from converting an old project file | ||
| # to a newer Visual Studio version. Backup files are not needed, | ||
| # because we have git ;-) | ||
| _UpgradeReport_Files/ | ||
| Backup*/ | ||
| UpgradeLog*.XML | ||
| UpgradeLog*.htm | ||
| | ||
| # SQL Server files | ||
| *.mdf | ||
| *.ldf | ||
| | ||
| # Business Intelligence projects | ||
| *.rdl.data | ||
| *.bim.layout | ||
| *.bim_*.settings | ||
| | ||
| # Microsoft Fakes | ||
| FakesAssemblies/ | ||
| | ||
| # GhostDoc plugin setting file | ||
| *.GhostDoc.xml | ||
| | ||
| # Node.js Tools for Visual Studio | ||
| .ntvs_analysis.dat | ||
| | ||
| # Visual Studio 6 build log | ||
| *.plg | ||
| | ||
| # Visual Studio 6 workspace options file | ||
| *.opt | ||
| | ||
| # Visual Studio LightSwitch build output | ||
| **/*.HTMLClient/GeneratedArtifacts | ||
| **/*.DesktopClient/GeneratedArtifacts | ||
| **/*.DesktopClient/ModelManifest.xml | ||
| **/*.Server/GeneratedArtifacts | ||
| **/*.Server/ModelManifest.xml | ||
| _Pvt_Extensions | ||
| | ||
| # Paket dependency manager | ||
| .paket/paket.exe | ||
| | ||
| # FAKE - F# Make | ||
| .fake/ |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
| <Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
| <PropertyGroup> | ||
| <VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion> | ||
| <VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath> | ||
| <TypeScriptCompileBlocked>true</TypeScriptCompileBlocked> | ||
| </PropertyGroup> | ||
| <Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.Props" Condition="'$(VSToolsPath)' != ''" /> | ||
| <PropertyGroup Label="Globals"> | ||
| <ProjectGuid>33d8dad9-74f9-471d-8bad-55f828faa736</ProjectGuid> | ||
| <RootNamespace>Angular2</RootNamespace> | ||
| <TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion> | ||
| </PropertyGroup> | ||
| <PropertyGroup> | ||
| <SchemaVersion>2.0</SchemaVersion> | ||
| </PropertyGroup> | ||
| <Import Project="$(VSToolsPath)\DotNet.Web\Microsoft.DotNet.Web.targets" Condition="'$(VSToolsPath)' != ''" /> | ||
| </Project> | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| @media (max-width: 767px) { | ||
| /* On small screens, the nav menu spans the full width of the screen. Leave a space for it. */ | ||
| .body-content { | ||
| padding-top: 50px; | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| <template> | ||
| There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Inconsistent quote style in this file. In TypeScript let's use single-quotes. In HTML templates, I don't know if Aurelia community has a standard, but can you find out what it is and use that? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We prefer single quotes in JS/TS and double quotes in HTML. | ||
| <require from="../navmenu/navmenu.html"></require> | ||
| <require from="./app.css"></require> | ||
| <div class='container-fluid'> | ||
| <div class='row'> | ||
| <div class='col-sm-3'> | ||
| <navmenu router.bind="router"></navmenu> | ||
| </div> | ||
| <div class='col-sm-9 body-content'> | ||
| <router-view></router-view> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| </template> | ||
| ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| import {Aurelia} from 'aurelia-framework'; | ||
| ||
| import {Router, RouterConfiguration} from 'aurelia-router'; | ||
| | ||
| export class App { | ||
| router: Router; | ||
| | ||
| configureRouter(config: RouterConfiguration, router: Router) { | ||
| config.title = 'Aurelia'; | ||
| config.map([ | ||
| { route: ['', 'home'], name: 'home', settings:{class:'home'}, moduleId: '../home/home', nav: true, title: 'Home' }, | ||
| ||
| { route: 'counter', name: 'counter', settings:{class:'education'}, moduleId: '../counter/counter', nav: true, title: 'Counter' }, | ||
| { route: 'fetch-data', name: 'fetchdata', settings:{class:'th-list'}, moduleId: '../fetchdata/fetchdata', nav: true, title: 'Fetch data' } | ||
| ]); | ||
| | ||
| this.router = router; | ||
| } | ||
| } | ||
| | ||
| | ||
| There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Line 18 seems like unnecessary whitespace, then there's a missing trailing linebreak. | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| <template> | ||
| <h2>Counter</h2> | ||
| | ||
| <p>This is a simple example of an Aurelia component.</p> | ||
| | ||
| <p>Current count: <strong>${currentCount}</strong></p> | ||
| | ||
| <button click.delegate="incrementCounter()">Increment</button> | ||
| </template> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| | ||
| ||
| export class Counter { | ||
| public currentCount = 0; | ||
| | ||
| public incrementCounter() { | ||
| this.currentCount++; | ||
| | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| <template> | ||
| There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Inconsistent quotes and | ||
| <h1>Weather forecast</h1> | ||
| | ||
| <p>This component demonstrates fetching data from the server.</p> | ||
| | ||
| <p if.bind="!forecasts"><em>Loading...</em></p> | ||
| | ||
| <table class='table' if.bind="forecasts"> | ||
| <thead> | ||
| <tr> | ||
| <th>Date</th> | ||
| <th>Temp. (C)</th> | ||
| <th>Temp. (F)</th> | ||
| <th>Summary</th> | ||
| </tr> | ||
| </thead> | ||
| <tbody> | ||
| <tr repeat.for="forecast of forecasts"> | ||
| <td>${forecast.dateFormatted }</td> | ||
| <td>${ forecast.temperatureC }</td> | ||
| <td>${ forecast.temperatureF }</td> | ||
| <td>${ forecast.summary }</td> | ||
| </tr> | ||
| </tbody> | ||
| </table> | ||
| </template> | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| /// <reference path="../../../../node_modules/aurelia-fetch-client/doc/whatwg-fetch.d.ts" /> | ||
| /// <reference path="../../../../node_modules/aurelia-fetch-client/doc/url.d.ts" /> | ||
| There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's unfortunate that these are necessary. Has the underlying issue in Aurelia been reported? Is there any chance of getting a fix published? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These don't have anything to do with Aurelia as far as I know. They are standards that TypeScript is missing for some reason. However, I don't think that There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @EisenbergEffect I think @kmkatsma was saying they are needed because There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As far as we know, there's nothing incorrect in our dts. It's just that we use the Fetch spec which relies on the there being dts for fetch and url. Those should be provided by TS because they are standards, but they aren't, so you have to include your own. If there's something we need to fix on our side, we're happy to do it though. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh, OK, that makes sense! @kmkatsma In that case, the solution may be to reference There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, in general the change in type references for TS 2.0 was something I only realized this Saturday as I was cleaning up some things. Will look at. | ||
| import {HttpClient} from 'aurelia-fetch-client'; | ||
| import {inject} from 'aurelia-framework'; | ||
| | ||
| @inject(HttpClient) | ||
| export class Fetchdata { | ||
| public forecasts: WeatherForecast[]; | ||
| http: HttpClient; | ||
| There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why store this as a member property? It doesn't seem to be used anywhere outside the constructor. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Actually, I do find this entire class to be odd. I usually discourage making AJAX requests in a constructor function. Is this the way that other templates do it as well? Usually, a better practice is to have a service abstraction or "repository" type class that encapsulates the use of the http client and provides a simple method such as There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @EisenbergEffect It's the simplicity/extensibility tradeoff. In the Angular/Knockout/React templates we've followed this exact approach, as we're trying to make the templates accessible to newcompers and limit the concept count. People who get into using one of those frameworks won't struggle to create a service layer. In the ReactRedux template, we do the whole Redux thing which is a whole extra level of sophistication, but that's just fundamental to doing Redux. I think for this Aurelia template it's a reasonable choice of simplicity vs extensibility already, but we could change it if you think it's just flat out bad. | ||
| | ||
| | ||
| constructor(http: HttpClient) { | ||
| this.http = http; | ||
| this.http.fetch('/api/SampleData/WeatherForecasts') | ||
| .then(result => result.json()) | ||
| .then(data => { | ||
| this.forecasts = data; | ||
| }); | ||
| } | ||
| } | ||
| | ||
| interface WeatherForecast { | ||
| dateFormatted: string; | ||
| temperatureC: number; | ||
| temperatureF: number; | ||
| summary: string; | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please update this