add odd/even class for table coloring
[webgit] / src / actions.c
index f6790cb..8b45ef6 100644 (file)
@@ -77,6 +77,8 @@ webgit_main_content_action (struct webgit_query* query)
                           )
               );
 
+  int row = 0;
+
   LLIST_FOREACH (&query->repos, node)
     {
       struct webgit_repo_info* n = (struct webgit_repo_info*)node;
@@ -86,12 +88,9 @@ webgit_main_content_action (struct webgit_query* query)
       if (n->age < n->maxage)
         {
           html_list_append (table, html (
-                                         /*
-                                           TODO:
-                                           It would be great to have alternate rows with class="odd" or class="even"
-                                           html_tag ("tr", html_attr ("class", "odd")),
-                                         */
-                                         html_tag ("tr"),
+                                         html_tag ("tr",
+                                                   html_attr ("class", (++row & 1) ? "odd" : "even")
+                                                   ),
                                          html(html_tag ("td"),
                                               webgit_summary_link (query, n, html (n->name))),
                                          html(html_tag ("td"), n->url ?