cms/app-client/app/routes/tabs/carto.js
author ymh <ymh.work@gmail.com>
Tue, 22 Nov 2016 18:41:04 +0100
changeset 434 58df2c256e00
parent 394 48458e099b05
child 532 1190ea937f2d
permissions -rw-r--r--
remove uncesessary attribute

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();
        }
    }

});