You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@whimsical.apache.org by se...@apache.org on 2022/06/23 20:52:13 UTC
[whimsy] branch master updated: Crop long fields (tends to be spam)
This is an automated email from the ASF dual-hosted git repository.
sebb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/whimsy.git
The following commit(s) were added to refs/heads/master by this push:
new 9f98f30d Crop long fields (tends to be spam)
9f98f30d is described below
commit 9f98f30dead9703de1b2993f179da4d7aed0700b
Author: Sebb <se...@apache.org>
AuthorDate: Thu Jun 23 21:52:04 2022 +0100
Crop long fields (tends to be spam)
---
www/secretary/workbench/views/index.js.rb | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/www/secretary/workbench/views/index.js.rb b/www/secretary/workbench/views/index.js.rb
index 73da8e5a..5f62e076 100644
--- a/www/secretary/workbench/views/index.js.rb
+++ b/www/secretary/workbench/views/index.js.rb
@@ -15,6 +15,14 @@ class Index < Vue
@fetched = false
end
+ # crop a value before display
+ def _crop(text, max)
+ if text and text.length > max
+ return text[0..max] + ' ...'
+ end
+ return text
+ end
+
def render()
log 'render'
if not @messages or @messages.all? {|message| message.status == :deleted}
@@ -51,7 +59,7 @@ class Index < Vue
_a message.date, href: message.href, title: message.time
end
end
- _td message.from
+ _td _crop(message.from, 40)
if %i[emeritusReady emeritusPending].include? message.status
_td do
_a message.subject, class: message.status, href: message.href2, target: "_blank"
@@ -63,7 +71,7 @@ class Index < Vue
_b message.secmail.inspect # TODO better presentation of content
end
else
- _td message.subject
+ _td _crop(message.subject, 60)
end
end
end