summaryrefslogtreecommitdiffabout
authorLars Hjemli <hjemli@gmail.com>2007-11-16 08:52:03 (UTC)
committer Lars Hjemli <hjemli@gmail.com>2007-11-16 08:52:03 (UTC)
commit6ef637e0908ca5a14675b3513f48cd390d3757fe (patch) (side-by-side diff)
treee9e74f73e3d52d5b1fb931ac92a99476d09130af
parentfd90d2826a979f3844312718ad130880cf19d52c (diff)
downloadcgit-6ef637e0908ca5a14675b3513f48cd390d3757fe.zip
cgit-6ef637e0908ca5a14675b3513f48cd390d3757fe.tar.gz
cgit-6ef637e0908ca5a14675b3513f48cd390d3757fe.tar.bz2
Use tables for page layout
It feels like the Right Thing, and it fixes some rendering problems in a much used webbrowser. Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--cgit.css49
-rw-r--r--ui-shared.c22
2 files changed, 41 insertions, 30 deletions
diff --git a/cgit.css b/cgit.css
index 565427f..17c2712 100644
--- a/cgit.css
+++ b/cgit.css
@@ -1,195 +1,204 @@
body, table {
padding: 0em;
margin: 0em;
}
body {
font-family: sans;
font-size: 10pt;
color: #333;
background: white;
- padding-left: 4px;
+ padding: 4px;
}
table {
border-collapse: collapse;
}
h2 {
font-size: 120%;
font-weight: bold;
margin-top: 0em;
margin-bottom: 0.25em;
}
h3 {
margin-top: 0em;
font-size: 100%;
font-weight: normal;
}
h4 {
margin-top: 1.5em;
margin-bottom: 0.1em;
font-size: 100%;
font-weight: bold;
}
a {
color: #600;
text-decoration: none;
}
a:hover {
background-color: #ddd;
text-decoration: none;
}
table.list {
border: none;
border-collapse: collapse;
}
table.list tr {
background: white;
}
table.list tr:hover {
background: #f8f8f8;
}
table.list tr.nohover:hover {
background: white;
}
table.list th {
font-weight: bold;
border-bottom: solid 1px #777;
padding: 0.1em 0.5em 0.1em 0.5em;
vertical-align: baseline;
}
table.list td {
border: none;
padding: 0.1em 0.5em 0.1em 0.5em;
}
img {
border: none;
}
-div#sidebar {
+table#layout {
+ border-collapse: collapse;
+ border: none;
+ margin: 0px;
+}
+
+td#sidebar {
vertical-align: top;
width: 162px;
padding: 0px 0px 0px 0px;
- margin: 4px;
- float: left;
+ margin: 0px;
}
-div#logo {
+td#sidebar table {
+ border-collapse: separate;
+ border-spacing: 0px;
margin: 0px;
- padding: 4px 0px 4px 0px;
- text-align: center;
+ padding: 0px;
background-color: #ccc;
+}
+
+td#sidebar table.sidebar td.sidebar {
+ padding: 4px;
border-top: solid 1px #eee;
border-left: solid 1px #eee;
border-right: solid 1px #aaa;
border-bottom: solid 1px #aaa;
}
-div#sidebar div.infobox {
- margin: 0px 0px 0px 0px;
- padding: 0.5em;
- text-align: left;
+div#logo {
+ margin: 0px;
+ padding: 4px 0px 4px 0px;
+ text-align: center;
background-color: #ccc;
border-top: solid 1px #eee;
border-left: solid 1px #eee;
border-right: solid 1px #aaa;
border-bottom: solid 1px #aaa;
}
-div#sidebar div.infobox h1 {
+td#sidebar h1 {
font-size: 10pt;
font-weight: bold;
margin: 8px 0px 0px 0px;
}
-div#sidebar div.infobox h1.first {
+td#sidebar h1.first {
margin-top: 0px;
}
-div#sidebar div.infobox a.menu {
+td#sidebar a.menu {
display: block;
background-color: #ccc;
padding: 0.1em 0.5em;
text-decoration: none;
}
-div#sidebar div.infobox a.menu:hover {
+td#sidebar a.menu:hover {
background-color: #bbb;
text-decoration: none;
}
-div#sidebar div.infobox select {
+td#sidebar select {
width: 100%;
margin: 2px 0px 0px 0px;
}
-td#branch-dropdown-cell {
- width: 99%;
+td#sidebar form {
+ text-align: right;
}
input#switch-btn {
- width: 20px;
margin: 2px 0px 0px 0px;
}
-div#sidebar div.infobox input.txt {
+td#sidebar input.txt {
width: 100%;
margin: 2px 0px 0px 0px;
}
table#grid {
margin: 0px;
}
td#content {
vertical-align: top;
padding: 1em 2em 1em 1em;
border: none;
}
div#summary {
vertical-align: top;
margin-bottom: 1em;
}
table#downloads {
float: right;
border-collapse: collapse;
border: solid 1px #777;
margin-left: 0.5em;
margin-bottom: 0.5em;
}
table#downloads th {
background-color: #ccc;
}
div#blob {
border: solid 1px black;
}
div.error {
color: red;
font-weight: bold;
margin: 1em 2em;
}
a.ls-blob, a.ls-dir, a.ls-mod {
font-family: monospace;
}
td.ls-size {
text-align: right;
}
diff --git a/ui-shared.c b/ui-shared.c
index 2f771da..4c0613a 100644
--- a/ui-shared.c
+++ b/ui-shared.c
@@ -412,128 +412,130 @@ int print_archive_ref(const char *refname, const unsigned char *sha1,
} else {
hashcpy(fileid, sha1);
}
if (!*header) {
html("<h1>download</h1>\n");
*header = 1;
}
url = cgit_pageurl(cgit_query_repo, "blob",
fmt("id=%s&amp;path=%s", sha1_to_hex(fileid),
buf));
html_link_open(url, NULL, "menu");
html_txt(strlpart(buf, 20));
html_link_close();
return 0;
}
void add_hidden_formfields(int incl_head, int incl_search, char *page)
{
char *url;
if (!cgit_virtual_root) {
url = fmt("%s/%s", cgit_query_repo, page);
if (cgit_query_path)
url = fmt("%s/%s", url, cgit_query_path);
html_hidden("url", url);
}
if (incl_head && strcmp(cgit_query_head, cgit_repo->defbranch))
html_hidden("h", cgit_query_head);
if (cgit_query_sha1)
html_hidden("id", cgit_query_sha1);
if (cgit_query_sha2)
html_hidden("id2", cgit_query_sha2);
if (incl_search) {
if (cgit_query_grep)
html_hidden("qt", cgit_query_grep);
if (cgit_query_search)
html_hidden("q", cgit_query_search);
}
}
void cgit_print_pageheader(char *title, int show_search)
{
static const char *default_info = "This is cgit, a fast webinterface for git repositories";
int header = 0;
- html("<div id='sidebar'>\n");
- html("<div id='logo'><a href='");
+ html("<table id='layout' summary=''>\n");
+ html("<tr><td id='sidebar'>\n");
+ html("<table class='sidebar' summary=''>\n");
+ html("<tr><td class='sidebar'>\n<a href='");
html_attr(cgit_rooturl());
- htmlf("'><img src='%s' alt='cgit'/></a></div>\n",
+ htmlf("'><img src='%s' alt='cgit'/></a>\n",
cgit_logo);
- html("<div class='infobox'>");
+ html("</td></tr>\n<tr><td class='sidebar'>\n");
if (cgit_query_repo) {
html("<h1 class='first'>");
html_txt(strrpart(cgit_repo->name, 20));
html("</h1>\n");
html_txt(cgit_repo->desc);
if (cgit_repo->owner) {
html("<h1>owner</h1>\n");
html_txt(cgit_repo->owner);
}
html("<h1>navigate</h1>\n");
reporevlink(NULL, "summary", NULL, "menu", cgit_query_head,
NULL, NULL);
cgit_log_link("log", NULL, "menu", cgit_query_head, NULL, NULL,
0, NULL, NULL);
cgit_tree_link("tree", NULL, "menu", cgit_query_head,
cgit_query_sha1, NULL);
cgit_commit_link("commit", NULL, "menu", cgit_query_head,
cgit_query_sha1);
cgit_diff_link("diff", NULL, "menu", cgit_query_head,
cgit_query_sha1, cgit_query_sha2, NULL);
for_each_ref(print_archive_ref, &header);
html("<h1>branch</h1>\n");
html("<form method='get' action=''>\n");
add_hidden_formfields(0, 1, cgit_query_page);
- html("<table summary='branch selector' class='grid'><tr><td id='branch-dropdown-cell'>");
+// html("<table summary='branch selector' class='grid'><tr><td id='branch-dropdown-cell'>");
html("<select name='h' onchange='this.form.submit();'>\n");
for_each_branch_ref(print_branch_option, cgit_query_head);
html("</select>\n");
- html("</td><td>");
- html("<noscript><input type='submit' id='switch-btn' value='..'/></noscript>\n");
- html("</td></tr></table>");
+// html("</td><td>");
+ html("<noscript><input type='submit' id='switch-btn' value='switch'/></noscript>\n");
+// html("</td></tr></table>");
html("</form>\n");
html("<h1>search</h1>\n");
html("<form method='get' action='");
if (cgit_virtual_root)
html_attr(cgit_fileurl(cgit_query_repo, "log",
cgit_query_path, NULL));
html("'>\n");
add_hidden_formfields(1, 0, "log");
html("<select name='qt'>\n");
html_option("grep", "log msg", cgit_query_grep);
html_option("author", "author", cgit_query_grep);
html_option("committer", "committer", cgit_query_grep);
html("</select>\n");
html("<input class='txt' type='text' name='q' value='");
html_attr(cgit_query_search);
html("'/>\n");
html("</form>\n");
} else {
if (!cgit_index_info || html_include(cgit_index_info))
html(default_info);
}
- html("</div>\n");
+ html("</td></tr></table></td>\n");
- html("</div>\n<table summary='page content' class='grid'><tr><td id='content'>\n");
+ html("<td id='content'>\n");
}
void cgit_print_snapshot_start(const char *mimetype, const char *filename,
struct cacheitem *item)
{
htmlf("Content-Type: %s\n", mimetype);
htmlf("Content-Disposition: inline; filename=\"%s\"\n", filename);
htmlf("Last-Modified: %s\n", http_date(item->st.st_mtime));
htmlf("Expires: %s\n", http_date(item->st.st_mtime +
ttl_seconds(item->ttl)));
html("\n");
}
/* vim:set sw=8: */