Repository

Add pagination to the downloads

Parent commits : ff7c7d18b760f2de3b9d142804a23bd956cbe99b,
Children commits :

By Laurent Defert on 2014-10-21 20:46:38
Add pagination to the downloads

Difference with parent commit ff7c7d18b760f2de3b9d142804a23bd956cbe99b
Files modified:
kissspm/tabs/tag_download.py
--- 
+++ 
@@ -1,14 +1,14 @@
 import os
 
 from ..file_tools import file_sha1, file_size
-from ..pages.template_page import TemplatePage
+from ..pages.paginate_tmpl import PaginateTmpl
 from .repository.repository import RepositoryTab
 from .tab import Tab
 
 
-class TagDownloadTab(Tab, TemplatePage):
+class TagDownloadTab(Tab, PaginateTmpl):
     def __init__(self, name, parent, *args, **kw):
-        TemplatePage.__init__(self, name, parent, 'tag_download.html', *args, **kw)
+        PaginateTmpl.__init__(self, name, parent, 'tag_download.html', *args, **kw)
         Tab.__init__(self)
 
     def render(self):
@@ -34,6 +34,6 @@
             downloads.append(download)
         downloads = sorted(downloads, key=lambda x: x['name'])
         namespace = {
-            'downloads': downloads,
+            'downloads': reversed(downloads),
         }
-        self.render_template(namespace)
+        self.render_paginate('downloads', namespace)

themes/default/tag_download.html
--- 
+++ 
@@ -18,4 +18,13 @@
     </tr>
 #end for
 </table>
+#if $varExists('page_chooser')
+    #for text, link in $page_chooser
+        #if $link == ''
+        $text
+        #else
+        <a href="$link">$text</a>
+        #end if
+    #end for
+#end if
 #include $template_dir + "/footer.html"