Mercurial > libervia-web
changeset 785:103f0f01ba54
browser side (blog): fixed entries and comments ordering
author | Goffi <goffi@goffi.org> |
---|---|
date | Tue, 01 Dec 2015 14:26:53 +0100 |
parents | f3cd261ea12f |
children | f0ad3f62bae2 |
files | src/browser/sat_browser/blog.py |
diffstat | 1 files changed, 8 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/src/browser/sat_browser/blog.py Tue Dec 01 13:55:01 2015 +0100 +++ b/src/browser/sat_browser/blog.py Tue Dec 01 14:26:53 2015 +0100 @@ -192,7 +192,7 @@ def setEditable(self, editable=True): """Toggle the bubble between display and edit mode. - + @param editable (bool) """ self.editable = editable @@ -376,12 +376,10 @@ """Update comments""" self._createCommentsPanel() self.entries.sort(key=lambda entry: entry.item.published, reverse=True) - idx = 0 - for entry in self.entries: + for idx, entry in enumerate(self.entries): if not entry.displayed: self.comments_panel.insert(entry, idx) entry.displayed = True - idx += 1 def delete(self): quick_blog.Entry.delete(self) @@ -436,18 +434,21 @@ def update(self): self.entries.sort(key=lambda entry: entry.item.published, reverse=True) - idx = 0 + start_idx = 0 if self._first_entry is not None: - idx += 1 + start_idx = 1 if not self._first_entry.displayed: self.vpanel.insert(self._first_entry, 0) self._first_entry.displayed = True + # XXX: enumerate is buggued in pyjamas (start is not used) + # we have to use idx + idx = start_idx for entry in self.entries: if not entry.displayed: self.vpanel.insert(entry, idx) entry.displayed = True - idx += 1 + idx += 1 # def onDelete(self): # quick_widgets.QuickWidget.onDelete(self)