This repository has been archived on 2025-03-30. You can view files and clone it, but cannot push or open issues or pull requests.
hymenobacterdotinfo/app/pods/measurements/route.js
2015-06-12 15:30:05 -08:00

31 lines
1,006 B
JavaScript

import Ember from 'ember';
import AuthenticatedRouteMixin from 'simple-auth/mixins/authenticated-route-mixin';
export default Ember.Route.extend(AuthenticatedRouteMixin, {
model: function() {
return Ember.RSVP.hash({
species: this.store.findAll('species'), // need this bc async
strains: this.store.findAll('strain'),
characteristics: this.store.findAll('characteristic'),
});
},
setupController: function(controller, models) {
// Set up search parameters
let selects = [
{ model: 'strains', id: 'id', text: 'fullName' },
{ model: 'characteristics', id: 'id', text: 'characteristicName' },
];
selects.forEach((item, index, enumerable) => {
models[item.model] = models[item.model].sortBy(item.text);
let temp = models[item.model].map((data) => {
return Ember.Object.create({
id: data.get(item.id),
text: data.get(item.text),
});
});
controller.set(item.model, temp);
});
},
});