cms/app-client/app/controllers/application.js
author nowmad@nowmads-macbook-pro.local
Tue, 15 Dec 2015 17:21:05 +0100
changeset 54 5b2b161dd4ce
parent 51 70dff07a76ff
child 58 6c03fafb6b62
permissions -rw-r--r--
bind chono visu with query parameters

import Ember from 'ember';

export default Ember.Controller.extend({
  queryParams: ['location', 'langue'],
  location: null,
  langue: null,
  filteredSounds: Ember.computed('location', 'langue', 'model', function() {
    var location = this.get('location');
    var langue = this.get('langue');
    var sounds = this.get('model');

    if (location) {
      sounds = sounds.filterBy('location', location);
    }

    if (langue) {
      sounds = sounds.filterBy('language', langue);
    }

    return sounds;
  })
});