Skip to content

Commit

Permalink
feat(all): new sample app
Browse files Browse the repository at this point in the history
  • Loading branch information
EisenbergEffect committed Jan 25, 2015
1 parent 44ae6db commit 089ee74
Show file tree
Hide file tree
Showing 28 changed files with 1,306 additions and 4 deletions.
14 changes: 14 additions & 0 deletions .editorconfig
@@ -0,0 +1,14 @@
# EditorConfig is awesome: http://EditorConfig.org

# top-most EditorConfig file
root = true

# Unix-style newlines with a newline ending every file
[*]
end_of_line = lf
insert_final_newline = true

# 2 space indentation
[**.*]
indent_style = space
indent_size = 2
5 changes: 5 additions & 0 deletions .gitignore
@@ -0,0 +1,5 @@
node_modules
jspm_packages
bower_components
.idea
.DS_STORE
3 changes: 3 additions & 0 deletions .npmignore
@@ -0,0 +1,3 @@
jspm_packages
bower_components
.idea
5 changes: 2 additions & 3 deletions LICENSE
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2015 aurelia
Copyright (c) 2014 Durandal Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand All @@ -18,5 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

SOFTWARE.
64 changes: 63 additions & 1 deletion README.md
@@ -1,2 +1,64 @@
# app-contacts
A sample app that lets you browse and edit contacts

