cms/app-client/app/adapters/application.js
author ymh <ymh.work@gmail.com>
Wed, 28 Sep 2016 17:24:02 +0200
changeset 306 3fccf43160a7
parent 305 ff6cf3fc5f40
child 318 5564f5065f81
permissions -rw-r--r--
Some more changes linked to the change of api organization + some jshint error cleaning
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
126
e87a340711a4 improve on dataloading. add fixture management with proper interface to load data.
ymh <ymh.work@gmail.com>
parents: 123
diff changeset
     1
import RESTAdapter from 'ember-data/adapters/rest';
e87a340711a4 improve on dataloading. add fixture management with proper interface to load data.
ymh <ymh.work@gmail.com>
parents: 123
diff changeset
     2
import ENV from 'app-client/config/environment';
91
acfeddc7821d rename "sound" to "document"
nowmad@nowmads-macbook-pro.local
parents: 90
diff changeset
     3
305
ff6cf3fc5f40 api reorganisation and propagation if the changes + some code cleaning
ymh <ymh.work@gmail.com>
parents: 261
diff changeset
     4
const TYPE_PATH_MAP = {
ff6cf3fc5f40 api reorganisation and propagation if the changes + some code cleaning
ymh <ymh.work@gmail.com>
parents: 261
diff changeset
     5
    transcript: 'transcript',
ff6cf3fc5f40 api reorganisation and propagation if the changes + some code cleaning
ymh <ymh.work@gmail.com>
parents: 261
diff changeset
     6
    geostat: 'stats/geostats',
ff6cf3fc5f40 api reorganisation and propagation if the changes + some code cleaning
ymh <ymh.work@gmail.com>
parents: 261
diff changeset
     7
    theme: 'stats/themes'
306
3fccf43160a7 Some more changes linked to the change of api organization + some jshint error cleaning
ymh <ymh.work@gmail.com>
parents: 305
diff changeset
     8
};
305
ff6cf3fc5f40 api reorganisation and propagation if the changes + some code cleaning
ymh <ymh.work@gmail.com>
parents: 261
diff changeset
     9
126
e87a340711a4 improve on dataloading. add fixture management with proper interface to load data.
ymh <ymh.work@gmail.com>
parents: 123
diff changeset
    10
export default RESTAdapter.extend({
245
c9dd78a43b07 Transcript model and erializer
Chloe Laisne <chloe.laisne@gmail.com>
parents: 126
diff changeset
    11
261
02e2396bcbbc Migrate to ember 2.7 + correct jquery null context error + declare shim for popcorn (instead of silencing the JSHint error)
ymh <ymh.work@gmail.com>
parents: 245
diff changeset
    12
    namespace: ENV.rootURL.replace(/\/$/,"")+'/api/v1',
126
e87a340711a4 improve on dataloading. add fixture management with proper interface to load data.
ymh <ymh.work@gmail.com>
parents: 123
diff changeset
    13
245
c9dd78a43b07 Transcript model and erializer
Chloe Laisne <chloe.laisne@gmail.com>
parents: 126
diff changeset
    14
    buildURL: function(modelName, id) {
c9dd78a43b07 Transcript model and erializer
Chloe Laisne <chloe.laisne@gmail.com>
parents: 126
diff changeset
    15
        if(modelName === 'transcript') {
c9dd78a43b07 Transcript model and erializer
Chloe Laisne <chloe.laisne@gmail.com>
parents: 126
diff changeset
    16
            return this.urlPrefix() + '/documents/' + id + '/' + modelName;
c9dd78a43b07 Transcript model and erializer
Chloe Laisne <chloe.laisne@gmail.com>
parents: 126
diff changeset
    17
        }
c9dd78a43b07 Transcript model and erializer
Chloe Laisne <chloe.laisne@gmail.com>
parents: 126
diff changeset
    18
        return this._super(...arguments);
c9dd78a43b07 Transcript model and erializer
Chloe Laisne <chloe.laisne@gmail.com>
parents: 126
diff changeset
    19
    },
42
7d091abf82fd add application adapter to simulate REST, using fixtures
nowmad@nowmads-macbook-pro.local
parents:
diff changeset
    20
245
c9dd78a43b07 Transcript model and erializer
Chloe Laisne <chloe.laisne@gmail.com>
parents: 126
diff changeset
    21
    pathForType: function(modelName) {
305
ff6cf3fc5f40 api reorganisation and propagation if the changes + some code cleaning
ymh <ymh.work@gmail.com>
parents: 261
diff changeset
    22
        return TYPE_PATH_MAP[modelName] || this._super(...arguments);
245
c9dd78a43b07 Transcript model and erializer
Chloe Laisne <chloe.laisne@gmail.com>
parents: 126
diff changeset
    23
    }
c9dd78a43b07 Transcript model and erializer
Chloe Laisne <chloe.laisne@gmail.com>
parents: 126
diff changeset
    24
261
02e2396bcbbc Migrate to ember 2.7 + correct jquery null context error + declare shim for popcorn (instead of silencing the JSHint error)
ymh <ymh.work@gmail.com>
parents: 245
diff changeset
    25
});