cms/app-client/app/routes/tabs/carto.js
author ymh <ymh.work@gmail.com>
Sat, 12 Nov 2016 17:21:25 +0100
changeset 414 5c6c526a7fc1
parent 394 48458e099b05
child 532 1190ea937f2d
permissions -rw-r--r--
Display for single notice, preparation for share link
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
46
b9afefcfe964 create carto route to try a query and render the carto compoenent in a specific outlet
nowmad@nowmads-macbook-pro.local
parents:
diff changeset
     1
import Ember from 'ember';
394
48458e099b05 make dynamic filters for all route and do some code pruning and cleaning
ymh <ymh.work@gmail.com>
parents: 338
diff changeset
     2
import _ from 'lodash/lodash';
46
b9afefcfe964 create carto route to try a query and render the carto compoenent in a specific outlet
nowmad@nowmads-macbook-pro.local
parents:
diff changeset
     3
b9afefcfe964 create carto route to try a query and render the carto compoenent in a specific outlet
nowmad@nowmads-macbook-pro.local
parents:
diff changeset
     4
export default Ember.Route.extend({
274
53a6985443f8 geostats endpoint + mapvar
Chloe Laisne <chloe.laisne@gmail.com>
parents: 204
diff changeset
     5
331
9836845ed1e8 AmMaps geonames constants
Chloe Laisne <chloe.laisne@gmail.com>
parents: 309
diff changeset
     6
    constants: Ember.inject.service(),
338
4a3899b6a7ed Fix notice/transcript display when adding filter from notice, switching from playlist, toolbar, and player
Chloe Laisne <chloe.laisne@gmail.com>
parents: 331
diff changeset
     7
    player: Ember.inject.service(),
394
48458e099b05 make dynamic filters for all route and do some code pruning and cleaning
ymh <ymh.work@gmail.com>
parents: 338
diff changeset
     8
    filter: Ember.inject.service(),
331
9836845ed1e8 AmMaps geonames constants
Chloe Laisne <chloe.laisne@gmail.com>
parents: 309
diff changeset
     9
9836845ed1e8 AmMaps geonames constants
Chloe Laisne <chloe.laisne@gmail.com>
parents: 309
diff changeset
    10
    modelQueryParam: '',
9836845ed1e8 AmMaps geonames constants
Chloe Laisne <chloe.laisne@gmail.com>
parents: 309
diff changeset
    11
9836845ed1e8 AmMaps geonames constants
Chloe Laisne <chloe.laisne@gmail.com>
parents: 309
diff changeset
    12
    init: function() {
9836845ed1e8 AmMaps geonames constants
Chloe Laisne <chloe.laisne@gmail.com>
parents: 309
diff changeset
    13
        this._super(...arguments);
9836845ed1e8 AmMaps geonames constants
Chloe Laisne <chloe.laisne@gmail.com>
parents: 309
diff changeset
    14
9836845ed1e8 AmMaps geonames constants
Chloe Laisne <chloe.laisne@gmail.com>
parents: 309
diff changeset
    15
        this.set('modelQueryParam', this.get('constants').GEONAMES['world']);
9836845ed1e8 AmMaps geonames constants
Chloe Laisne <chloe.laisne@gmail.com>
parents: 309
diff changeset
    16
    },
278
f2c2c80a49f7 Disable click on map areas w/o geoname + development/production disabled color + geostat endpoint
Chloe Laisne <chloe.laisne@gmail.com>
parents: 274
diff changeset
    17
281
618aec1734d5 Set step colors with geoname counts
Chloe Laisne <chloe.laisne@gmail.com>
parents: 278
diff changeset
    18
    model: function() {
394
48458e099b05 make dynamic filters for all route and do some code pruning and cleaning
ymh <ymh.work@gmail.com>
parents: 338
diff changeset
    19
        var filterQueryParams = _.clone(this.get('filter').get('queryParamsValues'));
48458e099b05 make dynamic filters for all route and do some code pruning and cleaning
ymh <ymh.work@gmail.com>
parents: 338
diff changeset
    20
        return this.store.query('geostat', _.merge(filterQueryParams, {
291
478cdcc56a63 Reset geonames model parameter when coming back to cartography tab
Chloe Laisne <chloe.laisne@gmail.com>
parents: 283
diff changeset
    21
            'area': this.get('modelQueryParam'),
283
beebc85e0c6b Change query parameters : areas to area + details = 1
Chloe Laisne <chloe.laisne@gmail.com>
parents: 281
diff changeset
    22
            'details': 1
394
48458e099b05 make dynamic filters for all route and do some code pruning and cleaning
ymh <ymh.work@gmail.com>
parents: 338
diff changeset
    23
        }));
281
618aec1734d5 Set step colors with geoname counts
Chloe Laisne <chloe.laisne@gmail.com>
parents: 278
diff changeset
    24
    },
278
f2c2c80a49f7 Disable click on map areas w/o geoname + development/production disabled color + geostat endpoint
Chloe Laisne <chloe.laisne@gmail.com>
parents: 274
diff changeset
    25
338
4a3899b6a7ed Fix notice/transcript display when adding filter from notice, switching from playlist, toolbar, and player
Chloe Laisne <chloe.laisne@gmail.com>
parents: 331
diff changeset
    26
    activate: function() {
4a3899b6a7ed Fix notice/transcript display when adding filter from notice, switching from playlist, toolbar, and player
Chloe Laisne <chloe.laisne@gmail.com>
parents: 331
diff changeset
    27
        this.get('player').set('window', false);
4a3899b6a7ed Fix notice/transcript display when adding filter from notice, switching from playlist, toolbar, and player
Chloe Laisne <chloe.laisne@gmail.com>
parents: 331
diff changeset
    28
    },
4a3899b6a7ed Fix notice/transcript display when adding filter from notice, switching from playlist, toolbar, and player
Chloe Laisne <chloe.laisne@gmail.com>
parents: 331
diff changeset
    29
291
478cdcc56a63 Reset geonames model parameter when coming back to cartography tab
Chloe Laisne <chloe.laisne@gmail.com>
parents: 283
diff changeset
    30
    deactivate: function () {
331
9836845ed1e8 AmMaps geonames constants
Chloe Laisne <chloe.laisne@gmail.com>
parents: 309
diff changeset
    31
        this.set('modelQueryParam', this.get('constants').GEONAMES['world']);
291
478cdcc56a63 Reset geonames model parameter when coming back to cartography tab
Chloe Laisne <chloe.laisne@gmail.com>
parents: 283
diff changeset
    32
    },
478cdcc56a63 Reset geonames model parameter when coming back to cartography tab
Chloe Laisne <chloe.laisne@gmail.com>
parents: 283
diff changeset
    33
478cdcc56a63 Reset geonames model parameter when coming back to cartography tab
Chloe Laisne <chloe.laisne@gmail.com>
parents: 283
diff changeset
    34
    setupController: function(controller) {
478cdcc56a63 Reset geonames model parameter when coming back to cartography tab
Chloe Laisne <chloe.laisne@gmail.com>
parents: 283
diff changeset
    35
        this._super(...arguments);
478cdcc56a63 Reset geonames model parameter when coming back to cartography tab
Chloe Laisne <chloe.laisne@gmail.com>
parents: 283
diff changeset
    36
        controller.set('modelQueryParam', this.get('modelQueryParam'));
478cdcc56a63 Reset geonames model parameter when coming back to cartography tab
Chloe Laisne <chloe.laisne@gmail.com>
parents: 283
diff changeset
    37
    },
478cdcc56a63 Reset geonames model parameter when coming back to cartography tab
Chloe Laisne <chloe.laisne@gmail.com>
parents: 283
diff changeset
    38
278
f2c2c80a49f7 Disable click on map areas w/o geoname + development/production disabled color + geostat endpoint
Chloe Laisne <chloe.laisne@gmail.com>
parents: 274
diff changeset
    39
    actions: {
291
478cdcc56a63 Reset geonames model parameter when coming back to cartography tab
Chloe Laisne <chloe.laisne@gmail.com>
parents: 283
diff changeset
    40
        setModelQueryParam: function(id) {
478cdcc56a63 Reset geonames model parameter when coming back to cartography tab
Chloe Laisne <chloe.laisne@gmail.com>
parents: 283
diff changeset
    41
            this.set('modelQueryParam', id);
281
618aec1734d5 Set step colors with geoname counts
Chloe Laisne <chloe.laisne@gmail.com>
parents: 278
diff changeset
    42
            this.refresh();
278
f2c2c80a49f7 Disable click on map areas w/o geoname + development/production disabled color + geostat endpoint
Chloe Laisne <chloe.laisne@gmail.com>
parents: 274
diff changeset
    43
        }
274
53a6985443f8 geostats endpoint + mapvar
Chloe Laisne <chloe.laisne@gmail.com>
parents: 204
diff changeset
    44
    }
53a6985443f8 geostats endpoint + mapvar
Chloe Laisne <chloe.laisne@gmail.com>
parents: 204
diff changeset
    45
46
b9afefcfe964 create carto route to try a query and render the carto compoenent in a specific outlet
nowmad@nowmads-macbook-pro.local
parents:
diff changeset
    46
});