commit 56935ae74ff53a448ab002397a77471568b4ce20 from: Omar Polo via: Thomas Adam date: Wed Aug 10 07:32:09 2022 UTC gotwebd: fix alternate colors in tree entries it was broken in 7ecc454 because now we're emitting tags with multiple `class' attributes (by mistake) and only the first one is used. However, instead of fixing the HTML `class' attribute, use a CSS selector to alternate the background colors. ok tracey@ commit - e5539f766209d839e08010501757d48a5860e0d3 commit + 56935ae74ff53a448ab002397a77471568b4ce20 blob - aa31a4194e9ded7a28469e87db5cb864a4035bbe blob + 7ee40c3b69dbf14194f2d61478622267175c57c1 --- gotwebd/files/htdocs/gotwebd/gotweb.css +++ gotwebd/files/htdocs/gotwebd/gotweb.css @@ -50,13 +50,6 @@ body { color: blue; } -.back_white { - background-color: #ffffff; -} -.back_lightgray { - background-color: #d8f3ef; -} - #logo { height: 50px; } @@ -646,7 +639,11 @@ body { clear: left; float: left; width: 100%; + background-color: #d8f3ef; } +.tree_wrapper:nth-child(even) { + background-color: #ffffff; +} .tree_line { clear: left; float: left; blob - 7a1ac38df30c281c873460785689fbc776e393cb blob + 3b0a06ca580864bb71c6b67aba40d7ef49b54c5c --- gotwebd/got_operations.c +++ gotwebd/got_operations.c @@ -831,8 +831,8 @@ got_output_repo_tree(struct request *c) struct repo_dir *repo_dir = t->repo_dir; char *id_str = NULL; char *path = NULL, *in_repo_path = NULL, *build_folder = NULL; - char *modestr = NULL, *name = NULL, *class = NULL; - int nentries, i, class_flip = 0; + char *modestr = NULL, *name = NULL; + int nentries, i; TAILQ_INIT(&refs); @@ -917,22 +917,6 @@ got_output_repo_tree(struct request *c) } } - if (class_flip == 0) { - class = strdup("back_lightgray"); - if (class == NULL) { - error = got_error_from_errno("strdup"); - goto done; - } - class_flip = 1; - } else { - class = strdup("back_white"); - if (class == NULL) { - error = got_error_from_errno("strdup"); - goto done; - } - class_flip = 0; - } - name = strdup(got_tree_entry_get_name(te)); if (name == NULL) { error = got_error_from_errno("strdup"); @@ -950,12 +934,7 @@ got_output_repo_tree(struct request *c) "