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

import Ember from 'ember';
import _ from 'lodash/lodash';

export default Ember.Route.extend({

    constants: Ember.inject.service(),
    player: Ember.inject.service(),
    filter: Ember.inject.service(),

    modelQueryParam: '',

    init: function() {
        this._super(...arguments);

        this.set('modelQueryParam', this.get('constants').GEONAMES['world']);
    },

    model: function() {
        var filterQueryParams = _.clone(this.get('filter').get('queryParamsValues'));
        return this.store.query('geostat', _.merge(filterQueryParams, {
            'area': this.get('modelQueryParam'),
            'details': 1
        }));
    },

    activate: function() {
        this.get('player').set('window', false);
    },

    deactivate: function () {
        this.set('modelQueryParam', this.get('constants').GEONAMES['world']);
    },

    setupController: function(controller) {
        this._super(...arguments);
        controller.set('modelQueryParam', this.get('modelQueryParam'));
    },

    actions: {
        setModelQueryParam: function(id) {
            this.set('modelQueryParam', id);
            this.refresh();
        }
    }

});