Skip to content

Instantly share code, notes, and snippets.

@simpleshadow
Last active December 17, 2015 10:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save simpleshadow/5595940 to your computer and use it in GitHub Desktop.
Save simpleshadow/5595940 to your computer and use it in GitHub Desktop.
Fixtures no workie. :'(
/*jshint expr: true, curly: false, unused: false, browser: true*/
/*global $, Ember, iScroll, ExpandScroll*/
'use strict';
var App = Ember.Application.create({
LOG_TRANSITIONS: true,
ready: function () {}
});
App.Router.map(function() {
this.resource('welcome');
this.resource('login');
this.resource('register');
this.resource('conversations', function () {
this.resource('conversation', { path: ':conversation_id' }, function () {
this.resource('capture', { path: ':capture_id' }, function () {});
});
});
this.resource('camera');
this.resource('friends', function () {
this.resource('friend', { path: ':friend_id' }, function () {});
});
this.resource('settings', function () {
this.resource('profile-pic', { path: 'profile-pic' }, function () {});
this.resource('notifications', { path: 'notifications' }, function () {});
this.resource('networks', { path: 'networks' }, function () {});
});
this.resource('invite');
});
App.IndexRoute = Ember.Route.extend({
redirect: function () {
this.transitionTo('conversations');
}
});
App.ConversationsRoute = Ember.Route.extend({
model: function () {
return App.Conversation.find()
}
});
App.Adapter = DS.FixtureAdapter.extend();
App.Adapter.map('App.Conversation', {
messages: { embedded: 'always' }
});
App.Adapter.map('App.Message', {
captures: { embedded: 'always' }
});
App.Store = DS.Store.extend({
revision: 12,
adapter: App.Adapter.create()
});
App.Conversation = DS.Model.extend({
messages: DS.hasMany('App.Message')
});
App.Message = DS.Model.extend({
conversation: DS.belongsTo('App.Conversation'),
captures: DS.hasMany('App.Capture'),
user: DS.belongsTo('App.User'),
text: DS.attr('string')
});
App.Capture = DS.Model.extend({
message: DS.belongsTo('App.Message'),
type: DS.attr('string'),
src: DS.attr('string'),
date: DS.attr('date')
});
App.User = DS.Model.extend({
username: DS.attr('string'),
name: DS.attr('string'),
messages: DS.hasMany('App.Conversation')
});
App.Friend = DS.Model.extend({
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment