user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
Search results ordered by [date|relevance]  view[summary|nested|Atom feed]
thread overview below | download mbox.gz: |
* [PATCH 07/13] view: show more nearby messages in flat thread view
  2016-06-30  9:21  7% [PATCH 0/13] www: hybrid flat+thread conversation view Eric Wong
@ 2016-06-30  9:21  6% ` Eric Wong
  0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2016-06-30  9:21 UTC (permalink / raw)
  To: meta

Context is important, but so is conserving precious screen
space.  Decisions :<
---
 lib/PublicInbox/View.pm | 42 ++++++++++++++++++++++++++++++++++++------
 1 file changed, 36 insertions(+), 6 deletions(-)

diff --git a/lib/PublicInbox/View.pm b/lib/PublicInbox/View.pm
index 9393d44..0b96bda 100644
--- a/lib/PublicInbox/View.pm
+++ b/lib/PublicInbox/View.pm
@@ -146,6 +146,13 @@ sub index_entry {
 	$rv .= $more ? "\n\n" : "\n";
 }
 
+sub pad_link ($$;$) {
+	my ($mid, $level, $s) = @_;
+	$s ||= '...';
+	my $id = id_compress($mid, 1);
+	(' 'x19).indent_for($level).th_pfx($level)."<a\nhref=#r$id>($s)<a>\n";
+}
+
 sub _th_index_lite {
 	my ($mid_raw, $irt, $id, $ctx) = @_;
 	my $rv = '';
@@ -155,16 +162,24 @@ sub _th_index_lite {
 	my $map = $mapping->{$mid_raw};
 	my $nr_c = scalar @{$map->[0]};
 	my $nr_s = 0;
+	my $level = $map->[4];
+	my $idx = $map->[3];
 	if (defined $irt) {
 		my $irt_map = $mapping->{$irt};
 		my $siblings = $irt_map->[0];
 		$nr_s = scalar(@$siblings) - 1;
-		$nr_s = 0 if $nr_s < 0;
 		$rv .= $pad . $irt_map->[1];
-		my $idx = $map->[3];
 		if ($idx > 0) {
 			my $prev = $siblings->[$idx - 1];
-			$rv .= $pad . $mapping->{$prev->messageid}->[1];
+			my $pmid = $prev->messageid;
+			if ($idx > 2) {
+				my $s = ($idx - 1). ' preceding siblings ...';
+				$rv .= pad_link($pmid, $level, $s);
+			} elsif ($idx == 2) {
+				my $ppmid = $siblings->[0]->messageid;
+				$rv .= $pad . $mapping->{$ppmid}->[1];
+			}
+			$rv .= $pad . $mapping->{$pmid}->[1];
 		}
 	}
 	my $s_s = nr_to_s($nr_s, 'sibling', 'siblings');
@@ -175,10 +190,25 @@ sub _th_index_lite {
 	$rv .= "<b>@ $this";
 	my $node = $map->[2];
 	if (my $child = $node->child) {
-		$rv .= $pad . $mapping->{$child->messageid}->[1];
+		my $cmid = $child->messageid;
+		$rv .= $pad . $mapping->{$cmid}->[1];
+		if ($nr_c > 2) {
+			my $s = ($nr_c - 1). ' more replies';
+			$rv .= pad_link($cmid, $level + 1, $s);
+		} elsif (my $cn = $child->next) {
+			$rv .= $pad . $mapping->{$cn->messageid}->[1];
+		}
 	}
 	if (my $next = $node->next) {
-		$rv .= $pad .  $mapping->{$next->messageid}->[1];
+		my $nmid = $next->messageid;
+		$rv .= $pad . $mapping->{$nmid}->[1];
+		my $nnext = $nr_s - $idx;
+		if ($nnext > 2) {
+			my $s = ($nnext - 1).' subsequent siblings';
+			$rv .= pad_link($nmid, $level, $s);
+		} elsif (my $nn = $next->next) {
+			$rv .= $pad . $mapping->{$nn->messageid}->[1];
+		}
 	}
 	$rv .= "<a\nhref=#e$id\nid=m$id>_<a> <a\nhref=#r$id\n>$s_s, $s_c</a>\n";
 }
@@ -203,7 +233,7 @@ sub pre_thread  {
 		$idx = scalar @$m;
 		push @$m, $node;
 	}
-	$mapping->{$node->messageid} = [ [], '', $node, $idx ];
+	$mapping->{$node->messageid} = [ [], '', $node, $idx, $level ];
 	skel_dump($ctx, $level, $node);
 }
 
-- 
EW


^ permalink raw reply related	[relevance 6%]

* [PATCH 0/13] www: hybrid flat+thread conversation view
@ 2016-06-30  9:21  7% Eric Wong
  2016-06-30  9:21  6% ` [PATCH 07/13] view: show more nearby messages in flat thread view Eric Wong
  0 siblings, 1 reply; 2+ results
From: Eric Wong @ 2016-06-30  9:21 UTC (permalink / raw)
  To: meta

I've been long-dreaming of this and finally it's at least
publishable (I hope :x).  This flat view with thread skeletons
is 100% more usable than the dumb old one, but a little slower
(naturally :<)

I was originally hoping to remove the threaded /t/ endpoint
conversation view entirely to reduce server/caching overheads
but I still find it more usable in some situations.

What I still enjoy is being able to toggle between
[flat|threaded] views.

Eric Wong (13):
      www: implement hybrid flat+thread conversation view
      www: use WwwStream for dumping thread and search views
      view: show thread context in the thread-aware flat view
      view: merge $state hash with existing $ctx
      feed: add $INBOX/new.html endpoint
      view: tweak thread/index header slightly
      view: show more nearby messages in flat thread view
      www: reinstate old thread view as an option
      view: fix up some HTML injection via Message-ID vectors
      view: default to flat/hybrid thread display
      view: show thread size when linking to summary
      view: fixup bad reference to new_msgid
      www_stream: add response wrapper sub

 TODO                          |   2 -
 lib/PublicInbox/Feed.pm       |  51 +++-
 lib/PublicInbox/SearchView.pm | 141 +++++-----
 lib/PublicInbox/View.pm       | 590 +++++++++++++++++++++++-------------------
 lib/PublicInbox/WWW.pm        |  22 +-
 lib/PublicInbox/WwwStream.pm  |  20 +-
 t/view.t                      |   3 +-
 7 files changed, 464 insertions(+), 365 deletions(-)


^ permalink raw reply	[relevance 7%]

Results 1-2 of 2 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2016-06-30  9:21  7% [PATCH 0/13] www: hybrid flat+thread conversation view Eric Wong
2016-06-30  9:21  6% ` [PATCH 07/13] view: show more nearby messages in flat thread view Eric Wong

Code repositories for project(s) associated with this public inbox

	https://80x24.org/public-inbox.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).