alternate color of tree lines to prepare for blob/blame conversion
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
diff --git a/gotweb/files/htdocs/gotweb/gotweb.css b/gotweb/files/htdocs/gotweb/gotweb.css
index 9044940..1464010 100644
--- a/gotweb/files/htdocs/gotweb/gotweb.css
+++ b/gotweb/files/htdocs/gotweb/gotweb.css
@@ -50,6 +50,13 @@ body {
color: blue;
}
+.back_white {
+ background-color: #ffffff;
+}
+.back_lightgray {
+ background-color: #d8f3ef;
+}
+
#dotted_line {
clear: left;
float: left;
@@ -631,7 +638,8 @@ body {
}
#tree_line {
clear: left;
- float:left ;
+ float: left;
+ width: 20em;
}
/* tag.tmpl */
diff --git a/gotweb/gotweb.c b/gotweb/gotweb.c
index 8f338a0..6c89bc7 100644
--- a/gotweb/gotweb.c
+++ b/gotweb/gotweb.c
@@ -2456,8 +2456,8 @@ gw_get_repo_tree(struct gw_trans *gw_trans)
struct buf *diffbuf = NULL;
size_t newsize;
char *tree_html = NULL, *path = NULL, *in_repo_path = NULL,
- *tree_row = NULL, *id_str;
- int nentries, i;
+ *tree_row = NULL, *id_str, *class = NULL;
+ int nentries, i, class_flip = 0;
error = buf_alloc(&diffbuf, 0);
if (error)
@@ -2535,6 +2535,14 @@ gw_get_repo_tree(struct gw_trans *gw_trans)
else if (mode & S_IXUSR)
modestr = "*";
+ if (class_flip == 0) {
+ class = strdup("back_lightgray");
+ class_flip = 1;
+ } else {
+ class = strdup("back_white");
+ class_flip = 0;
+ }
+
char *build_folder = NULL;
if (S_ISDIR(got_tree_entry_get_mode(te))) {
if (gw_trans->repo_folder != NULL) {
@@ -2582,7 +2590,7 @@ gw_get_repo_tree(struct gw_trans *gw_trans)
if (error)
goto done;
- if (asprintf(&tree_row, tree_line, url_html) == -1) {
+ if ((asprintf(&tree_row, tree_line, class, url_html)) == -1) {
error = got_error_from_errno("asprintf");
goto done;
}
diff --git a/gotweb/gotweb_ui.h b/gotweb/gotweb_ui.h
index cd26c41..683c22a 100644
--- a/gotweb/gotweb_ui.h
+++ b/gotweb/gotweb_ui.h
@@ -249,7 +249,7 @@ char *tree_header =
char *tree_line =
"<div id='tree_wrapper'>" \
- "<div id='tree_line'>%s</div>" \
+ "<div id='tree_line' class='%s'>%s</div>" \
"</div>";
/* tag.tmpl */