cms/app-client/app/controllers/application.js
changeset 91 acfeddc7821d
parent 89 89be68e13215
child 94 62984937a062
--- a/cms/app-client/app/controllers/application.js	Wed Jan 20 15:53:27 2016 +0100
+++ b/cms/app-client/app/controllers/application.js	Wed Jan 20 23:05:52 2016 +0100
@@ -10,37 +10,37 @@
   isShowingModal: false,
   currentDetails: null,
   currentItem: {title: "example", master: 'http://www.noiseaddicts.com/samples_1w72b820/3921.mp3'},
-  filteredSounds: Ember.computed('location', 'langue', 'discours', 'date', 'thematique', 'model', function() {
+  filteredDocuments: Ember.computed('location', 'langue', 'discours', 'date', 'thematique', 'model', function() {
     var location = this.get('location');
     var langue = this.get('langue');
     var discours = this.get('discours');
     var date = this.get('date');
     var thematique = this.get('thematique');
 
-    var sounds = this.get('model');
+    var documents = this.get('model');
 
     if (location) {
-      sounds = sounds.filterBy('spatial', location);
+      documents = documents.filterBy('spatial', location);
     }
     if (langue) {
-      sounds = sounds.filterBy('language', langue);
+      documents = documents.filterBy('language', langue);
     }
     if (discours) {
-      sounds = sounds.filterBy('type', discours);
+      documents = documents.filterBy('type', discours);
     }
     if (date.length > 0) {
-      var temp = sounds;
-      sounds.map(function(elt){
+      var temp = documents;
+      documents.map(function(elt){
         if (date.indexOf(elt.get('created')) === -1){
           temp = temp.without(elt);
         }
       });
-      sounds = temp;
+      documents = temp;
     }
     if (thematique) {
-      sounds = sounds.filterBy('thematique', thematique);
+      documents = documents.filterBy('thematique', thematique);
     }
-    return sounds;
+    return documents;
   }),
   currentItemChanged: Ember.observer('currentItem', function() {
     Ember.$(".result-item").toggleClass("playing", false);
@@ -61,15 +61,15 @@
 
       this.set(query, newParams);
     },
-    changeSong: function(songDirection){
-      var direction = (songDirection === "next") ? 1 : -1;
-      var index = this.get("filteredSounds").indexOf(this.get("currentItem"));
+    changeDocument: function(docDirection){
+      var direction = (docDirection === "next") ? 1 : -1;
+      var index = this.get("filteredDocuments").indexOf(this.get("currentItem"));
       if ( index !== -1){
-          if (typeof(this.get("filteredSounds").objectAt(index+direction)) !== 'undefined'){
-            return this.set('currentItem', this.get("filteredSounds").objectAt(index+direction));
+          if (typeof(this.get("filteredDocuments").objectAt(index+direction)) !== 'undefined'){
+            return this.set('currentItem', this.get("filteredDocuments").objectAt(index+direction));
           }
       }
-      return this.set('currentItem', this.get('filteredSounds').get('firstObject'));
+      return this.set('currentItem', this.get('filteredDocuments').get('firstObject'));
     },
     play: function(item){
       this.set("currentItem", item);