diff options
Diffstat (limited to 'StoneIsland/platforms/ios/www/js/lib/blogs/HubView.js')
| -rwxr-xr-x | StoneIsland/platforms/ios/www/js/lib/blogs/HubView.js | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/StoneIsland/platforms/ios/www/js/lib/blogs/HubView.js b/StoneIsland/platforms/ios/www/js/lib/blogs/HubView.js index dae7f98d..4ed05bb8 100755 --- a/StoneIsland/platforms/ios/www/js/lib/blogs/HubView.js +++ b/StoneIsland/platforms/ios/www/js/lib/blogs/HubView.js @@ -25,13 +25,22 @@ var HubView = ScrollableView.extend({ galleries: {}, populate: function(data){ - this.data = data + // sort posts by date, reversed + this.data = data.map(function(s){ + return [ +moment(s.date), s ] + }).sort(function(a,b){ + return a[0] > b[0] ? -1 : a[0] == b[0] ? 0 : 1 + }).map(function(pair){ + console.log(pair[1]) + return pair[1] + }) this.$loader.hide() this.$content.empty() this.galleries = {} // id date subtitle body link store image[uri caption] this.data.forEach(function(row){ // console.log(row) + console.log(moment(row.date)) var t = this.template.replace(/{{id}}/g, row.id) .replace(/{{date}}/, moment(row.date).format("MM.DD.YYYY")) .replace(/{{title}}/, row.title) |
