cms/app-client/app/serializers/theme.js
author ymh <ymh.work@gmail.com>
Wed, 19 Oct 2016 00:31:18 +0200
changeset 368 5f79f31ca9a2
parent 319 78990a8a069b
child 474 245b4df137d3
permissions -rw-r--r--
Add some doc. Improve auto documentation of build script

import DS from 'ember-data';

export default DS.JSONSerializer.extend({

    normalizeResponse: function(store, primaryModelClass, payload) {
        var data = [];
        var themes = payload['themes'];
        Object.keys(themes).forEach(function(key) {
            data.push({
                'id': key,
                'type': 'theme',
                'attributes': {
                    'label': themes[key].label,
                    'count': themes[key].count
                }
            });
        });
        return {
            'data': data
        };
    }

});