From mboxrd@z Thu Jan 1 00:00:00 1970 From: andy.doan at linaro.org (Andy Doan) Date: Tue, 11 Oct 2016 11:15:02 -0500 Subject: [PATCHv2 0/2] Collapsible Section Support In-Reply-To: References: <1473717710-31710-1-git-send-email-andy.doan@linaro.org> Message-ID: <07946eff-417a-8652-ad2f-8900e191ea0f@linaro.org> Any opinions on this? On 10/03/2016 03:52 PM, Andy Doan wrote: > On 10/03/2016 10:56 AM, Jason A. Donenfeld wrote: >> Also, to clarify -- >> >> The patch for cgit for this should probably be just adding >> id="section_name" to the various divs. Then users' stylesheets and js >> files can contain the necessary logic for which to hide and when to >> hide it. That is, unless you can think of some really slick way to >> roll this out to everybody that isn't too invasive. But I'm leaning >> toward the, "possible via section name IDs" approach. > > I've just found a way to do this with having to only change one line of > code (add an "id" to each section row): > > diff --git a/ui-repolist.c b/ui-repolist.c > index 30915df..c64d145 100644 > --- a/ui-repolist.c > +++ b/ui-repolist.c > @@ -320,8 +320,8 @@ void cgit_print_repolist(void) > (last_section != NULL && section == NULL) || > (last_section != NULL && section != NULL && > strcmp(section, last_section)))) { > - htmlf(" class='reposection'>", > - columns); > + htmlf(" colspan='%d' class='reposection'>", > + section, columns); > html_txt(section); > html(""); > last_section = section; > > With that simple change, I was able to use your pluggable "header" > option to create something that works. The JS isn't exactly something I > would be proud of, but it does accomplish what you've described: > > http://paste.ubuntu.com/23271843/ > > You can compare the two approaches: > > new js hackery: https://git-ap.linaro.org/cgit/ > original patch: https://git-ie.linaro.org/cgit/ > > My page loads are almost 2x slower with the new approach. However, they > still seem "fast enough". > > Let me know what you think, and I can re-submit this one-liner if you > prefer. > > -andy >