List attachments, fix list item positioning
parent
4c9e6c3d3a
commit
2abe972ff3
|
@ -167,24 +167,24 @@ var MessageList = React.createClass({
|
|||
},
|
||||
getPageSize: function()
|
||||
{
|
||||
return Math.round(this.refs.scroll.offsetHeight / (this.props.layout == 'message-on-right' ? 60 : 30));
|
||||
return Math.floor(this.refs.scroll.offsetHeight / (this.props.layout == 'message-on-right' ? 60 : 30));
|
||||
},
|
||||
getItemOffset: function(index)
|
||||
{
|
||||
var n = 0, top = this.refs.title.offsetHeight, p;
|
||||
var n = 0, top = 0, p;
|
||||
var h = (this.props.layout == 'message-on-right' ? 60 : 30);
|
||||
for (var i = 0; i < (this.props.groups||[]).length; i++)
|
||||
{
|
||||
p = n;
|
||||
n += (i > 0 ? 1 : 0)+this.props.groups[i].messageCount;
|
||||
if (index < n)
|
||||
{
|
||||
if (index > p)
|
||||
top += (i > 0 ? 30 : 0) + (this.props.layout == 'message-on-right' ? 60 : 30)*(index-p-1);
|
||||
top += (index > p && i > 0 ? 30+h*(index-p-1) : h*(index-p));
|
||||
break;
|
||||
}
|
||||
top += (i > 0 ? 30 : 0) + (this.props.layout == 'message-on-right' ? 60 : 30)*this.props.groups[i].messageCount;
|
||||
top += (i > 0 ? 30 : 0) + h*this.props.groups[i].messageCount;
|
||||
}
|
||||
return [ top, (this.props.layout == 'message-on-right' && (index == 0 || index != p) ? 60 : 30) ];
|
||||
return [ top, index == p && i > 0 ? 30 : h ];
|
||||
},
|
||||
getScrollPaddingTop: function()
|
||||
{
|
||||
|
@ -262,6 +262,14 @@ var MessageList = React.createClass({
|
|||
})}
|
||||
</div>
|
||||
</div>
|
||||
},
|
||||
componentDidMount: function()
|
||||
{
|
||||
window.addEventListener('resize', this.changeFirstDay);
|
||||
},
|
||||
componentWillUnmount: function()
|
||||
{
|
||||
window.removeEventListener('resize', this.changeFirstDay);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -53,7 +53,6 @@ var MessageView = React.createClass({
|
|||
});
|
||||
}
|
||||
}
|
||||
// TODO list attachments
|
||||
return <div className={'message-view'+(!msg ? ' no-mail-shown' : '')+(!this.props.quickReply ? ' no-quick' : '')}>
|
||||
<div className="actions">
|
||||
<DropDownButton dropdownId="reply" icon="mail_reply" text="Reply" />
|
||||
|
@ -110,7 +109,17 @@ var MessageView = React.createClass({
|
|||
{msg.props.replyto ?
|
||||
<div className="header">
|
||||
<div className="field">Reply-to</div>
|
||||
<div className="value"><a className="button">{msg.props.replyto[0]+' <'+msg.props.replyto[1]+'>'}</a></div>
|
||||
<div className="value">
|
||||
{[msg.props.replyto].map(a => <a className="button" title={a[0] ? a[0]+' <'+a[1]+'>' : a[1]}>{a[0] || a[1]}</a>)}
|
||||
</div>
|
||||
</div>
|
||||
: null}
|
||||
{msg.props.attachments && msg.props.attachments.length ?
|
||||
<div className="header">
|
||||
<div className="field">Attachments</div>
|
||||
<div className="value">
|
||||
{msg.props.attachments.map(a => <a className="button" title={a[0]}>{a[0]+' ('+Util.formatBytes(a[2])+')'}</a>)}
|
||||
</div>
|
||||
</div>
|
||||
: null}
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue