cms/app-client/app/controllers/application.js
changeset 200 a441c40f9c5e
parent 198 541e26eb356f
child 202 0446e07981db
equal deleted inserted replaced
199:b7c691c6179d 200:a441c40f9c5e
    54 
    54 
    55     modalItem: Ember.computed('detail', function() {
    55     modalItem: Ember.computed('detail', function() {
    56         return this.store.findRecord('document', this.get('detail'));
    56         return this.store.findRecord('document', this.get('detail'));
    57     }),
    57     }),
    58 
    58 
    59     filteredDocuments: Ember.computed('filter.location', 'filter.langue', 'filter.discours', 'filter.date', 'filter.thematique', 'model', function() {
       
    60         var location = this.get('location');
       
    61         var langue = this.get('langue');
       
    62         var discours = this.get('discours');
       
    63         var date = this.get('date');
       
    64         var thematique = this.get('thematique');
       
    65 
       
    66         var documents = this.get('model');
       
    67 
       
    68         if (location) {
       
    69             documents = documents.filterBy('spatial', location);
       
    70         }
       
    71         if (langue) {
       
    72             documents = documents.filterBy('language', langue);
       
    73         }
       
    74         if (discours) {
       
    75             documents = documents.filterBy('type', discours);
       
    76         }
       
    77         if (date.length > 0) {
       
    78             var temp = documents;
       
    79             documents.map(function(elt){
       
    80                 if (date.indexOf(elt.get('created')) === -1){
       
    81                     temp = temp.without(elt);
       
    82                 }
       
    83             });
       
    84             documents = temp;
       
    85         }
       
    86         if (thematique) {
       
    87             documents = documents.filterBy('thematique', thematique);
       
    88         }
       
    89         return documents;
       
    90     }),
       
    91 
       
    92     actions: {
    59     actions: {
    93 
    60 
    94         deleteTag: function(key, value){
    61         deleteTag: function(key, value){
    95             var newValue = null;
    62             var newValue = null;
    96             if (key === 'date'){
    63             if (key === 'date'){