Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
The teaser currently just shows some subject, recipient, sender, ...
But nothing about the mail content.
Proposed resolution
Display the first characters from the email teaser.
This allows a user to understand much more about what is part of a message.
Gmail does this greatly.
User interface changes
Display the first few words from plain text body in email teaser.
"g" alt="" />
Comment | File | Size | Author |
---|---|---|---|
#9 | interdiff-2805513-7-9.txt | 4.61 KB | ModernMantra |
#9 | display_text-2805513-9.patch | 2.08 KB | ModernMantra |
| |||
#7 | Screenshot from 2016-09-27 17-39-08.png | 16.29 KB | ModernMantra |
#7 | Screenshot from 2016-09-27 17-38-49.png | 12.46 KB | ModernMantra |
#7 | interdiff-2805513-5-7.txt | 3.21 KB | ModernMantra |
Comments
Comment #2
miro_dietikerIMHO very important for a nice UX.
Comment #3
ModernMantra CreditAttribution: ModernMantra at MD Systems GmbH for MD Systems GmbH commentedMade some progress, not sure what number of characters to use for wrap. Also, i hope that showing plain text in new line(after subject, from, to) is good choice... :)
Comment #4
miro_dietikerDisplay = Screenshot
Outputting the body on a new line is pretty fine. But it should be limited to that one line.
Technically, the teaser plain text should be limited to some value like 1k to avoid loading huge body.
The display of "..." is called "ellipsis" and there are CSS formatting options to make the browser dynamically do this.
http://www.w3schools.com/cssref/css3_pr_text-overflow.asp
Comment #5
ModernMantra CreditAttribution: ModernMantra at MD Systems GmbH for MD Systems GmbH commentedIMHO, comment #4 bit messed up stuff in my head :). By some research, at the end found there are two possibly ways to solve this task: either use only css (specify width of tag and use '
ellipsis property
') which can not be used together withslice(number_of_chars)
. Or, another approach is to use slice function and simply append to string'...'
(no css at all). So overall, IMHO i think it is not possible to use at the same time slice(1000) & css(ellipsis). So in patch it is used css approach (there is screenshot) as suggested in comment #4 with width of tag250px
... Hope creator of the issue/idea will be satisfied :)Comment #6
miro_dietikerAs discussed the idea of an ellipsis is to make sure that the single line doesn't wrap. We don't want to set an arbitrary width limit.
And don't forget to always apply the truncate function with a max limit. \Drupal\Component\Utility\Unicode::truncate
Comment #7
ModernMantra CreditAttribution: ModernMantra at MD Systems GmbH for MD Systems GmbH commentedComment #8
miro_dietikerAlmost. The API should still return the full untruncated body. If i ask if a plaintext body, it needs to be complete.
You want to truncate it before outputting into the template.
Comment #9
ModernMantra CreditAttribution: ModernMantra at MD Systems GmbH for MD Systems GmbH commentedMade some changes regarding previous comment, also patch is modified a bit because of some other commits.
Comment #10
miro_dietikerYes, this works for me. Committed!
BTW interdiffs usually don't make sense if larger than the patch or if you majorly change direction.