[PATCHv2 0/2] Collapsible Section Support

Andy Doan andy.doan at linaro.org
Tue Oct 11 18:15:02 CEST 2016


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("<tr class='nohover'><td colspan='%d'
> class='reposection'>",
> -                             columns);
> +                       htmlf("<tr id='%s' class='nohover'><td
> colspan='%d' class='reposection'>",
> +                             section, columns);
>                         html_txt(section);
>                         html("</td></tr>");
>                         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
> 



More information about the CGit mailing list