[csw-devel] SF.net SVN: gar:[20545] csw/mgar/gar/v2/lib/web

wahwah at users.sourceforge.net wahwah at users.sourceforge.net
Sat Mar 30 21:00:23 CET 2013


Revision: 20545
          http://gar.svn.sourceforge.net/gar/?rev=20545&view=rev
Author:   wahwah
Date:     2013-03-30 20:00:22 +0000 (Sat, 30 Mar 2013)
Log Message:
-----------
pkgdb-web: Display catalogs as a table

With a little bit of CSS.

Modified Paths:
--------------
    csw/mgar/gar/v2/lib/web/pkgdb_web.py
    csw/mgar/gar/v2/lib/web/static/pkgdb.css
    csw/mgar/gar/v2/lib/web/templates/CatalogList.html

Modified: csw/mgar/gar/v2/lib/web/pkgdb_web.py
===================================================================
--- csw/mgar/gar/v2/lib/web/pkgdb_web.py	2013-03-30 18:13:31 UTC (rev 20544)
+++ csw/mgar/gar/v2/lib/web/pkgdb_web.py	2013-03-30 20:00:22 UTC (rev 20545)
@@ -178,20 +178,37 @@
 
 class CatalogList(object):
   def GET(self):
+    """Return a list of catalogs.
+
+    Make it table:
+
+               5.8        5.9        5.10       5.11
+    beanie     i386 sparc i386 sparc i386 sparc i386 sparc
+    dublin     i386 sparc i386 sparc i386 sparc i386 sparc
+    kiel       i386 sparc i386 sparc i386 sparc i386 sparc
+    legacy     i386 sparc i386 sparc i386 sparc i386 sparc
+    """
     archs = models.Architecture.select()
     osrels = models.OsRelease.select()
     catrels = models.CatalogRelease.select()
-    catalogs = []
+    table = []
     for catrel in catrels:
-      for arch in archs:
-        if arch.name in ('all'): continue
-        for osrel in osrels:
-          if osrel.full_name == 'unspecified': continue
+      row = [catrel.name]
+      for osrel in osrels:
+        cell = []
+        if osrel.full_name == 'unspecified': continue
+        for arch in archs:
+          if arch.name in ('all'): continue
           # tags = pkg.GetErrorTagsResult(osrel, arch, catrel)
-          key = (osrel, arch, catrel)
+          cell.append({
+            'osrel': osrel,
+            'arch': arch,
+            'catrel': catrel
+          })
           # tags_by_cat[key] = list(tags)
-          catalogs.append(key)
-    return render.CatalogList(catalogs)
+        row.append(cell)
+      table.append(row)
+    return render.CatalogList(table, osrels)
 
 
 class CatalogDetail(object):

Modified: csw/mgar/gar/v2/lib/web/static/pkgdb.css
===================================================================
--- csw/mgar/gar/v2/lib/web/static/pkgdb.css	2013-03-30 18:13:31 UTC (rev 20544)
+++ csw/mgar/gar/v2/lib/web/static/pkgdb.css	2013-03-30 20:00:22 UTC (rev 20545)
@@ -20,3 +20,37 @@
 td.wordbag {
   width: 30em;
 }
+
+/* Catalog matrix related settings */
+
+table.catalog-matrix {
+  margin-top: 1em;
+  border-collapse: separate;
+  border-spacing: 0px 0px;
+}
+table.catalog-matrix tr.top-row th {
+  border-bottom: 2px solid black;
+  border-left: 0px;
+  border-right: 0px;
+  margin: 0;
+  padding: 0;
+  font-size: 14px;
+}
+table.catalog-matrix td {
+  margin: 0.0em;
+  padding: 0.2em 0.7em 0.2em 0.7em;
+}
+table.catalog-matrix td.catalog {
+  border-left: 1px solid #DDD;
+}
+table.catalog-matrix th {
+  margin: 0.5em;
+  padding: 0.5em;
+}
+table.catalog-matrix td.catalog a {
+  margin: 0.1em;
+}
+table.catalog-matrix th.catalog-release {
+  color: gray;
+  font-size: 120%;
+}

Modified: csw/mgar/gar/v2/lib/web/templates/CatalogList.html
===================================================================
--- csw/mgar/gar/v2/lib/web/templates/CatalogList.html	2013-03-30 18:13:31 UTC (rev 20544)
+++ csw/mgar/gar/v2/lib/web/templates/CatalogList.html	2013-03-30 20:00:22 UTC (rev 20545)
@@ -1,4 +1,4 @@
-$def with (keys)
+$def with (table, osrels)
 <html>
   <head>
     <title>
@@ -7,13 +7,23 @@
     <link rel="stylesheet" type="text/css" href="/pkgdb-static/pkgdb.css" />
   </head>
   <body>
-    <ul>
-$for osrel, arch, catrel in keys:
-  <li>
-  <a href="$catrel.name-$arch.name-$osrel.short_name/">
-  $catrel.name-$arch.name-$osrel.short_name
-  </a>
-  </li>
-</ul>
+    <table class="catalog-matrix">
+      <tbody>
+  <tr class="top-row">
+    <th> <!-- this cell intentionally left blank --></th>
+$for osrel in osrels
+  <th class="catalog-release">$osrel.short_name</th>
+</tr>
+$for row in table:
+  <tr>
+  <th>$row[0]</th>
+  $for cell in row[1:]:
+    <td class="catalog">
+    $for i in cell:
+      <a href="$i['catrel'].name-$i['arch'].name-$i['osrel'].short_name/">$i['arch'].name</a>
+    </td>
+  </tr>
+</tbody>
+</table>
 </body>
 </html>

This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.



More information about the devel mailing list