Ember.js 2013-01-06 w/ Ember Data

Based on latest version of Ember.js with the new router. (latest ember build from 2013-01-06) Also including latest master of Ember Data (2013-01-06)

by brennan

HTML

<script src="https://github.com/downloads/wycats/handlebars.js/handlebars-1.0.rc.1.js"></script>
<script src="https://gist.github.com/raw/4469745/b102ee742d0c014bdb21715525255069d0b828bb/ember-latest-201301062045.js"></script>
<script src="https://gist.github.com/raw/8002d19b860a9dcd0f89/1b8ed4a66ef696c537466e6dd23fdb76dc804b57/ember-data-latest-2013-01061909.js"></script>
<link rel="stylesheet" href="http://twitter.github.com/bootstrap/assets/css/bootstrap.css">
<script type="text/x-handlebars">
  <h1>hi</h1>
  <div class="container">{{outlet}}</div>
</script>

<script type="text/x-handlebars" data-template-name="github">
  Github
</script>

JavaScript

App = Ember.Application.create();

App.Store = DS.Store.extend({
  revision: 11,
  adapter: DS.RESTAdapter.create({
    url: 'https://api.github.com'
  })
});

App.Comment = DS.Model.extend({
  "url": DS.attr('string'),
  "htmlUrl": DS.attr('string'),
  "number": DS.attr('number'),
  "state": DS.attr('string'),
  "title": DS.attr('string'),
  "body": DS.attr('string'),
  "user": DS.belongsTo('App.User'),
  "labels": DS.hasMany('App.Label'),
  "assignee": DS.belongsTo('App.User'),
  "milestone": DS.belongsTo('App.Milestone'),
  "comments": DS.attr('number'),
  "pullRequest": {
    "htmlUrl": DS.attr('string'),
    "diffUrl": DS.attr('string'),
    "patchUrl": DS.attr('string'),
  },
  "closedAt": DS.attr('date'),
  "createdAt": DS.attr('date'),
  "updatedAt": DS.attr('date')
});

App.Repo = DS.Model.extend({
  "owner": DS.belongsTo('App.User'),
  "name": DS.attr('string'),
  "fullName": DS.attr('string'),
  "description": DS.attr('string'),
  "private": DS.attr('bool'),
  "fork": DS.attr('bool'),
  "url": DS.attr('string'),
  "htmlUrl": DS.attr('string'),
  "cloneUrl": DS.attr('string'),
  "gitUrl": DS.attr('string'),
  "sshUrl": DS.attr('string'),
  "svnUrl": DS.attr('string'),
  "mirrorUrl": DS.attr('string'),
  "homepage": DS.attr('string'),
  "forks": DS.attr('number'),
  "forksCount": DS.attr('number'),
  "watchers": DS.attr('number'),
  "watchersCount": DS.attr('number'),
  "size": DS.attr('number'),
  "masterBranch": DS.attr('string'),
  "openIssues": DS.attr('number'),
  "pushedAt": DS.attr('date'),
  "createdAt": DS.attr('date'),
  "updatedAt": DS.attr('date')
});

App.User = DS.Model.extend({
  "login": DS.attr('string'),
  "avatarUrl": DS.attr('string'),
  "gravatarId": DS.attr('string'),
  "url": DS.attr('string'),
  "name": DS.attr('string'),
  "company": DS.attr('string'),
  "blog": DS.attr('string'),
  "location": DS.attr('string'),
  "email": DS.attr('string'),
  "hireable": DS.attr('boolean'),
  "bio": DS.attr('string'),
  "publicRepos":...