List for cgit developers and users
 help / color / mirror / Atom feed
From: andy.doan at linaro.org (Andy Doan)
Subject: [PATCHv2 0/2] Collapsible Section Support
Date: Mon, 3 Oct 2016 15:52:05 -0500	[thread overview]
Message-ID: <c805e37c-24bd-b307-6953-0b8ad04f0805@linaro.org> (raw)
In-Reply-To: <CAHmME9p7EXb+mi+rz1=He-tXxHPCSKSdTyzzxQrHYvofYNrw4A@mail.gmail.com>

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


  parent reply	other threads:[~2016-10-03 20:52 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-12 22:01 andy.doan
2016-09-12 22:01 ` [PATCH 1/2] ui-repolist: provide hyperlinks on section names andy.doan
2016-09-12 23:08   ` john
2016-09-12 22:01 ` [PATCH 2/2] ui-repolist: Allow sections to be collapsible andy.doan
2016-09-13  3:54 ` [PATCHv3 0/2] Collapsible Section Support andy.doan
2016-09-13  3:54   ` [PATCHv3 1/2] ui-repolist: provide hyperlinks on section names andy.doan
2016-09-13  3:54   ` [PATCHv3 2/2] ui-repolist: Allow sections to be collapsible andy.doan
2016-10-01 20:50 ` [PATCHv2 0/2] Collapsible Section Support Jason
2016-10-03 15:44   ` andy.doan
2016-10-03 15:54     ` Jason
2016-10-03 15:56       ` Jason
2016-10-03 18:04         ` andy.doan
2016-10-03 20:52         ` andy.doan [this message]
2016-10-11 16:15           ` andy.doan
2016-10-03 18:10 ` tim

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c805e37c-24bd-b307-6953-0b8ad04f0805@linaro.org \
    --to=cgit@lists.zx2c4.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).