author | ymh <ymh.work@gmail.com> |
Fri, 08 Sep 2017 12:04:06 +0200 | |
changeset 541 | e756a8c72c3d |
parent 465 | 9df336529b2f |
permissions | -rw-r--r-- |
465
9df336529b2f
make filter and theme visualisatiion change on filter modification
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
1 |
import DS from 'ember-data'; |
9df336529b2f
make filter and theme visualisatiion change on filter modification
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
2 |
|
9df336529b2f
make filter and theme visualisatiion change on filter modification
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
3 |
export default DS.JSONSerializer.extend({ |
9df336529b2f
make filter and theme visualisatiion change on filter modification
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
4 |
|
9df336529b2f
make filter and theme visualisatiion change on filter modification
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
5 |
normalizeResponse: function (store, primaryModelClass, payload) { |
9df336529b2f
make filter and theme visualisatiion change on filter modification
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
6 |
var data = []; |
9df336529b2f
make filter and theme visualisatiion change on filter modification
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
7 |
var discourses = payload['discourses']; |
9df336529b2f
make filter and theme visualisatiion change on filter modification
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
8 |
Object.keys(discourses).forEach(function (key) { |
9df336529b2f
make filter and theme visualisatiion change on filter modification
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
9 |
data.push({ |
9df336529b2f
make filter and theme visualisatiion change on filter modification
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
10 |
'id': key, |
9df336529b2f
make filter and theme visualisatiion change on filter modification
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
11 |
'type': 'discourse', |
9df336529b2f
make filter and theme visualisatiion change on filter modification
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
12 |
'attributes': { |
9df336529b2f
make filter and theme visualisatiion change on filter modification
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
13 |
'label': discourses[key].label, |
9df336529b2f
make filter and theme visualisatiion change on filter modification
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
14 |
'count': discourses[key].count |
9df336529b2f
make filter and theme visualisatiion change on filter modification
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
15 |
} |
9df336529b2f
make filter and theme visualisatiion change on filter modification
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
16 |
}); |
9df336529b2f
make filter and theme visualisatiion change on filter modification
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
17 |
}); |
9df336529b2f
make filter and theme visualisatiion change on filter modification
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
18 |
return { |
9df336529b2f
make filter and theme visualisatiion change on filter modification
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
19 |
'data': data |
9df336529b2f
make filter and theme visualisatiion change on filter modification
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
20 |
}; |
9df336529b2f
make filter and theme visualisatiion change on filter modification
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
21 |
} |
9df336529b2f
make filter and theme visualisatiion change on filter modification
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
22 |
|
9df336529b2f
make filter and theme visualisatiion change on filter modification
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
23 |
}); |