An [Aurelia](http://www.aurelia.io/) sample app that lets you browse and edit contacts.

> To keep up to date on [Aurelia](http://www.aurelia.io/), please visit and subscribe to [the official blog](http://blog.durandal.io/). If you have questions, we invite you to join us on [our Gitter Channel](https://gitter.im/aurelia/discuss).
## Running The App

To run the app, follow these steps.

1. Ensure that [NodeJS](http://nodejs.org/) is installed. This provides the platform on which the build tooling runs.
2. From the project folder, execute the following command:

```shell
npm install
```
3. Ensure that [Gulp](http://gulpjs.com/) is installed. If you need to install it, use the following command:

```shell
npm install -g gulp
```
4. Ensure that [jspm](http://jspm.io/) is installed. If you need to install it, use the following command:

```shell
npm install -g jspm
```
> **Note:** jspm queries GitHub to install semver packages, but GitHub has a rate limit on anonymous API requests. It is advised that you configure jspm with your GitHub credentials in order to avoid problems. You can do this by executing `jspm endpoint config github` and following the prompts.
5. Install the client-side dependencies with jspm:

```shell
jspm install
```
>**Note:** Windows users, if you experience an error of "unknown command unzip" you can solve this problem by doing `npm install -g unzip` and then re-running `jspm install`.
6. To run the app, execute the following command:

```shell
gulp watch
```
7. Browse to [http://localhost:9000](http://localhost:9000) to see the app. You can make changes in the code found under `src` and the browser should auto-refresh itself as you save files.

> Note: At present there is a bug in the HTMLImports polyfill which only occurs on IE. We have submitted a pull request to the team with the fix. In the mean time, if you want to test on IE, you can work around the issue by explicitly adding a script tag before you load system.js. The script tag should look something like this (be sure to confirm the version number):
```html
<script src="jspm_packages/github/webcomponents/webcomponentsjs@0.5.2/HTMLImports.js"></script>
```

## Running The Tests

To run the unit tests, first ensure that you have followed the steps above in order to install all dependencies and successfully build the library. Once you have done that, proceed with these additional steps:

1. Ensure that the [Karma](http://karma-runner.github.io/) CLI is installed. If you need to install it, use the following command:

```shell
npm install -g karma-cli
```
2. You can now run the tests with this command:

```shell
karma start
```

## Contributing

We'd love for you to contribute to our source code and to make this project even better than it is today! If this interests you, please begin by reading [our contributing guidelines](https://github.com/DurandalProject/about/blob/master/CONTRIBUTING.md). The contributing document will provide you with all the information you need to get started. Once you have read that, you will need to also [sign our CLA](http://goo.gl/forms/dI8QDDSyKR) before we can accepts a Pull Request from you. More information on the process is including in the [contributor's guide](https://github.com/DurandalProject/about/blob/master/CONTRIBUTING.md).
108 changes: 108 additions & 0 deletions config.js
@@ -0,0 +1,108 @@
System.config({
"paths": {
"*": "*.js",
"app-contacts/*": "lib/*.js",
"github:*": "jspm_packages/github/*.js",
"npm:*": "jspm_packages/npm/*.js"
}
});

System.config({
"map": {
"aurelia-bootstrapper": "github:aurelia/bootstrapper@0.9.2",
"bootstrap": "github:twbs/bootstrap@3.3.2",
"css": "github:systemjs/plugin-css@0.1.0",
"font-awesome": "npm:font-awesome@4.2.0",
"nprogress": "github:rstacruz/nprogress@0.1.6",
"github:aurelia/binding@0.3.2": {
"aurelia-metadata": "github:aurelia/metadata@0.3.1",
"aurelia-task-queue": "github:aurelia/task-queue@0.2.2"
},
"github:aurelia/bootstrapper@0.9.2": {
"aurelia-event-aggregator": "github:aurelia/event-aggregator@0.2.2",
"aurelia-framework": "github:aurelia/framework@0.8.2",
"aurelia-history": "github:aurelia/history@0.2.2",
"aurelia-history-browser": "github:aurelia/history-browser@0.2.3",
"aurelia-loader-default": "github:aurelia/loader-default@0.4.1",
"aurelia-logging-console": "github:aurelia/logging-console@0.2.2",
"aurelia-router": "github:aurelia/router@0.5.1",
"aurelia-templating": "github:aurelia/templating@0.8.4",
"aurelia-templating-binding": "github:aurelia/templating-binding@0.8.3",
"aurelia-templating-resources": "github:aurelia/templating-resources@0.8.3",
"aurelia-templating-router": "github:aurelia/templating-router@0.9.2"
},
"github:aurelia/dependency-injection@0.4.1": {
"aurelia-metadata": "github:aurelia/metadata@0.3.1",
"core-js": "npm:core-js@0.4.7"
},
"github:aurelia/framework@0.8.2": {
"aurelia-binding": "github:aurelia/binding@0.3.2",
"aurelia-dependency-injection": "github:aurelia/dependency-injection@0.4.1",
"aurelia-loader": "github:aurelia/loader@0.3.3",
"aurelia-logging": "github:aurelia/logging@0.2.2",
"aurelia-metadata": "github:aurelia/metadata@0.3.1",
"aurelia-task-queue": "github:aurelia/task-queue@0.2.2",
"aurelia-templating": "github:aurelia/templating@0.8.4"
},
"github:aurelia/history-browser@0.2.3": {
"aurelia-history": "github:aurelia/history@0.2.2",
"core-js": "npm:core-js@0.4.7"
},
"github:aurelia/loader-default@0.4.1": {
"aurelia-loader": "github:aurelia/loader@0.3.3",
"aurelia-metadata": "github:aurelia/metadata@0.3.1",
"aurelia-path": "github:aurelia/path@0.4.1"
},
"github:aurelia/loader@0.3.3": {
"aurelia-html-template-element": "github:aurelia/html-template-element@0.1.2",
"core-js": "npm:core-js@0.4.7",
"webcomponentsjs": "github:webcomponents/webcomponentsjs@0.5.4"
},
"github:aurelia/router@0.5.1": {
"aurelia-dependency-injection": "github:aurelia/dependency-injection@0.4.1",
"aurelia-history": "github:aurelia/history@0.2.2",
"aurelia-path": "github:aurelia/path@0.4.1",
"aurelia-route-recognizer": "github:aurelia/route-recognizer@0.2.2",
"core-js": "npm:core-js@0.4.7"
},
"github:aurelia/templating-binding@0.8.3": {
"aurelia-binding": "github:aurelia/binding@0.3.2",
"aurelia-templating": "github:aurelia/templating@0.8.4"
},
"github:aurelia/templating-resources@0.8.3": {
"aurelia-binding": "github:aurelia/binding@0.3.2",
"aurelia-dependency-injection": "github:aurelia/dependency-injection@0.4.1",
"aurelia-templating": "github:aurelia/templating@0.8.4",
"core-js": "npm:core-js@0.4.7"
},
"github:aurelia/templating-router@0.9.2": {
"aurelia-dependency-injection": "github:aurelia/dependency-injection@0.4.1",
"aurelia-metadata": "github:aurelia/metadata@0.3.1",
"aurelia-path": "github:aurelia/path@0.4.1",
"aurelia-router": "github:aurelia/router@0.5.1",
"aurelia-templating": "github:aurelia/templating@0.8.4"
},
"github:aurelia/templating@0.8.4": {
"aurelia-binding": "github:aurelia/binding@0.3.2",
"aurelia-dependency-injection": "github:aurelia/dependency-injection@0.4.1",
"aurelia-html-template-element": "github:aurelia/html-template-element@0.1.2",
"aurelia-loader": "github:aurelia/loader@0.3.3",
"aurelia-logging": "github:aurelia/logging@0.2.2",
"aurelia-metadata": "github:aurelia/metadata@0.3.1",
"aurelia-path": "github:aurelia/path@0.4.1",
"aurelia-task-queue": "github:aurelia/task-queue@0.2.2",
"core-js": "npm:core-js@0.4.7"
},
"github:jspm/nodelibs-process@0.1.0": {
"process": "npm:process@0.10.0"
},
"github:twbs/bootstrap@3.3.2": {
"css": "github:systemjs/plugin-css@0.1.0",
"jquery": "github:components/jquery@2.1.3"
},
"npm:core-js@0.4.7": {
"process": "github:jspm/nodelibs-process@0.1.0"
}
}
});

29 changes: 29 additions & 0 deletions dist/app.html
@@ -0,0 +1,29 @@
<template>
<import from="./loading-indicator"></import>

<nav class="navbar navbar-default navbar-fixed-top" role="navigation">
<div class="navbar-header">
<a class="navbar-brand" href="#">
<i class="fa fa-user"></i>
<span>Contacts</span>
</a>
</div>
</nav>

<loading-indicator loading.bind="router.isNavigating || api.isRequesting"></loading-indicator>

<div class="page-host">
<div class="contact-list">
<ul class="list-group">
<li repeat.for="contact of contacts" class="list-group-item ${contact.id === $parent.selectedId ? 'active' : ''}">
<a href="#" click.delegate="$parent.select(contact)">
<h4 class="list-group-item-heading">${contact.firstName} ${contact.lastName}</h4>
<p class="list-group-item-text">${contact.email}</p>
</a>
</li>
</ul>
</div>

<router-view></router-view>
</div>
</template>
65 changes: 65 additions & 0 deletions dist/app.js
@@ -0,0 +1,65 @@
System.register(["aurelia-router", "./web-api"], function (_export) {
"use strict";

var Router, WebAPI, _prototypeProperties, App;
return {
setters: [function (_aureliaRouter) {
Router = _aureliaRouter.Router;
}, function (_webApi) {
WebAPI = _webApi.WebAPI;
}],
execute: function () {
_prototypeProperties = function (child, staticProps, instanceProps) {
if (staticProps) Object.defineProperties(child, staticProps);
if (instanceProps) Object.defineProperties(child.prototype, instanceProps);
};

App = (function () {
function App(router, api) {
this.router = router;
this.api = api;

this.router.configure(function (config) {
config.title = "Contacts";
config.map([{ route: "", moduleId: "no-selection", title: "Select" }, { route: "contacts/:id", moduleId: "contact-detail" }]);
});
}

_prototypeProperties(App, {
inject: {
value: function inject() {
return [Router, WebAPI];
},
writable: true,
enumerable: true,
configurable: true
}
}, {
select: {
value: function select(contact) {
this.selectedId = contact.id;
this.router.navigate("contacts/" + contact.id);
},
writable: true,
enumerable: true,
configurable: true
},
activate: {
value: function activate() {
var _this = this;
return this.api.getContactList().then(function (contacts) {
_this.contacts = contacts;
});
},
writable: true,
enumerable: true,
configurable: true
}
});

return App;
})();
_export("App", App);
}
};
});
42 changes: 42 additions & 0 deletions dist/contact-detail.html
@@ -0,0 +1,42 @@
<template>
<div class="panel panel-primary">
<div class="panel-heading">
<h3 class="panel-title">Profile</h3>
</div>
<div class="panel-body">
<form role="form" class="form-horizontal">
<div class="form-group">
<label class="col-sm-2 control-label">First Name</label>
<div class="col-sm-3">
<input type="text" placeholder="first name" class="form-control" value.bind="contact.firstName">
</div>
</div>

<div class="form-group">
<label class="col-sm-2 control-label">Last Name</label>
<div class="col-sm-3">
<input type="text" placeholder="last name" class="form-control" value.bind="contact.lastName">
</div>
</div>

<div class="form-group">
<label class="col-sm-2 control-label">Email</label>
<div class="col-sm-3">
<input type="text" placeholder="email" class="form-control" value.bind="contact.email">
</div>
</div>

<div class="form-group">
<label class="col-sm-2 control-label">Phone Nember</label>
<div class="col-sm-3">
<input type="text" placeholder="phone number" class="form-control" value.bind="contact.phoneNumber">
</div>
</div>
</form>
</div>
</div>

<div class="button-bar">
<button class="btn btn-success" click.delegate="save()" disabled.bind="!canSave">Save</button>
</div>
</template>

0 comments on commit 089ee74

Please sign in to comment.