support for last_committer and last_author when scanning repos
[webgit] / src / actions.c
index 434adb918ebfec48a75c82f8c2fe3a6827273c95..cb2a1ba6d75f5c14cec1410076f751eb62249860 100644 (file)
 
 
 static Html
-ctgit_main_menu_action (struct ctgit_query* query)
+webgit_main_menu_action (struct webgit_query* query)
 {
   return html ("TODO: main menu sidebar");
 }
 
 static Html
-ctgit_main_content_action (struct ctgit_query* query)
+webgit_main_content_action (struct webgit_query* query)
 {
   Html table = html_list ();
 
@@ -51,6 +51,8 @@ ctgit_main_content_action (struct ctgit_query* query)
                                html(html_tag ("th"),"Description"),
                                html(html_tag ("th"),"Owner"),
                                html(html_tag ("th"),"Last Change"),
+                               html(html_tag ("th"),"Author"),
+                               html(html_tag ("th"),"Committer"),
                                html(html_tag ("th"),"Action")
                                ),
                           html_nl()
@@ -59,25 +61,31 @@ ctgit_main_content_action (struct ctgit_query* query)
 
   LLIST_FOREACH (&query->repos, node)
     {
-      struct ctgit_repo_info* n = (struct ctgit_repo_info*)node;
+      struct webgit_repo_info* n = (struct webgit_repo_info*)node;
       html_list_append (table, html (
                                      html_tag ("tr"),
-                                     html(html_tag ("td"), ctgit_summary_link (query, n, html (n->name))),
+                                     html(html_tag ("td"), webgit_summary_link (query, n, html (n->name))),
                                      html(html_tag ("td"), n->description),
                                      html(html_tag ("td"), n->owner),
                                      html(html_tag ("td"),
-                                          ctgit_object_link (query,
-                                                             n->name, strlen(n->name),
-                                                             n->last_commit, 40,
-                                                             ctgit_pretty_age (n->age))
+                                          webgit_object_link (query,
+                                                              n->name, strlen(n->name),
+                                                              n->last_commit, 40,
+                                                              webgit_pretty_age (n->age))
+                                          ),
+                                     html(html_tag ("td"),
+                                          webgit_email_link (n->last_author_name, n->last_author_email)
+                                          ),
+                                     html(html_tag ("td"),
+                                          webgit_email_link (n->last_committer_name, n->last_committer_email)
                                           ),
                                      html(html_tag ("td"),
                                           html(
-                                               ctgit_log_link (query, n, n->last_head, html("Log")),
+                                               webgit_log_link (query, n, n->last_head, html("Log")),
                                                " ",
-                                               //ctgit_diff_link (query, n, n->last_head, html("Diff")),
+                                               //webgit_diff_link (query, n, n->last_head, html("Diff")),
                                                //" ",
-                                               ctgit_object_link (query,
+                                               webgit_object_link (query,
                                                                   n->name, strlen(n->name),
                                                                   n->last_tree, 40,
                                                                   html("Tree"))
@@ -92,38 +100,38 @@ ctgit_main_content_action (struct ctgit_query* query)
 }
 
 static Html
-ctgit_main_action (struct ctgit_query* query)
+webgit_main_action (struct webgit_query* query)
 {
   return html(
-              html(html_tag("div"), ctgit_main_menu_action (query)), html_nl (),
-              html(html_tag("div"), ctgit_main_content_action (query)), html_nl ()
+              html(html_tag("div"), webgit_main_menu_action (query)), html_nl (),
+              html(html_tag("div"), webgit_main_content_action (query)), html_nl ()
               );
 }
 
 static Html
-ctgit_summary_action (struct ctgit_query* query)
+webgit_summary_action (struct webgit_query* query)
 {
   return html("summary");
 }
 
 static Html
-ctgit_log_action (struct ctgit_query* query)
+webgit_log_action (struct webgit_query* query)
 {
   return html("log");
 }
 
 static Html
-ctgit_diff_action (struct ctgit_query* query)
+webgit_diff_action (struct webgit_query* query)
 {
   return html("diff");
 }
 
 static Html
-ctgit_object_action (struct ctgit_query* query)
+webgit_object_action (struct webgit_query* query)
 {
   LLIST_FOREACH (&query->repos, node)
     {
-      struct ctgit_repo_info* ri = (struct ctgit_repo_info*) node;
+      struct webgit_repo_info* ri = (struct webgit_repo_info*) node;
       if (!strcmp (ri->name, query->repo))
         {
           chdir (ri->path);
@@ -140,13 +148,11 @@ ctgit_object_action (struct ctgit_query* query)
   switch (sha1_object_info(sha1, NULL))
     {
     case OBJ_COMMIT:
-      return ctgit_object_commit_action (query, sha1);
+      return webgit_object_commit_action (query, sha1);
     case OBJ_TREE:
-      return ctgit_object_tree_action (query, sha1);
+      return webgit_object_tree_action (query, sha1);
     case OBJ_BLOB:
-      return html ("its a blob");
-
-      break;
+      return webgit_object_blob_action (query, sha1);
     case OBJ_TAG:
       return html ("its a tag");
 
@@ -158,43 +164,43 @@ ctgit_object_action (struct ctgit_query* query)
 }
 
 static Html
-ctgit_raw_action (struct ctgit_query* query)
+webgit_raw_action (struct webgit_query* query)
 {
   return html("raw");
 }
 
 static Html
-ctgit_tag_action (struct ctgit_query* query)
+webgit_tag_action (struct webgit_query* query)
 {
   return html("tag");
 }
 
 static Html
-ctgit_edit_action (struct ctgit_query* query)
+webgit_edit_action (struct webgit_query* query)
 {
   return html("edit");
 }
 
 static Html
-ctgit_commit_action (struct ctgit_query* query)
+webgit_commit_action (struct webgit_query* query)
 {
   return html("commit");
 }
 
 
 Html
-ctgit_action_dispatch (struct ctgit_query* query)
+webgit_action_dispatch (struct webgit_query* query)
 {
-#define CTGIT_ACTION(name, _)                   \
+#define WEBGIT_ACTION(name, _)                   \
 {                                               \
  #name,                                         \
ctgit_##name##_action,                         \
webgit_##name##_action,                         \
 },
   struct action_table{
     char* name;
-    Html (*cb)(struct ctgit_query* query);
-  } cmds[] = {CTGIT_ACTIONS {"", NULL}};
-#undef CTGIT_ACTION
+    Html (*cb)(struct webgit_query* query);
+  } cmds[] = {WEBGIT_ACTIONS {"", NULL}};
+#undef WEBGIT_ACTION
 
   for (struct action_table* j = cmds; j->cb; ++j)
     {