cms/app-client/app/routes/tabs/carto.js
author Chloe Laisne <chloe.laisne@gmail.com>
Sat, 15 Oct 2016 20:02:09 +0530
changeset 337 2ea18460d5e3
parent 331 9836845ed1e8
child 338 4a3899b6a7ed
permissions -rw-r--r--
Fix loading alphabetical/popularity sorting in themes

import Ember from 'ember';

export default Ember.Route.extend({

    constants: Ember.inject.service(),

    modelQueryParam: '',

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

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

    model: function() {
        return this.store.query('geostat', {
            'area': this.get('modelQueryParam'),
            'details': 1
        });
    },

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

});