cms/app-client/app/controllers/application.js
changeset 61 bbc8a582fcc3
parent 58 6c03fafb6b62
child 72 9a7ea5349882
equal deleted inserted replaced
60:9cf73ae600c0 61:bbc8a582fcc3
     5   location: null,
     5   location: null,
     6   langue: null,
     6   langue: null,
     7   discours: null,
     7   discours: null,
     8   date: null,
     8   date: null,
     9   thematique: null,
     9   thematique: null,
       
    10   currentItem: {title: "example", master: 'http://www.noiseaddicts.com/samples_1w72b820/3921.mp3'},
    10   filteredSounds: Ember.computed('location', 'langue', 'discours', 'date', 'thematique', 'model', function() {
    11   filteredSounds: Ember.computed('location', 'langue', 'discours', 'date', 'thematique', 'model', function() {
    11     var location = this.get('location');
    12     var location = this.get('location');
    12     var langue = this.get('langue');
    13     var langue = this.get('langue');
    13     var discours = this.get('discours');
    14     var discours = this.get('discours');
    14     var date = this.get('date');
    15     var date = this.get('date');
    15     // var thematique = this.get('thematique');
    16     // var thematique = this.get('thematique');
    16 
    17 
    17     var sounds = this.get('model');
    18     var sounds = this.get('model');
       
    19     console.log("sounds filtered ? ", sounds);
    18 
    20 
    19     if (location) {
    21     if (location) {
    20       sounds = sounds.filterBy('spatial', location);
    22       sounds = sounds.filterBy('spatial', location);
    21     }
    23     }
    22     if (langue) {
    24     if (langue) {
    32     //   sounds = sounds.filterBy('thematique', thematique);
    34     //   sounds = sounds.filterBy('thematique', thematique);
    33     // }
    35     // }
    34 
    36 
    35     return sounds;
    37     return sounds;
    36   }),
    38   }),
    37   model(params){
       
    38     return this.store.query('sound', params);
       
    39   },
       
    40   actions: {
    39   actions: {
    41     deleteTag: function(query){
    40     deleteTag: function(query){
    42       var queryParams = {};
    41       var queryParams = {};
    43       queryParams[query]  = null;
    42       queryParams[query]  = null;
    44       this.transitionToRoute({queryParams: queryParams});
    43       this.transitionToRoute({queryParams: queryParams});
       
    44     },
       
    45     play: function(item){
       
    46       this.set("currentItem", item);
       
    47       $("#audio-player").load();
       
    48       $(".result-item").toggleClass("playing", false);
       
    49       $("#"+item.id).toggleClass("playing", true);
       
    50     },
       
    51     details: function(item){
       
    52       if ($("#"+item.id).hasClass("details")){
       
    53           $("#"+item.id).toggleClass("details", false);
       
    54       } else{
       
    55         $(".result-item").toggleClass("details", false);
       
    56         $("#"+item.id).toggleClass("details", true);
       
    57       }
    45     }
    58     }
    46   }
    59   }
    47 });
    60 });