Skip to content

Instantly share code, notes, and snippets.

@deletosh
Last active December 16, 2015 03:19
Show Gist options
  • Save deletosh/5369550 to your computer and use it in GitHub Desktop.
Save deletosh/5369550 to your computer and use it in GitHub Desktop.
window.App = Em.Application.create({
LOG_TRANSITIONS: true
});
/**
* Data Store
*
*/
App.Store = DS.Store.extend({
revision: 12,
adapter: 'DS.FixtureAdapter'
});
/**
* Model
*
*/
App.Bookmarks = DS.Model.extend({
name: DS.attr('string'),
url: DS.attr('string')
});
/**
* Data Fixtures
*
*/
App.Bookmarks.FIXTURES = [
{id: 1, name: "Tuts+ Premium", url: "http://netuts.com"},
{id: 2, name: "Facebook", url: "http://facebook.com"},
];
/**
* Routes
*/
App.Router.map(function () {
this.resource('about', {path: '/about'}, function () {
this.route('team', {path: '/team'});
});
this.route('contact');
this.resource('bookmarks', function () {
// this.resource('bookmark', {path:'/:bookmark_id'})
});
this.resource('bookmark', {path: '/bookmarks/:bookmark_id'});
});
/**
*
* Bookmark Route
*/
App.BookmarksRoute = Em.Route.extend({
model: function () {
return App.Bookmarks.find();
}
});
App.BookmarkRoute = Em.Route.extend({
model: function(params){
return App.Bookmarks.find(params.boookmark_id);
}
})
/**
* Controllers
**/
App.BookmarksController = Em.ArrayController.extend();
App.BookmarkController = Em.ObjectController.extend({
description: function () {
return this.get('content.name') + " --- " + this.get('content.url');
}.property('content.name', 'content.url')
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment