the summary_action
authorChristian Thaeter <ct@pipapo.org>
Wed, 16 Jan 2008 13:22:15 +0000 (14:22 +0100)
committerChristian Thaeter <ct@pipapo.org>
Wed, 16 Jan 2008 13:22:15 +0000 (14:22 +0100)
src/actions.c

index c5a4ce1..ebc9dac 100644 (file)
@@ -146,11 +146,96 @@ webgit_main_action (struct webgit_query* query)
 /*
   Summary of a single repository
 */
+static Html
+webgit_summary_menu_action (struct webgit_repo_info* repo)
+{
+  (void) repo;
+  return html ("TODO: summary sidebar");
+}
+
+
+static Html
+webgit_summary_content_action (struct webgit_repo_info* repo)
+{
+  Html content = html_list ();
+
+  /* Title */
+  html_list_append (content, html (html_tag ("h1"), repo->description));
+
+  /* Readme */
+  if (repo->readme)
+    html_list_append (content, html_include (repo->readme));
+
+  /* Info */
+  html_list_append (content,
+                    html (
+                          html (html_tag ("h2"), "Repository information"),
+                          repo->url ?
+                          html (
+                                html_tag ("div"),
+                                "Public URL: ",
+                                html (
+                                      html_tag ("a", html_attr ("href", repo->url)),
+                                      repo->url
+                                      )
+                                ) : html(),
+                          html (
+                                html_tag ("div"),
+                                "Owner: ", repo->owner
+                                ),
+                          html(
+                               html_tag ("div"),
+                               "Last change: ",
+                               webgit_object_link (repo->query,
+                                                   repo->name, strlen(repo->name),
+                                                   repo->last_commit, 40,
+                                                   NULL,
+                                                   webgit_pretty_age (repo->age)),
+                               " in branch ",
+                                webgit_log_link (repo->query,
+                                                 repo->name,
+                                                 repo->last_head,
+                                                 NULL, 0,
+                                                 repo->query->count,
+                                                 html ("'", repo->last_head, "'")
+                                                 )
+                               )
+                          )
+                    );
+
+  /* log */
+  html_list_append (content,
+                    html (
+                          html (html_tag ("h2"), "Log of branch '", repo->last_head, "'"),
+                          webgit_log_table (repo->query, repo->last_head, 5 /*TODO: config this*/, 0))
+                    );
+
+
+  /* branches */
+  html_list_append (content,
+                    html (
+                          html (html_tag ("h2"), "Branches"),
+                          webgit_branch_table (repo, NULL, 5 /*TODO: config this*/)
+                          )
+                    );
+
+  /* tags */
+
+
+  return content;
+}
+
+
 static Html
 webgit_summary_action (struct webgit_query* query)
 {
-  (void) query;
-  return html("summary");
+  struct webgit_repo_info* repo = webgit_repo_enter (query);
+  webgit_repoinfo_find_last (repo);
+
+  return html(
+              html(html_tag("div"), webgit_summary_menu_action (repo)), html_nl (),
+              html(html_tag("div"), webgit_summary_content_action (repo)), html_nl ()
+              );
 }