cms/app-client/app/routes/application.js
author nowmad@23.1.168.192.in-addr.arpa
Fri, 18 Dec 2015 15:19:19 +0100
changeset 74 2bd46d0b2c80
parent 42 7d091abf82fd
child 81 848e4a5ad4d9
permissions -rw-r--r--
Propagate the current query param to the new route (necessary when the route change comes from outside the app)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
42
7d091abf82fd add application adapter to simulate REST, using fixtures
nowmad@nowmads-macbook-pro.local
parents:
diff changeset
     1
import Ember from 'ember';
7d091abf82fd add application adapter to simulate REST, using fixtures
nowmad@nowmads-macbook-pro.local
parents:
diff changeset
     2
7d091abf82fd add application adapter to simulate REST, using fixtures
nowmad@nowmads-macbook-pro.local
parents:
diff changeset
     3
export default Ember.Route.extend({
7d091abf82fd add application adapter to simulate REST, using fixtures
nowmad@nowmads-macbook-pro.local
parents:
diff changeset
     4
  model() {
7d091abf82fd add application adapter to simulate REST, using fixtures
nowmad@nowmads-macbook-pro.local
parents:
diff changeset
     5
    return this.store.findAll('sound');
74
2bd46d0b2c80 Propagate the current query param to the new route (necessary when the route change comes from outside the app)
nowmad@23.1.168.192.in-addr.arpa
parents: 42
diff changeset
     6
  },
2bd46d0b2c80 Propagate the current query param to the new route (necessary when the route change comes from outside the app)
nowmad@23.1.168.192.in-addr.arpa
parents: 42
diff changeset
     7
  actions: {
2bd46d0b2c80 Propagate the current query param to the new route (necessary when the route change comes from outside the app)
nowmad@23.1.168.192.in-addr.arpa
parents: 42
diff changeset
     8
    willTransition: function(transition) {
2bd46d0b2c80 Propagate the current query param to the new route (necessary when the route change comes from outside the app)
nowmad@23.1.168.192.in-addr.arpa
parents: 42
diff changeset
     9
      var _this = this;
2bd46d0b2c80 Propagate the current query param to the new route (necessary when the route change comes from outside the app)
nowmad@23.1.168.192.in-addr.arpa
parents: 42
diff changeset
    10
      var queryParams = {};
2bd46d0b2c80 Propagate the current query param to the new route (necessary when the route change comes from outside the app)
nowmad@23.1.168.192.in-addr.arpa
parents: 42
diff changeset
    11
      this.controller.get('queryParams').map(function(elt, index){
2bd46d0b2c80 Propagate the current query param to the new route (necessary when the route change comes from outside the app)
nowmad@23.1.168.192.in-addr.arpa
parents: 42
diff changeset
    12
        queryParams[elt] = _this.controller.get(elt);
2bd46d0b2c80 Propagate the current query param to the new route (necessary when the route change comes from outside the app)
nowmad@23.1.168.192.in-addr.arpa
parents: 42
diff changeset
    13
      });
2bd46d0b2c80 Propagate the current query param to the new route (necessary when the route change comes from outside the app)
nowmad@23.1.168.192.in-addr.arpa
parents: 42
diff changeset
    14
      this.transitionTo({ queryParams: queryParams });
2bd46d0b2c80 Propagate the current query param to the new route (necessary when the route change comes from outside the app)
nowmad@23.1.168.192.in-addr.arpa
parents: 42
diff changeset
    15
    }
42
7d091abf82fd add application adapter to simulate REST, using fixtures
nowmad@nowmads-macbook-pro.local
parents:
diff changeset
    16
  }
7d091abf82fd add application adapter to simulate REST, using fixtures
nowmad@nowmads-macbook-pro.local
parents:
diff changeset
    17
});