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 6/6] view: reduce clutter for attachments w/o description
  @ 2016-05-19 21:28  7%   ` Eric Wong
  0 siblings, 0 replies; 1+ results
From: Eric Wong @ 2016-05-19 21:28 UTC (permalink / raw)
  To: meta

For attachments without a filename or description, reduce
the amount of precious screen space required to display
a link to it.
---
 lib/PublicInbox/View.pm | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/lib/PublicInbox/View.pm b/lib/PublicInbox/View.pm
index 2303a1f..ec5f390 100644
--- a/lib/PublicInbox/View.pm
+++ b/lib/PublicInbox/View.pm
@@ -260,7 +260,6 @@ sub attach_link ($$$$) {
 	my $desc = $part->header('Content-Description');
 	$desc = $fn unless defined $desc;
 	$desc = '' unless defined $desc;
-	$desc = ': '.$desc if $desc;
 	my $sfn;
 	if (defined $fn && $fn =~ /\A[\w\.-]+[a-zA-Z0-9]\z/) {
 		$sfn = $fn;
@@ -269,8 +268,10 @@ sub attach_link ($$$$) {
 	} else {
 		$sfn = 'a.bin';
 	}
-	qq($nl<a\nhref="$upfx$idx-$sfn">[-- Attachment #$idx$desc --]\n) .
-	"[-- Type: $ct, Size: $size bytes --]</a>"
+	my @ret = qq($nl<a\nhref="$upfx$idx-$sfn">[-- Attachment #$idx: );
+	my $ts = "Type: $ct, Size: $size bytes";
+	push(@ret, ($desc eq '') ? "$ts --]" : "$desc --]\n[-- $ts --]");
+	join('', @ret, '</a>');
 }
 
 sub add_text_body {
-- 
EW


^ permalink raw reply	[relevance 7%]

Results 1-1 of 1 | reverse | sort options + mbox downloads above
-- links below jump to the message on this page --
2016-05-19 21:25     [PATCH 1/7] view: rely on Email::MIME::body_str for decoding Eric Wong
2016-05-19 21:28     ` [PATCH 1/6] msg_iter: new internal API for iterating through MIME Eric Wong
2016-05-19 21:28  7%   ` [PATCH 6/6] view: reduce clutter for attachments w/o description Eric Wong

Code repositories for project(s) associated with this 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).