-
-
Save thermokarst/b4fc550450ec94091cdce96b2d2b1c81 to your computer and use it in GitHub Desktop.
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
import Ember from 'ember'; | |
export default Ember.Route.extend({ | |
beforeModel() { | |
this.store.push({ | |
data: { | |
type: 'folder', | |
id: 2 | |
} | |
}); | |
}, | |
model() { | |
return this.store.push({ | |
data: { | |
type: 'folder', | |
id: 1, | |
relationships: { | |
parent: { | |
data: { | |
id: 2, | |
type: 'folder' | |
} | |
} | |
} | |
} | |
}); | |
} | |
}); |
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
import Ember from 'ember'; | |
const { resolve } = Ember.RSVP; | |
export default Ember.Mixin.create({ | |
ready() { | |
console.log(`ready ${this}`); | |
var leParent = this.get("parent"); | |
resolve(leParent).then((parent) => { | |
console.log(`parent: ${parent}`); | |
if (parent) { | |
var parentId = parent.get("id"); | |
this.set('parentId', parentId); | |
} | |
}); | |
} | |
}); |
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
import DS from 'ember-data'; | |
import NodeMixin from '../mixins/node'; | |
export default DS.Model.extend(NodeMixin, { | |
name: DS.attr(), | |
parent: DS.belongsTo('folder', { inverse: null, async: true }) | |
}); |
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
{ | |
"version": "0.5.0", | |
"EmberENV": { | |
"FEATURES": {} | |
}, | |
"options": { | |
"enable-testing": false | |
}, | |
"dependencies": { | |
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js", | |
"ember": "2.1.1", | |
"ember-data": "2.5.2", | |
"ember-template-compiler": "2.1.1" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment