cms/app-client/app/controllers/application.js
author ymh <ymh.work@gmail.com>
Wed, 05 Oct 2016 02:31:25 +0200
changeset 321 aefaad270b9b
parent 254 a7cf2887e993
child 329 0a2c2ad49d75
permissions -rw-r--r--
reimplement ThemeController using ES requests to be able to sort by label
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
51
70dff07a76ff add click event on visu-carto and visu-langue and update the url with the selected element as filter parameter
nowmad@nowmads-macbook-pro.local
parents:
diff changeset
     1
import Ember from 'ember';
70dff07a76ff add click event on visu-carto and visu-langue and update the url with the selected element as filter parameter
nowmad@nowmads-macbook-pro.local
parents:
diff changeset
     2
70dff07a76ff add click event on visu-carto and visu-langue and update the url with the selected element as filter parameter
nowmad@nowmads-macbook-pro.local
parents:
diff changeset
     3
export default Ember.Controller.extend({
94
62984937a062 - add params when modal appear so we can come back right on this document modal
nowmad@23.1.168.192.in-addr.arpa
parents: 91
diff changeset
     4
254
a7cf2887e993 Hide/Show video CSS
Chloe Laisne <chloe.laisne@gmail.com>
parents: 253
diff changeset
     5
    player: Ember.inject.service(),
a7cf2887e993 Hide/Show video CSS
Chloe Laisne <chloe.laisne@gmail.com>
parents: 253
diff changeset
     6
a7cf2887e993 Hide/Show video CSS
Chloe Laisne <chloe.laisne@gmail.com>
parents: 253
diff changeset
     7
    playerVideoscreenObserver: Ember.observer('player.videoscreen', function() {
a7cf2887e993 Hide/Show video CSS
Chloe Laisne <chloe.laisne@gmail.com>
parents: 253
diff changeset
     8
        Ember.$('body').toggleClass('videoscreen', this.get('player').get('videoscreen'));
a7cf2887e993 Hide/Show video CSS
Chloe Laisne <chloe.laisne@gmail.com>
parents: 253
diff changeset
     9
    }),
a7cf2887e993 Hide/Show video CSS
Chloe Laisne <chloe.laisne@gmail.com>
parents: 253
diff changeset
    10
227
5c9250f55f4b Basic notice logic from query parameters
Chloe Laisne <chloe.laisne@gmail.com>
parents: 224
diff changeset
    11
    queryParams: ['location', 'date', 'notice', {
197
7b266ccf6d3d Setup filter service
Chloe Laisne <chloe.laisne@gmail.com>
parents: 196
diff changeset
    12
        language: 'langue',
7b266ccf6d3d Setup filter service
Chloe Laisne <chloe.laisne@gmail.com>
parents: 196
diff changeset
    13
        discourse: 'discours',
7b266ccf6d3d Setup filter service
Chloe Laisne <chloe.laisne@gmail.com>
parents: 196
diff changeset
    14
        theme: 'thematique'
7b266ccf6d3d Setup filter service
Chloe Laisne <chloe.laisne@gmail.com>
parents: 196
diff changeset
    15
    }],
196
7550cb541901 Filter as a service
Chloe Laisne <chloe.laisne@gmail.com>
parents: 194
diff changeset
    16
7550cb541901 Filter as a service
Chloe Laisne <chloe.laisne@gmail.com>
parents: 194
diff changeset
    17
    date: [],
197
7b266ccf6d3d Setup filter service
Chloe Laisne <chloe.laisne@gmail.com>
parents: 196
diff changeset
    18
    discourse: null,
7b266ccf6d3d Setup filter service
Chloe Laisne <chloe.laisne@gmail.com>
parents: 196
diff changeset
    19
    language: null,
7b266ccf6d3d Setup filter service
Chloe Laisne <chloe.laisne@gmail.com>
parents: 196
diff changeset
    20
    location: null,
7b266ccf6d3d Setup filter service
Chloe Laisne <chloe.laisne@gmail.com>
parents: 196
diff changeset
    21
    theme: null,
7b266ccf6d3d Setup filter service
Chloe Laisne <chloe.laisne@gmail.com>
parents: 196
diff changeset
    22
198
541e26eb356f Display filter IDs
Chloe Laisne <chloe.laisne@gmail.com>
parents: 197
diff changeset
    23
    filter: Ember.inject.service(),
203
2ee21302dc47 Set application date property and filter date property observer
Chloe Laisne <chloe.laisne@gmail.com>
parents: 202
diff changeset
    24
    setFilter: Ember.observer('discourse', 'language', 'location', 'theme', function(sender, key) {
197
7b266ccf6d3d Setup filter service
Chloe Laisne <chloe.laisne@gmail.com>
parents: 196
diff changeset
    25
        this.get('filter').set(key, this.get(key));
196
7550cb541901 Filter as a service
Chloe Laisne <chloe.laisne@gmail.com>
parents: 194
diff changeset
    26
    }),
203
2ee21302dc47 Set application date property and filter date property observer
Chloe Laisne <chloe.laisne@gmail.com>
parents: 202
diff changeset
    27
    filterObserver: Ember.observer('filter.discourse', 'filter.language', 'filter.location', 'filter.theme', function(sender, key) {
197
7b266ccf6d3d Setup filter service
Chloe Laisne <chloe.laisne@gmail.com>
parents: 196
diff changeset
    28
        key = key.split('.').pop();
7b266ccf6d3d Setup filter service
Chloe Laisne <chloe.laisne@gmail.com>
parents: 196
diff changeset
    29
        this.set(key, this.get('filter').get(key));
196
7550cb541901 Filter as a service
Chloe Laisne <chloe.laisne@gmail.com>
parents: 194
diff changeset
    30
    }),
7550cb541901 Filter as a service
Chloe Laisne <chloe.laisne@gmail.com>
parents: 194
diff changeset
    31
203
2ee21302dc47 Set application date property and filter date property observer
Chloe Laisne <chloe.laisne@gmail.com>
parents: 202
diff changeset
    32
    setDateFilter: Ember.observer('date', function(sender, key) {
190
226ae8f2e8e9 JSLinting on /langues endpoint
Chloe Laisne <chloe.laisne@gmail.com>
parents: 189
diff changeset
    33
        var intervals = [];
203
2ee21302dc47 Set application date property and filter date property observer
Chloe Laisne <chloe.laisne@gmail.com>
parents: 202
diff changeset
    34
        this.get(key).forEach(function(interval) {
204
dd969e178944 Fix linting, remove logs and dead code
Chloe Laisne <chloe.laisne@gmail.com>
parents: 203
diff changeset
    35
            interval = interval.split('-');
203
2ee21302dc47 Set application date property and filter date property observer
Chloe Laisne <chloe.laisne@gmail.com>
parents: 202
diff changeset
    36
            if(interval.length > 1) {
2ee21302dc47 Set application date property and filter date property observer
Chloe Laisne <chloe.laisne@gmail.com>
parents: 202
diff changeset
    37
                var array = [];
2ee21302dc47 Set application date property and filter date property observer
Chloe Laisne <chloe.laisne@gmail.com>
parents: 202
diff changeset
    38
                for(var i = interval[0]; i <= interval[1]; i++) {
2ee21302dc47 Set application date property and filter date property observer
Chloe Laisne <chloe.laisne@gmail.com>
parents: 202
diff changeset
    39
                    array.push(parseInt(i));
2ee21302dc47 Set application date property and filter date property observer
Chloe Laisne <chloe.laisne@gmail.com>
parents: 202
diff changeset
    40
                }
2ee21302dc47 Set application date property and filter date property observer
Chloe Laisne <chloe.laisne@gmail.com>
parents: 202
diff changeset
    41
                interval = array;
2ee21302dc47 Set application date property and filter date property observer
Chloe Laisne <chloe.laisne@gmail.com>
parents: 202
diff changeset
    42
            } else {
2ee21302dc47 Set application date property and filter date property observer
Chloe Laisne <chloe.laisne@gmail.com>
parents: 202
diff changeset
    43
                interval = parseInt(interval);
2ee21302dc47 Set application date property and filter date property observer
Chloe Laisne <chloe.laisne@gmail.com>
parents: 202
diff changeset
    44
            }
2ee21302dc47 Set application date property and filter date property observer
Chloe Laisne <chloe.laisne@gmail.com>
parents: 202
diff changeset
    45
            intervals = intervals.concat(interval);
2ee21302dc47 Set application date property and filter date property observer
Chloe Laisne <chloe.laisne@gmail.com>
parents: 202
diff changeset
    46
        });
2ee21302dc47 Set application date property and filter date property observer
Chloe Laisne <chloe.laisne@gmail.com>
parents: 202
diff changeset
    47
        this.get('filter').set(key, intervals);
2ee21302dc47 Set application date property and filter date property observer
Chloe Laisne <chloe.laisne@gmail.com>
parents: 202
diff changeset
    48
    }),
2ee21302dc47 Set application date property and filter date property observer
Chloe Laisne <chloe.laisne@gmail.com>
parents: 202
diff changeset
    49
    dateFilterObserver: Ember.observer('filter.date', function(sender, key) {
2ee21302dc47 Set application date property and filter date property observer
Chloe Laisne <chloe.laisne@gmail.com>
parents: 202
diff changeset
    50
        key = key.split('.').pop();
2ee21302dc47 Set application date property and filter date property observer
Chloe Laisne <chloe.laisne@gmail.com>
parents: 202
diff changeset
    51
        var intervals = [];
233
0ff47a9c5da2 Keyboard events on chronology
Chloe Laisne <chloe.laisne@gmail.com>
parents: 228
diff changeset
    52
        this.get('filter').get('date').forEach(function(date) {
203
2ee21302dc47 Set application date property and filter date property observer
Chloe Laisne <chloe.laisne@gmail.com>
parents: 202
diff changeset
    53
            var isInterval = false;
190
226ae8f2e8e9 JSLinting on /langues endpoint
Chloe Laisne <chloe.laisne@gmail.com>
parents: 189
diff changeset
    54
            intervals.forEach(function(interval) {
226ae8f2e8e9 JSLinting on /langues endpoint
Chloe Laisne <chloe.laisne@gmail.com>
parents: 189
diff changeset
    55
                if(interval.length && (interval.includes(date + 1) || interval.includes(date - 1))) {
226ae8f2e8e9 JSLinting on /langues endpoint
Chloe Laisne <chloe.laisne@gmail.com>
parents: 189
diff changeset
    56
                    interval.push(date);
203
2ee21302dc47 Set application date property and filter date property observer
Chloe Laisne <chloe.laisne@gmail.com>
parents: 202
diff changeset
    57
                    isInterval = true;
190
226ae8f2e8e9 JSLinting on /langues endpoint
Chloe Laisne <chloe.laisne@gmail.com>
parents: 189
diff changeset
    58
                }
226ae8f2e8e9 JSLinting on /langues endpoint
Chloe Laisne <chloe.laisne@gmail.com>
parents: 189
diff changeset
    59
            });
203
2ee21302dc47 Set application date property and filter date property observer
Chloe Laisne <chloe.laisne@gmail.com>
parents: 202
diff changeset
    60
            if (!isInterval) {
190
226ae8f2e8e9 JSLinting on /langues endpoint
Chloe Laisne <chloe.laisne@gmail.com>
parents: 189
diff changeset
    61
                intervals.push([date]);
226ae8f2e8e9 JSLinting on /langues endpoint
Chloe Laisne <chloe.laisne@gmail.com>
parents: 189
diff changeset
    62
            }
226ae8f2e8e9 JSLinting on /langues endpoint
Chloe Laisne <chloe.laisne@gmail.com>
parents: 189
diff changeset
    63
        });
203
2ee21302dc47 Set application date property and filter date property observer
Chloe Laisne <chloe.laisne@gmail.com>
parents: 202
diff changeset
    64
        intervals.forEach(function(interval, index) {
2ee21302dc47 Set application date property and filter date property observer
Chloe Laisne <chloe.laisne@gmail.com>
parents: 202
diff changeset
    65
            if(interval.length > 1) {
204
dd969e178944 Fix linting, remove logs and dead code
Chloe Laisne <chloe.laisne@gmail.com>
parents: 203
diff changeset
    66
               intervals[index] =  interval.shift() + '-' + interval.pop();
203
2ee21302dc47 Set application date property and filter date property observer
Chloe Laisne <chloe.laisne@gmail.com>
parents: 202
diff changeset
    67
            } else {
2ee21302dc47 Set application date property and filter date property observer
Chloe Laisne <chloe.laisne@gmail.com>
parents: 202
diff changeset
    68
               intervals[index] =  interval.toString();
2ee21302dc47 Set application date property and filter date property observer
Chloe Laisne <chloe.laisne@gmail.com>
parents: 202
diff changeset
    69
            }
2ee21302dc47 Set application date property and filter date property observer
Chloe Laisne <chloe.laisne@gmail.com>
parents: 202
diff changeset
    70
        });
233
0ff47a9c5da2 Keyboard events on chronology
Chloe Laisne <chloe.laisne@gmail.com>
parents: 228
diff changeset
    71
        if(!this.arraysEqual(this.get('date').toArray(), intervals)) {
321
aefaad270b9b reimplement ThemeController using ES requests to be able to sort by label
ymh <ymh.work@gmail.com>
parents: 254
diff changeset
    72
            this.set('date', intervals);
203
2ee21302dc47 Set application date property and filter date property observer
Chloe Laisne <chloe.laisne@gmail.com>
parents: 202
diff changeset
    73
        }
190
226ae8f2e8e9 JSLinting on /langues endpoint
Chloe Laisne <chloe.laisne@gmail.com>
parents: 189
diff changeset
    74
    }),
189
21b30ee23191 /langue endpoint: 1. Date interval 2. Delete date
Chloe Laisne <chloe.laisne@gmail.com>
parents: 126
diff changeset
    75
203
2ee21302dc47 Set application date property and filter date property observer
Chloe Laisne <chloe.laisne@gmail.com>
parents: 202
diff changeset
    76
    arraysEqual: function(a, b) {
2ee21302dc47 Set application date property and filter date property observer
Chloe Laisne <chloe.laisne@gmail.com>
parents: 202
diff changeset
    77
        if (a === b) {
2ee21302dc47 Set application date property and filter date property observer
Chloe Laisne <chloe.laisne@gmail.com>
parents: 202
diff changeset
    78
            return true;
2ee21302dc47 Set application date property and filter date property observer
Chloe Laisne <chloe.laisne@gmail.com>
parents: 202
diff changeset
    79
        }
2ee21302dc47 Set application date property and filter date property observer
Chloe Laisne <chloe.laisne@gmail.com>
parents: 202
diff changeset
    80
        if (a == null || b == null) {
2ee21302dc47 Set application date property and filter date property observer
Chloe Laisne <chloe.laisne@gmail.com>
parents: 202
diff changeset
    81
            return false;
2ee21302dc47 Set application date property and filter date property observer
Chloe Laisne <chloe.laisne@gmail.com>
parents: 202
diff changeset
    82
        }
204
dd969e178944 Fix linting, remove logs and dead code
Chloe Laisne <chloe.laisne@gmail.com>
parents: 203
diff changeset
    83
        if (a.length !== b.length) {
203
2ee21302dc47 Set application date property and filter date property observer
Chloe Laisne <chloe.laisne@gmail.com>
parents: 202
diff changeset
    84
            return false;
2ee21302dc47 Set application date property and filter date property observer
Chloe Laisne <chloe.laisne@gmail.com>
parents: 202
diff changeset
    85
        }
2ee21302dc47 Set application date property and filter date property observer
Chloe Laisne <chloe.laisne@gmail.com>
parents: 202
diff changeset
    86
        for(var i = 0; i < a.length; ++i) {
2ee21302dc47 Set application date property and filter date property observer
Chloe Laisne <chloe.laisne@gmail.com>
parents: 202
diff changeset
    87
            if(a[i] !== b[i]) {
2ee21302dc47 Set application date property and filter date property observer
Chloe Laisne <chloe.laisne@gmail.com>
parents: 202
diff changeset
    88
                return false;
2ee21302dc47 Set application date property and filter date property observer
Chloe Laisne <chloe.laisne@gmail.com>
parents: 202
diff changeset
    89
            }
2ee21302dc47 Set application date property and filter date property observer
Chloe Laisne <chloe.laisne@gmail.com>
parents: 202
diff changeset
    90
        }
2ee21302dc47 Set application date property and filter date property observer
Chloe Laisne <chloe.laisne@gmail.com>
parents: 202
diff changeset
    91
        return true;
2ee21302dc47 Set application date property and filter date property observer
Chloe Laisne <chloe.laisne@gmail.com>
parents: 202
diff changeset
    92
    },
2ee21302dc47 Set application date property and filter date property observer
Chloe Laisne <chloe.laisne@gmail.com>
parents: 202
diff changeset
    93
321
aefaad270b9b reimplement ThemeController using ES requests to be able to sort by label
ymh <ymh.work@gmail.com>
parents: 254
diff changeset
    94
209
35cb7200bb0a Separate playlist and player component with player service as bridge
Chloe Laisne <chloe.laisne@gmail.com>
parents: 204
diff changeset
    95
228
a2497a2b6224 Notice display logic and design
Chloe Laisne <chloe.laisne@gmail.com>
parents: 227
diff changeset
    96
    itemObserver: Ember.observer('player.item', function() {
209
35cb7200bb0a Separate playlist and player component with player service as bridge
Chloe Laisne <chloe.laisne@gmail.com>
parents: 204
diff changeset
    97
        var self = this;
228
a2497a2b6224 Notice display logic and design
Chloe Laisne <chloe.laisne@gmail.com>
parents: 227
diff changeset
    98
        this.store.findRecord('document', this.get('player').get('item'), { reload: true }).then(function(model){
a2497a2b6224 Notice display logic and design
Chloe Laisne <chloe.laisne@gmail.com>
parents: 227
diff changeset
    99
            self.get('player').set('model', model);
253
0be9770b09b4 Hide/show transcript button in the player - Do not request transscript when property is null in the document request
Chloe Laisne <chloe.laisne@gmail.com>
parents: 245
diff changeset
   100
            if (self.get('player').get('model').get('transcript')) {
321
aefaad270b9b reimplement ThemeController using ES requests to be able to sort by label
ymh <ymh.work@gmail.com>
parents: 254
diff changeset
   101
                self.store.findRecord('transcript', self.get('player').get('item')).then(function(model) {
253
0be9770b09b4 Hide/show transcript button in the player - Do not request transscript when property is null in the document request
Chloe Laisne <chloe.laisne@gmail.com>
parents: 245
diff changeset
   102
                    self.get('player').set('transcript', model);
0be9770b09b4 Hide/show transcript button in the player - Do not request transscript when property is null in the document request
Chloe Laisne <chloe.laisne@gmail.com>
parents: 245
diff changeset
   103
                });
0be9770b09b4 Hide/show transcript button in the player - Do not request transscript when property is null in the document request
Chloe Laisne <chloe.laisne@gmail.com>
parents: 245
diff changeset
   104
            } else {
0be9770b09b4 Hide/show transcript button in the player - Do not request transscript when property is null in the document request
Chloe Laisne <chloe.laisne@gmail.com>
parents: 245
diff changeset
   105
                self.get('player').set('transcript', null);
0be9770b09b4 Hide/show transcript button in the player - Do not request transscript when property is null in the document request
Chloe Laisne <chloe.laisne@gmail.com>
parents: 245
diff changeset
   106
            }
245
c9dd78a43b07 Transcript model and erializer
Chloe Laisne <chloe.laisne@gmail.com>
parents: 233
diff changeset
   107
        });
209
35cb7200bb0a Separate playlist and player component with player service as bridge
Chloe Laisne <chloe.laisne@gmail.com>
parents: 204
diff changeset
   108
    }),
35cb7200bb0a Separate playlist and player component with player service as bridge
Chloe Laisne <chloe.laisne@gmail.com>
parents: 204
diff changeset
   109
228
a2497a2b6224 Notice display logic and design
Chloe Laisne <chloe.laisne@gmail.com>
parents: 227
diff changeset
   110
    notice: null,
a2497a2b6224 Notice display logic and design
Chloe Laisne <chloe.laisne@gmail.com>
parents: 227
diff changeset
   111
    noticeModel: null,
a2497a2b6224 Notice display logic and design
Chloe Laisne <chloe.laisne@gmail.com>
parents: 227
diff changeset
   112
a2497a2b6224 Notice display logic and design
Chloe Laisne <chloe.laisne@gmail.com>
parents: 227
diff changeset
   113
    noticeObserver: Ember.observer('notice', function() {
a2497a2b6224 Notice display logic and design
Chloe Laisne <chloe.laisne@gmail.com>
parents: 227
diff changeset
   114
        var self = this;
a2497a2b6224 Notice display logic and design
Chloe Laisne <chloe.laisne@gmail.com>
parents: 227
diff changeset
   115
        if (this.get('notice')) {
a2497a2b6224 Notice display logic and design
Chloe Laisne <chloe.laisne@gmail.com>
parents: 227
diff changeset
   116
            this.store.findRecord('document', this.get('notice'), { reload: true }).then(function(model){
a2497a2b6224 Notice display logic and design
Chloe Laisne <chloe.laisne@gmail.com>
parents: 227
diff changeset
   117
                self.set('noticeModel', model);
a2497a2b6224 Notice display logic and design
Chloe Laisne <chloe.laisne@gmail.com>
parents: 227
diff changeset
   118
            });
a2497a2b6224 Notice display logic and design
Chloe Laisne <chloe.laisne@gmail.com>
parents: 227
diff changeset
   119
        }
a2497a2b6224 Notice display logic and design
Chloe Laisne <chloe.laisne@gmail.com>
parents: 227
diff changeset
   120
    }),
a2497a2b6224 Notice display logic and design
Chloe Laisne <chloe.laisne@gmail.com>
parents: 227
diff changeset
   121
    noticeModelObserver: Ember.observer('noticeModel', function() {
a2497a2b6224 Notice display logic and design
Chloe Laisne <chloe.laisne@gmail.com>
parents: 227
diff changeset
   122
        if (!this.get('noticeModel')) {
321
aefaad270b9b reimplement ThemeController using ES requests to be able to sort by label
ymh <ymh.work@gmail.com>
parents: 254
diff changeset
   123
            this.set('notice', null);
228
a2497a2b6224 Notice display logic and design
Chloe Laisne <chloe.laisne@gmail.com>
parents: 227
diff changeset
   124
        }
a2497a2b6224 Notice display logic and design
Chloe Laisne <chloe.laisne@gmail.com>
parents: 227
diff changeset
   125
    }),
a2497a2b6224 Notice display logic and design
Chloe Laisne <chloe.laisne@gmail.com>
parents: 227
diff changeset
   126
209
35cb7200bb0a Separate playlist and player component with player service as bridge
Chloe Laisne <chloe.laisne@gmail.com>
parents: 204
diff changeset
   127
    init: function() {
35cb7200bb0a Separate playlist and player component with player service as bridge
Chloe Laisne <chloe.laisne@gmail.com>
parents: 204
diff changeset
   128
        this._super(...arguments);
35cb7200bb0a Separate playlist and player component with player service as bridge
Chloe Laisne <chloe.laisne@gmail.com>
parents: 204
diff changeset
   129
        this.get('player');
35cb7200bb0a Separate playlist and player component with player service as bridge
Chloe Laisne <chloe.laisne@gmail.com>
parents: 204
diff changeset
   130
    },
35cb7200bb0a Separate playlist and player component with player service as bridge
Chloe Laisne <chloe.laisne@gmail.com>
parents: 204
diff changeset
   131
190
226ae8f2e8e9 JSLinting on /langues endpoint
Chloe Laisne <chloe.laisne@gmail.com>
parents: 189
diff changeset
   132
    actions: {
58
6c03fafb6b62 Add missing filters to the application controller
nowmad@nowmads-macbook-pro.local
parents: 51
diff changeset
   133
190
226ae8f2e8e9 JSLinting on /langues endpoint
Chloe Laisne <chloe.laisne@gmail.com>
parents: 189
diff changeset
   134
        changeDocument: function(docDirection){
226ae8f2e8e9 JSLinting on /langues endpoint
Chloe Laisne <chloe.laisne@gmail.com>
parents: 189
diff changeset
   135
            var direction = (docDirection === "next") ? 1 : -1;
226ae8f2e8e9 JSLinting on /langues endpoint
Chloe Laisne <chloe.laisne@gmail.com>
parents: 189
diff changeset
   136
            var currentObject = this.get("filteredDocuments").findBy('id', this.get("currentItem").get('id'));
226ae8f2e8e9 JSLinting on /langues endpoint
Chloe Laisne <chloe.laisne@gmail.com>
parents: 189
diff changeset
   137
            if ( currentObject !== 'undefined'){
226ae8f2e8e9 JSLinting on /langues endpoint
Chloe Laisne <chloe.laisne@gmail.com>
parents: 189
diff changeset
   138
                var index = this.get("filteredDocuments").indexOf(currentObject);
226ae8f2e8e9 JSLinting on /langues endpoint
Chloe Laisne <chloe.laisne@gmail.com>
parents: 189
diff changeset
   139
                if ( typeof(this.get("filteredDocuments").objectAt(index+direction)) !== 'undefined'){
226ae8f2e8e9 JSLinting on /langues endpoint
Chloe Laisne <chloe.laisne@gmail.com>
parents: 189
diff changeset
   140
                    return this.set('currentId', this.get("filteredDocuments").objectAt(index+direction).id);
226ae8f2e8e9 JSLinting on /langues endpoint
Chloe Laisne <chloe.laisne@gmail.com>
parents: 189
diff changeset
   141
                }
226ae8f2e8e9 JSLinting on /langues endpoint
Chloe Laisne <chloe.laisne@gmail.com>
parents: 189
diff changeset
   142
            }
226ae8f2e8e9 JSLinting on /langues endpoint
Chloe Laisne <chloe.laisne@gmail.com>
parents: 189
diff changeset
   143
            return this.set('currentId', this.get('filteredDocuments').get('firstObject').id);
226ae8f2e8e9 JSLinting on /langues endpoint
Chloe Laisne <chloe.laisne@gmail.com>
parents: 189
diff changeset
   144
        },
226ae8f2e8e9 JSLinting on /langues endpoint
Chloe Laisne <chloe.laisne@gmail.com>
parents: 189
diff changeset
   145
        play: function(item){
226ae8f2e8e9 JSLinting on /langues endpoint
Chloe Laisne <chloe.laisne@gmail.com>
parents: 189
diff changeset
   146
            this.set("currentId", item.id);
226ae8f2e8e9 JSLinting on /langues endpoint
Chloe Laisne <chloe.laisne@gmail.com>
parents: 189
diff changeset
   147
        }
226ae8f2e8e9 JSLinting on /langues endpoint
Chloe Laisne <chloe.laisne@gmail.com>
parents: 189
diff changeset
   148
58
6c03fafb6b62 Add missing filters to the application controller
nowmad@nowmads-macbook-pro.local
parents: 51
diff changeset
   149
    }
51
70dff07a76ff add click event on visu-carto and visu-langue and update the url with the selected element as filter parameter
nowmad@nowmads-macbook-pro.local
parents:
diff changeset
   150
});