fix(thread-list): Show an attachment indicator using thread metadata

This commit is contained in:
Ben Gotow 2015-07-17 16:34:48 -07:00
parent 63f5c4091d
commit 741f360df5
3 changed files with 19 additions and 9 deletions

View file

@ -85,13 +85,14 @@ class ThreadList extends React.Component
name: "Message"
flex: 4
resolver: (thread) =>
attachments = []
if thread.hasAttachments
attachments = <div className="thread-icon thread-icon-attachment"></div>
attachment = []
hasAttachments = _.find (thread.metadata ? []), (m) -> m.files.length > 0
if hasAttachments
attachment = <div className="thread-icon thread-icon-attachment"></div>
<span className="details">
<span className="subject">{subject(thread.subject)}</span>
<span className="snippet">{thread.snippet}</span>
{attachments}
{attachment}
</span>
c4 = new ListTabular.Column
@ -111,16 +112,23 @@ class ThreadList extends React.Component
flex: 1
resolver: (thread) =>
pencil = []
attachment = []
hasDraft = _.find (thread.metadata ? []), (m) -> m.draft
hasAttachments = _.find (thread.metadata ? []), (m) -> m.files.length > 0
if hasDraft
pencil = <RetinaImg name="icon-draft-pencil.png" className="draft-icon" mode={RetinaImg.Mode.ContentPreserve} />
if hasAttachments
attachment = <div className="thread-icon thread-icon-attachment"></div>
<div>
<div style={display: 'flex'}>
<ThreadListIcon thread={thread} />
<ThreadListParticipants thread={thread} />
<span className="timestamp">{timestamp(thread.lastMessageTimestamp)}</span>
{pencil}
<span style={flex:1}></span>
{attachment}
<span className="timestamp">{timestamp(thread.lastMessageTimestamp)}</span>
</div>
<div className="subject">{subject(thread.subject)}</div>
<div className="snippet">{thread.snippet}</div>

View file

@ -83,8 +83,10 @@
position: relative;
text-overflow: ellipsis;
overflow: hidden;
flex-shrink:0;
top:2px;
// Shrink, but only after snippet has shrunk
flex-shrink:0.1;
}
.snippet {
font-size: @font-size-small;
@ -94,6 +96,7 @@
text-overflow: ellipsis;
overflow: hidden;
top:2px;
flex: 1;
}
.thread-icon {
flex-shrink:0;
@ -146,6 +149,8 @@
}
.thread-icon-attachment {
background-image:url(../static/images/thread-list/icon-attachment-@2x.png);
margin-right:-15px;
margin-left:0;
}
.thread-icon-unread {
background-image:url(../static/images/thread-list/icon-unread-@2x.png);
@ -250,7 +255,6 @@
.thread-list-narrow {
.timestamp {
flex: 1;
order: 100;
}
.participants {

View file

@ -116,6 +116,4 @@ class Thread extends Model
hasLabelName: (name) -> @hasCategoryName(name)
hasFolderName: (name) -> @hasCategoryName(name)
hasAttachments: null ## TODO
module.exports = Thread