"GOT", but the "O" is a cute, smiling pufferfish. Index | Thread | Search

From:
Mark Jamsek <mark@jamsek.com>
Subject:
Re: gotwebd: foldable briefs?
To:
Tracey Emery <tracey@traceyemery.net>
Cc:
Omar Polo <op@omarpolo.com>, gameoftrees@openbsd.org
Date:
Sat, 02 Dec 2023 12:05:06 +1100

Download raw body.

Thread
Tracey Emery <tracey@traceyemery.net> wrote:
> On Fri, Dec 01, 2023 at 08:55:17PM +0100, Omar Polo wrote:
> > I'm a bit unsure about this.  It's nice since it makes the full commit
> > message accessible in the briefs pages, and doesn't depend on javascript
> > (just a plain <details> tag.)  Most (all?) text browsers however don't
> > understand it and so this diffs adds some "noise" (the three dots) to
> > the briefs page.
> > 
> > I have this too on my instance:
> > <https://got.omarpolo.com/?action=summary&path=got.git>
> > 
> > (the aria-hidden attribute is just to make screen reader & co ignoring
> > the three dots that are only decorative.)
> 
> I don't mind this. It could be handy. Let's wait for more feedback.

Nice, op! I actually like this too.

It's super handy to be able to view the full log message for extra
context before entering the diff action. This also works with vimium,
which is brilliant! I'm less keen on the [...] suffix but we need some
mechanism to expand the collapsible and it's far from a deal breaker.

The noise in my text browser (w3m) is super minimal; it's actually a
nice indication that the message is in effect truncated. And it's less
of an eyesore than the [...] in chromium. I noticed that safari also
prefixes the collapsed message with a black right-pointing triangle
(U+25B6) that changes to a black down-pointing triangle (U+25BC) when
the message is expanded, which I prefer to the [...] suffix. It would
be good if we could force that everywhere rather than the [...].

In either case, this adds value for quite a minimal change so ok for me

> > 
> > diff /home/op/w/got
> > commit - 227f81a40643e9c82bb019336421e17e914d015a
> > path + /home/op/w/got
> > blob - c6f473ced0d7b7454f210dfaa119b63cd96d2ba4
> > file + gotwebd/files/htdocs/gotwebd/gotweb.css
> > --- gotwebd/files/htdocs/gotwebd/gotweb.css
> > +++ gotwebd/files/htdocs/gotwebd/gotweb.css
> > @@ -213,6 +213,24 @@ header.subtitle h2 {
> >  	}
> >  }
> >  
> > +.briefs_log summary {
> > +	display: inline;
> > +	cursor: pointer;
> > +}
> > +
> > +.briefs_toggle {
> > +	display: inline-block;
> > +	padding: 3px 4px;
> > +	border: 1px solid #222;
> > +	border-radius: 3px;
> > +	user-select: none;
> > +}
> > +
> > +/* work around .commits being unusable here */
> > +.briefs_log > p {
> > +	white-space: pre-wrap;
> > +}
> > +
> >  .tag_age, .tag_name, .tag_log {
> >  	display: inline-block;
> >  	vertical-align: middle;
> > blob - 9e76331c9d3706b7909ec6ab013b194bc66801cc
> > file + gotwebd/pages.tmpl
> > --- gotwebd/pages.tmpl
> > +++ gotwebd/pages.tmpl
> > @@ -347,7 +347,7 @@ nextsep(char *s, char **t)
> >  	struct repo_commit	*rc;
> >  	struct repo_dir		*repo_dir = t->repo_dir;
> >  	struct gotweb_url	 diff_url, patch_url, tree_url;
> > -	char			*tmp;
> > +	char			*tmp, *body;
> >  
> >  	diff_url = (struct gotweb_url){
> >  		.action = DIFF,
> > @@ -385,9 +385,12 @@ nextsep(char *s, char **t)
> >  	if (tmp)
> >  		*tmp = '\0';
> >  
> > -	tmp = strchr(rc->commit_msg, '\n');
> > -	if (tmp)
> > -		*tmp = '\0';
> > +	body = strchr(rc->commit_msg, '\n');
> > +	if (body) {
> > +		*body++ = '\0';
> > +		while (*body == '\n')
> > +		      body++;
> > +	}
> >      !}
> >      <div class='brief'>
> >        <p class='brief_meta'>
> > @@ -399,15 +402,33 @@ nextsep(char *s, char **t)
> >            {{ rc->committer }}
> >          </span>
> >        </p>
> > -      <p class="briefs_log">
> > -        <a href="{{ render gotweb_render_url(tp->tp_arg, &diff_url) }}">
> > -          {{ rc->commit_msg }}
> > -        </a>
> > -        {{ if rc->refs_str }}
> > -          {{ " " }} <span class="refs_str">({{ rc->refs_str }})</span>
> > -        {{ end }}
> > -        </a>
> > -      </p>
> > +      {{ if body && *body != '\0' }}
> > +        <details class="briefs_log">
> > +          <summary>
> > +            <a href="{{ render gotweb_render_url(tp->tp_arg, &diff_url) }}">
> > +              {{ rc->commit_msg }}
> > +            </a>
> > +            {{ if rc->refs_str }}
> > +              {{ " " }} <span class="refs_str">({{ rc->refs_str }})</span>
> > +            {{ end }}
> > +            {{ " " }}
> > +            <span class="briefs_toggle" aria-hidden="true">
> > +              {{ " ⋅⋅⋅ " }}
> > +            </span>
> > +          </summary>
> > +          {{ "\n" }}
> > +          <p>{{ body }}</p>
> > +        </details>
> > +      {{ else }}
> > +        <p class="briefs_log">
> > +          <a href="{{ render gotweb_render_url(tp->tp_arg, &diff_url) }}">
> > +            {{ rc->commit_msg }}
> > +          </a>
> > +          {{ if rc->refs_str }}
> > +            {{ " " }} <span class="refs_str">({{ rc->refs_str }})</span>
> > +          {{ end }}
> > +        </p>
> > +      {{ end }}
> >      </div>
> >      <div class="navs_wrapper">
> >        <div class="navs">
> > 


-- 
Mark Jamsek <https://bsdbox.org>
GPG: F2FF 13DE 6A06 C471 CA80  E6E2 2930 DC66 86EE CF68