Skip to content

Instantly share code, notes, and snippets.

View alexspeller's full-sized avatar
🏁

Alex Speller alexspeller

🏁
View GitHub Profile
// Last commit: 1aaa729 (2013-03-12 14:44:55 +0000)
(function() {
window.DS = Ember.Namespace.create({
// this one goes past 11
CURRENT_API_REVISION: 12
});
})();
// Messages and detail routes are rendered inside the thing template.
// The thing template should have an {{outlet}} where the sub-routes should be rendered
App.Router.map(function(){
this.resource('thing', {path: 'things/:thing_id'}, function() {
this.resource('messages');
this.resource('detail');
});
});
@alexspeller
alexspeller / foo.js
Last active December 18, 2015 07:09
// This is the presenter class that stores the state
App.FooPresenter = Em.ObjectProxy.create({
textAreaContent: '',
isExpanded: false
});
// This is your controller - be sure to set the content to a list of models in your route
App.FoosController = Em.ArrayController.extend({
presenters: function() {
// Last commit: 3599f08 (2013-06-15 22:24:44 +0100)
(function() {
Ember.Adapter = Ember.Object.extend({
find: function(record, id) {
throw new Error('Ember.Adapter subclasses must implement find');
},
findQuery: function(klass, records, params) {
// Last commit: 3599f08 (2013-06-15 22:24:44 +0100)
(function() {
Ember.Adapter = Ember.Object.extend({
find: function(record, id) {
throw new Error('Ember.Adapter subclasses must implement find');
},
findQuery: function(klass, records, params) {
// Last commit: 0820cae (2013-06-14 08:39:23 -0700)
(function() {
Ember.Adapter = Ember.Object.extend({
find: function(record, id) {
throw new Error('Ember.Adapter subclasses must implement find');
},
findQuery: function(klass, records, params) {
App.SVGView = Em.View.extend({
didInsertElement: function() {
this.render();
},
redrawObserver: function() {
this.render();
}.property('data1', 'data2'),
render: function() {
App.BarChartView = Em.View.extend({
didInsertElement: function() {
var el = d3.select('#' + this.elementID);
el.select('rect').data(this.get('values')).enter().append('rect');
}
});
//template
Library.BooksNewController = Ember.ObjectController.extend
save: ->
@get('model').save().then =>
@transitionToRoute('books.book', @get('model'))
console.log 'here'
Ember.Model.reopenClass
adapter: MyApp.RESTAdapter.create()
camelizeKeys: true
rootKey: (->
@toString().split('.').get('lastObject').underscore()
).property()
collectionKey: (->
Em.get(@, 'rootKey') + 's'