wejsv2old-plugin-cdp-profile
Version:
We.js plugin wejsv2old-plugin-cdp-profile
18 lines (17 loc) • 558 B
JavaScript
App.UserComunidadesController = Ember.ObjectController.extend({
comunidadesPerRow: 2,
comunidadesArray: function (){
var self = this;
var content = this.get('comunidades');
return content.map(function (comunidade, i){
comunidade.row = Math.floor( i / self.get('comunidadesPerRow') ) + 1;
return comunidade;
}).reduce(function (prev, curr){
if ( !prev[curr.row - 1] ) {
prev[curr.row - 1] = [];
}
prev[curr.row - 1].push(curr);
return prev;
}, []);
}.property('comunidades.[]'),
});