Problem/Motivation

In the mail display we have changed the way how we display the header. We should allow hiding the all headers part for making the mail more readable for the user.

Proposed resolution

Implement a show/hide link to display or not the All headers part of the mail.

Remaining tasks

User interface changes

API changes

Data model changes

CommentFileSizeAuthor
#22 provide_a_show_hide-2822298-22.patch4.43 KBtduong
#22 interdiff-2822298-17-22.txt914 bytestduong
#22 Screen Shot 2016-10-28 at 09.57.44.png146.57 KBtduong
#18 Screen Shot 2016-10-28 at 08.34.25.png86.68 KBtduong
#17 interdiff-2822298-16-17.txt363 bytesjohnchque
#17 provide_a_show_hide-2822298-17.patch4.31 KBjohnchque
#16 Screenshot from 2016-10-27 11-37-36.png50.75 KBjohnchque
#16 interdiff-2822298-15-16.txt974 bytesjohnchque
#16 provide_a_show_hide-2822298-16.patch4.2 KBjohnchque
#15 interdiff-2822298-12-15.txt614 bytesjohnchque
#15 provide_a_show_hide-2822298-15.patch4.04 KBjohnchque
#14 Screenshot from 2016-10-27 10-03-41.png37.04 KBjohnchque
#14 Screenshot from 2016-10-27 10-03-37.png68.71 KBjohnchque
#12 interdiff-2822298-11-12.txt2.86 KBjohnchque
#12 provide_a_show_hide-2822298-12.patch3.37 KBjohnchque
#11 provide_a_show_hide-2822298-11.patch2.47 KBtduong
#11 interdiff-2822298-7-11.txt725 bytestduong
#7 Screenshot from 2016-10-26 12-09-04.png63.24 KBjohnchque
#7 Screenshot from 2016-10-26 12-09-01.png36.39 KBjohnchque
#7 interdiff-2822298-6-7.txt2.14 KBjohnchque
#7 provide_a_show_hide-2822298-7.patch2.48 KBjohnchque
#6 provide_a_show_hide-2822298-6.patch1.73 KBjohnchque
#4 Screenshot from 2016-10-26 09-49-18.png53.3 KBjohnchque
#4 Screenshot from 2016-10-26 09-49-14.png32.1 KBjohnchque
#4 provide_a_show_hide_2822298-4.patch1.7 KBjohnchque
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

yongt9412 created an issue. See original summary.

johnchque’s picture

Assigned: Unassigned » johnchque

Let's try this.

miro_dietiker’s picture

The expanded header should
- Not display the headers that are already output (from, to, ..)
- Be preformatted, including consideration of line wrappings, in fixed width format

johnchque’s picture

By now made the Hide / Show work, still need to implement the icon and add a better format to the all header thingy, not sure if we should remove the All header label.

Status: Needs review » Needs work

The last submitted patch, 4: provide_a_show_hide_2822298-4.patch, failed testing.

johnchque’s picture

Status: Needs work » Needs review
FileSize
1.73 KB

Sorry, branch one commit behind.

johnchque’s picture

johnchque’s picture

IMHO we should add the expand / hide before the All headers element so the link remains in the same place, which is more core-ish.
I would also remove the All Headers label.

miro_dietiker’s picture

Status: Needs review » Needs work

Starts to look good.

Yeah the Expand / Collapse link should be above the headers and stay there.
It should also not eat an extra line, doesn't need to be a block element.

The headers are still not wrapped on new line and should still use a fixed format (preformatted style) font.

mbovan’s picture

  1. +++ b/css/message.css
    @@ -19,9 +19,20 @@
    +  content: url(../../../core/misc/menu-collapsed-rtl.png);
    ...
    +  content: url(../../../core/misc/menu-expanded.png);
    

    Is this going to work if Inmail is not installed in /modules directory?

  2. +++ b/inmail.libraries.yml
    @@ -3,6 +3,10 @@ message:
    +    - core/jquery.once
    

    Not sure how complex is to implement this without jQuery... It would be cool for future Inmail Message element integrations to use plain JS to reduce dependencies as much as possible. Could be a followup.

  3. +++ b/js/inmail.js
    @@ -0,0 +1,34 @@
    +        var $link = $('<a href="#" class="more-link more-link__collapsed">' + Drupal.t('Expand header') + '</a>');
    

    Should we prefix classes with inmail?

Also, we load JS logic in teaser mode as well. I think it should be loaded only for the full view mode. Same applies for "Expand header" button which is now visible in teaser mode.

tduong’s picture

Status: Needs work » Needs review
FileSize
725 bytes
2.47 KB

I've just moved the header link to be displayed before the "All headers" block, thought that by removing the more-link from the a-Tag class removes the "block behaviour" (It should also not eat an extra line, doesn't need to be a block element.).

I was also trying to figure out where to break the "All headers" elements to be displayed each on a separate line but didnt had enough time for it.

Uploading a small progress here, not implementing the observations of comment #10 because I don't actualy know stuff about js/libraries and how they work together, sorry ^^'

EDIT: sorry, I took over this patch/issue because @miro_dietiker told me I could do/try something to make some little progress in here (since @yongt9412 and I work alternatively during Thursday afternoon resp. morning).

johnchque’s picture

Sorry, took longer than expected. now should be better, classes are nicer, link doesn't take a whole line and added pre tags to the header, also removed "All Headers" to make the display more similar to the mockups.

Status: Needs review » Needs work

The last submitted patch, 12: provide_a_show_hide-2822298-12.patch, failed testing.

johnchque’s picture

Status: Needs work » Needs review
FileSize
68.71 KB
37.04 KB

Here we go with the screenshots.

Which are similar to this mockup: https://www.drupal.org/files/issues/Screen%20Shot%202016-10-21%20at%2011... :)

johnchque’s picture

johnchque’s picture

OK, addressing all comments above, now the classes / ids are better. The css icons work when the module is not installed in modules/, also the font size of the pre has been reduced to 0.9 em's and finally it has a horizontal scroll when the screen is small. :).

johnchque’s picture

Ups sorry, last change. :)

tduong’s picture

+++ b/templates/inmail-message.html.twig
@@ -48,8 +52,7 @@
-      <label>All Headers</label>
-      {{ message.header.toString() }}
+      <pre>{{ message.header.toString() }}</pre>

Oh, that was the way... totally didn't think about this ._.
Nice :)

Actually I'm not sure if I'm missing something, but after applying your last patch and clear all caches, I still have the links eating a line and I don't have the horizontal scroll :/

miro_dietiker’s picture

Status: Needs review » Needs work

We are missing this on the preformatted container:

  overflow-x: scroll;
  white-space: pre;

So the lines stay as lines and don't wrap and we have a horizontal scrollbar if they are oversize.

miro_dietiker’s picture

The label "All headers" is semantically needed. We just hide it in CSS.

miro_dietiker’s picture

Using the multiple-attachments.eml example, it turns out the Message-ID line is wrapped into two lines still. We need to investigate where the newline is coming from, but that's a follow-up.

tduong’s picture

Implemented observations mentioned above.
Do we need a test for this layout ? Followup ?

Created followup: #2822786: multiple-attachments.eml Message-ID line is wrapped into two lines

  • miro_dietiker committed 2b32251 on 8.x-1.x authored by tduong
    Issue #2822298 by yongt9412, tduong, miro_dietiker: Provide a show /...
miro_dietiker’s picture

Status: Needs review » Fixed
+++ b/css/message.css
@@ -23,8 +23,13 @@
+  color: transparent;

Awesome, i like, but we do:
display: none

Fixed, committed.

Status: Fixed » Closed (fixed)

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