auto-reload compare/results model, cleanup
This commit is contained in:
		
							parent
							
								
									8bdc31f99e
								
							
						
					
					
						commit
						cd082ef616
					
				
					 4 changed files with 22 additions and 5 deletions
				
			
		| 
						 | 
					@ -2,7 +2,8 @@
 | 
				
			||||||
  "predef": [
 | 
					  "predef": [
 | 
				
			||||||
    "document",
 | 
					    "document",
 | 
				
			||||||
    "window",
 | 
					    "window",
 | 
				
			||||||
    "-Promise"
 | 
					    "-Promise",
 | 
				
			||||||
 | 
					    "FlakesFrame"
 | 
				
			||||||
  ],
 | 
					  ],
 | 
				
			||||||
  "browser": true,
 | 
					  "browser": true,
 | 
				
			||||||
  "boss": true,
 | 
					  "boss": true,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -8,7 +8,7 @@ export default Ember.Controller.extend({
 | 
				
			||||||
    let strain_ids = this.get('strain_ids').split(',');
 | 
					    let strain_ids = this.get('strain_ids').split(',');
 | 
				
			||||||
    strain_ids.forEach((id) => {
 | 
					    strain_ids.forEach((id) => {
 | 
				
			||||||
      strains.push(this.store.peekRecord('strain', id));
 | 
					      strains.push(this.store.peekRecord('strain', id));
 | 
				
			||||||
    })
 | 
					    });
 | 
				
			||||||
    return strains;
 | 
					    return strains;
 | 
				
			||||||
  }.property('strain_ids'),
 | 
					  }.property('strain_ids'),
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -17,7 +17,7 @@ export default Ember.Controller.extend({
 | 
				
			||||||
    let characteristic_ids = this.get('characteristic_ids').split(',');
 | 
					    let characteristic_ids = this.get('characteristic_ids').split(',');
 | 
				
			||||||
    characteristic_ids.forEach((id) => {
 | 
					    characteristic_ids.forEach((id) => {
 | 
				
			||||||
      characteristics.push(this.store.peekRecord('characteristic', id));
 | 
					      characteristics.push(this.store.peekRecord('characteristic', id));
 | 
				
			||||||
    })
 | 
					    });
 | 
				
			||||||
    return characteristics;
 | 
					    return characteristics;
 | 
				
			||||||
  }.property('characteristic_ids'),
 | 
					  }.property('characteristic_ids'),
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -45,6 +45,6 @@ export default Ember.Controller.extend({
 | 
				
			||||||
      data.pushObject(row);
 | 
					      data.pushObject(row);
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
    return data;
 | 
					    return data;
 | 
				
			||||||
  }.property('characteristics', 'strains'),
 | 
					  }.property('characteristics', 'strains').readOnly(),
 | 
				
			||||||
 | 
					
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,6 +1,22 @@
 | 
				
			||||||
import Ember from 'ember';
 | 
					import Ember from 'ember';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export default Ember.Route.extend({
 | 
					export default Ember.Route.extend({
 | 
				
			||||||
 | 
					  queryParams: {
 | 
				
			||||||
 | 
					    strain_ids: {
 | 
				
			||||||
 | 
					      refreshModel: true,
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
 | 
					    characteristic_ids: {
 | 
				
			||||||
 | 
					      refreshModel: true,
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
 | 
					  },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  beforeModel: function(transition) {
 | 
				
			||||||
 | 
					    this._super(transition);
 | 
				
			||||||
 | 
					    if (Ember.$.isEmptyObject(transition.queryParams)) {
 | 
				
			||||||
 | 
					      this.transitionTo('protected.compare');
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					  },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  model: function(params) {
 | 
					  model: function(params) {
 | 
				
			||||||
    let compare = this.controllerFor('protected.compare');
 | 
					    let compare = this.controllerFor('protected.compare');
 | 
				
			||||||
    compare.set('selectedStrains', params.strain_ids);
 | 
					    compare.set('selectedStrains', params.strain_ids);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -5,7 +5,7 @@ export default Ember.Route.extend({
 | 
				
			||||||
    return this.store.findAll('characteristic');
 | 
					    return this.store.findAll('characteristic');
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  setupController: function(controller, model) {
 | 
					  setupController: function(controller/*, model*/) {
 | 
				
			||||||
    controller.set('characteristics', this.store.peekAll('characteristic'));
 | 
					    controller.set('characteristics', this.store.peekAll('characteristic'));
 | 
				
			||||||
    controller.set('strains', this.store.peekAll('strain'));
 | 
					    controller.set('strains', this.store.peekAll('strain'));
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Reference in a new issue