Created
June 5, 2018 13:42
-
-
Save ArnaudValensi/5e9b9b766c30eb15e884cc228ea3d251 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'; | |
import SmartViewMixin from 'client/mixins/smart-view-mixin'; | |
export default Ember.Component.extend(SmartViewMixin.default, { | |
router: Ember.inject.service('-routing'), | |
store: Ember.inject.service(), | |
actions: { | |
selectTreatment(patientId) { | |
const treatmentCollection = this.findCollectionByName('treatment'); | |
const treatmentCollectionId = treatmentCollection[0].get('id'); | |
this.get('router').transitionTo( | |
'rendering.data.collection.list.viewEdit.summary.index', | |
[treatmentCollectionId, treatmentCollectionId, patientId] | |
); | |
} | |
}, | |
findCollectionByName(collectionName) { | |
const collections = this.get('store').peekAll('collection'); | |
return collections.filterBy('name', collectionName); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment