Skip to content

Instantly share code, notes, and snippets.

@krainboltgreene
Created November 23, 2012 02:53
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save krainboltgreene/4133819 to your computer and use it in GitHub Desktop.
Save krainboltgreene/4133819 to your computer and use it in GitHub Desktop.

Ember.js Guide To A Client App

Setup

  1. Install & Setup a web server (I recommend http://pow.cx)
  2. Create a directory for your application (I'll be using github-client)
  3. Create the below directory structure (script: curl http://git.io/DBLtXw | sh):
  - github-client
    - application/
      - libraries/
        - sugar.js OR underscore.js
        - ember.js
        - ember-data.js
        - handlebars.js
      - templates/
        - template.handlebars
      - controllers/
        - controller.js
      - presenters/
        - presenter.js
      - models/
        - model.js
      - application.js
    - scripts/
      - vendor/
        - bootstrap.js
        - modernizr.js
        - jquery.js
      - core.js
    - styles/
      - vendor/
        - bootstrap.css
        - bootstrap-responsive.css
        - fontawesome.css
      - core.css
    - images/
    - fonts/
    - favicon.ico
    - robots.txt
    - humans.txt
    - 404.html
    - 500.html
    - index.html
  1. Fill index.html with this source from here

Setting up application.js

Creating your first model

First we need to make a file called application/models/account.js and it'll contain this code:

Application.Account = DS.Model.extend({
  login: DS.attr('string'),
  name: DS.attr('string'),
  created_at: DS.attr('date'),

  location: function() {
      return 'https://api.github.com/users/' + this.get('login');
  }.property('login')
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment