mixed work for more menu stuff
authorChristian Thaeter <ct@pipapo.org>
Thu, 24 Jan 2008 22:50:06 +0000 (23:50 +0100)
committerChristian Thaeter <ct@pipapo.org>
Thu, 24 Jan 2008 22:50:06 +0000 (23:50 +0100)
webgit_repo_logo() displays a per-repository logo
or falls back to the webgit logo

webgit_main_link() links to the repository list

webgit_log_link() doesnt need a head (NULL)

src/actions.c
src/actions.h
src/log.c
src/repo.c
src/repo.h

index 4242ecb..a2729e2 100644 (file)
 #include <stdio.h>
 
 
+Html
+webgit_main_link (struct webgit_query* query, Html text)
+{
+  return html (
+               html_tag ("a",
+                         html_attr ("href", html_str (query->request->script_name))
+                         ),
+               text
+               );
+}
+
+
 /*
   Main (repository list) page
 */
index 2d3e6e0..b57a67e 100644 (file)
@@ -44,6 +44,9 @@
 Html
 webgit_action_dispatch (struct webgit_query* query);
 
+Html
+webgit_main_link (struct webgit_query* query, Html text);
+
 #endif
 
 /*
index 3d574a3..3d18ac1 100644 (file)
--- a/src/log.c
+++ b/src/log.c
@@ -38,10 +38,11 @@ webgit_log_link (struct webgit_query* query,
   return html (
                html_tag ("a",
                          html_attr ("href", html(
-                                                 html_fmt ("%s?repo=%s&action=log&head=%s",
+                                                 html_fmt ("%s?repo=%s&action=log",
                                                            query->request->script_name,
-                                                           repo,
-                                                           head?head:"master"),
+                                                           repo),
+                                                 head ? html_fmt("&head=%s", head)
+                                                 : html (),
                                                  object ? html_fmt("&object=%.*s",
                                                                    object_len, object)
                                                  : html (),
index baf2120..98a672e 100644 (file)
@@ -64,6 +64,30 @@ webgit_repo_link (struct webgit_query* query,
                );
 }
 
+
+Html
+webgit_repo_logo (struct webgit_repo_info* repo)
+{
+  return repo->logo ?
+    html (
+          html_tag ("a",
+                    html_attr ("href", repo->logolink ? repo->logolink : "/")),
+          html (
+                html_tag ("img",
+                          html_attr ("src", repo->logo),
+                          html_attr ("alt", html (repo->name,"-logo"))
+                          )
+                )
+          )
+    : html (
+            html_tag ("img",
+                      html_attr ("src", webgit_webskinpath (repo->query, "icons/webgit_logo.png")),
+                      html_attr ("alt", "Webgit-Logo")
+                      )
+            );
+}
+
+
 static struct webgit_repo_info* in_flight;       /* stupid git callback has no void* userdata; we have to pass self in a global */
 
 static void
index ef14dec..8513cff 100644 (file)
@@ -53,6 +53,10 @@ webgit_repo_link (struct webgit_query* query,
                   Html text);
 
 
+Html
+webgit_repo_logo (struct webgit_repo_info* repo);
+
+
 //int
 //webgit_repo_conf_cb (const char *var, const char *value);