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.
Only local images are allowed."g" alt="" />

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

miro_dietiker created an issue. See original summary.

miro_dietiker’s picture

Priority: Normal » Major

IMHO very important for a nice UX.

ModernMantra’s picture

Assigned: Unassigned » ModernMantra
Status: Active » Needs review
FileSize
2.55 KB

Made 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... :)

miro_dietiker’s picture

Status: Needs review » Needs work

Display = 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

ModernMantra’s picture

Issue summary: View changes
Status: Needs work » Needs review
FileSize
3.22 KB
2.6 KB
12.95 KB

IMHO, 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 with slice(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 tag 250px... Hope creator of the issue/idea will be satisfied :)

miro_dietiker’s picture

Status: Needs review » Needs work

As 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

ModernMantra’s picture

miro_dietiker’s picture

Status: Needs review » Needs work

Almost. 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.

ModernMantra’s picture

Status: Needs work » Needs review
FileSize
2.08 KB
4.61 KB

Made some changes regarding previous comment, also patch is modified a bit because of some other commits.

miro_dietiker’s picture

Issue summary: View changes
Status: Needs review » Fixed

Yes, this works for me. Committed!

BTW interdiffs usually don't make sense if larger than the patch or if you majorly change direction.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.