cms/app-client/app/controllers/application.js
author nowmad@nowmads-macbook-pro.local
Fri, 11 Dec 2015 13:13:47 +0100
changeset 51 70dff07a76ff
child 58 6c03fafb6b62
permissions -rw-r--r--
add click event on visu-carto and visu-langue and update the url with the selected element as filter parameter

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;
  })
});