Created
July 31, 2012 16:57
-
-
Save fractaloop/3218435 to your computer and use it in GitHub Desktop.
ember.js relationship-improvements test
This file contains 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
//= require_tree ./templates | |
(function() { | |
App = Em.Application.create({ | |
rootElement: '#flow' | |
}) | |
App.Flow = DS.Model.extend({ | |
name: DS.attr('string') | |
}) | |
App.Flow.reopenClass({ | |
url: 'awsdemo/flow' | |
}) | |
DS.RESTAdapter.map('App.Flow', { primaryKey: '_id' }) | |
App.store = DS.Store.create({ | |
revision: 4, | |
adapter: DS.RESTAdapter.create() | |
}) | |
App.ApplicationController = Em.Controller.extend({ | |
}) | |
App.ApplicationView = Em.View.extend({ | |
templateName: 'flow/templates/application' | |
}) | |
App.GraphController = Em.Controller.extend({ | |
selectedStage: {_id: "foobar"} | |
}) | |
App.GraphView = Em.View.extend({ | |
templateName: 'flow/templates/graph', | |
}) | |
App.InspectorController = Em.Controller.extend({ | |
selectedStageBinding: 'applicationController.graphController.selectedStage' | |
}) | |
App.InspectorView = Em.View.extend({ | |
templateName: 'flow/templates/inspector' | |
}) | |
App.Router = Em.Router.extend({ | |
enableLogging: true, | |
location: 'history', | |
root: Em.Route.create({ | |
// STATES | |
index: Em.Route.extend({ | |
route: '/' | |
}), | |
organization: Em.Route.extend({ | |
route: '/:organization_id', | |
flows: Em.Route.extend({ | |
route: '/flows', | |
index: Em.Route.extend({ | |
route: '/' | |
}), | |
show: Em.Route.extend({ | |
route: '/:flow_id', | |
modelType: 'App.Flow', | |
connectOutlets: function(router, flow) { | |
var appController = router.get('applicationController'), | |
graphController = router.get('graphController'), | |
inspectorController = router.get('inspectorController') | |
appController.set('flow', flow) | |
router.get('applicationController').set('inspectorView', App.InspectorView.create()) | |
} | |
}) | |
}) | |
}) | |
}) | |
}) | |
App.initialize(); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment