Last active
August 29, 2015 14:00
-
-
Save scottmessinger/11187340 to your computer and use it in GitHub Desktop.
Flow
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
var DatesController = Ember.ArrayController.extend({ | |
init: function(){ | |
this._super() | |
this._loadDates() | |
}, | |
_loadDates: function(){ | |
var range = this._getRange(); // returns array of dates ["2014-02-02", "2014-02-03"] | |
var content = range.map(this._createDateController, this) | |
this.pushObjects(content) | |
}, | |
_createDateController: function(date){ | |
return this.container.lookupFactory('controller:date').create({date: date}) | |
}, | |
}) | |
export default DatesController |
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
var DateController = Ember.Controller.extend({ | |
needs: ['dates', 'planbook'], | |
planbookDate: function(){ | |
var id = this.get('controllers.planbook.content.id') + ":" + this.get('date') | |
return this.store.modelFor('planbookDate').find(id) | |
}.property('content.date', 'controllers.planbook') | |
}) | |
export default DateController | |
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
var PlanbookDate = Ember.Model.extend({ | |
routine: Ember.belongsTo('routine', {key: 'routineId'}), | |
}) | |
export default PlanbookDate; |
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
var Routine = Ember.Model.extend({ | |
parts: Ember.hasMany('part', {embedded: true, key: 'parts'}), | |
}) | |
export default Routine; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment