Created
February 17, 2014 16:07
-
-
Save mattahorton/9053407 to your computer and use it in GitHub Desktop.
Attempt at Julien Knebel's Ember CRUD
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta charset="utf-8"> | |
| <meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
| <title>App</title> | |
| <meta name="description" content=""> | |
| <meta name="viewport" content="width=device-width, initial-scale=1"> | |
| </head> | |
| <body> | |
| <script src="http://code.jquery.com/jquery-2.0.3.min.js"></script> | |
| <script src="handlebars.runtime-v1.3.0.js"></script> | |
| <script src="http://builds.emberjs.com/release/ember.js"></script> | |
| <script src="http://builds.emberjs.com/beta/ember-data.js"></script> | |
| <script type="text/javascript" src="templates.js"></script> | |
| <script type="text/javascript" src="app.js"></script> | |
| <script type="text/javascript" src="router.js"></script> | |
| <script type="text/javascript" src="store.js"></script> | |
| </body> | |
| </html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| App.User = DS.Model.extend({ | |
| name : DS.attr(), | |
| email : DS.attr(), | |
| bio : DS.attr(), | |
| avatarUrl : DS.attr(), | |
| creationDate : DS.attr() | |
| }); | |
| App.User.FIXTURES = [{ | |
| id: 1, | |
| name: 'Sponge Bob', | |
| email: '[email protected]', | |
| bio: 'Lorem ispum dolor sit amet in voluptate fugiat nulla pariatur.', | |
| avatarUrl: 'http://jkneb.github.io/ember-crud/assets/images/avatars/sb.jpg', | |
| creationDate: 'Mon, 26 Aug 2013 20:23:43 GMT' | |
| }, { | |
| id: 2, | |
| name: 'John David', | |
| email: '[email protected]', | |
| bio: 'Lorem ispum dolor sit amet in voluptate fugiat nulla pariatur.', | |
| avatarUrl: 'http://jkneb.github.io/ember-crud/assets/images/avatars/jk.jpg', | |
| creationDate: 'Fri, 07 Aug 2013 10:10:10 GMT' | |
| }]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| App.Router.map(function(){ | |
| this.resource('users', function(){ | |
| this.resource('user', { path:'/:user_id' }, function(){ | |
| this.route('edit'); | |
| }); | |
| this.route('create'); | |
| }); | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| App.UsersRoute = Ember.Route.extend({ | |
| model: function(){ | |
| return this.store.find('user'); | |
| } | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| App.ApplicationAdapter = DS.FixtureAdapter; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment