-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Attachments in compose and reply #23
Changes from 24 commits
258e5a0
bf409ca
70904c4
fee5805
f62b388
6a7d37d
c2bce03
4b7ea4f
396dc4e
d32c9e5
0fc3788
8e443e6
927c798
49b23b7
3d173ea
cce3d60
5eef612
163687c
b94d025
2e78137
7aaddd2
c238259
167b8b1
b66dce2
75bbc71
e8e9031
4048749
48ed7a8
9de1f24
f6ae85e
ca5350b
76e22aa
3dcec24
d48ad79
2071b8a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -66,12 +66,13 @@ e2email.pages.messages.MessagesCtrl = function( | |
/** | ||
* Contains the state related to any replies by the user | ||
* for this thread. | ||
* @type {!{baseTitle: string, showText: boolean, content: ?string}} | ||
* @type {!{baseTitle: string, showText: boolean, content: ?string, attachments: Array<Object>}} | ||
*/ | ||
this.reply = { | ||
'baseTitle': 'reply', | ||
'content': null, | ||
'showText': false | ||
'showText': false, | ||
'attachments': [] | ||
}; | ||
|
||
// Run an async task to fetch/decrypt messages in this thread | ||
|
@@ -95,6 +96,36 @@ MessagesCtrl.prototype.cancelReply = function(opt_event) { | |
this.reply['baseTitle'] = 'reply'; | ||
this.reply['content'] = null; | ||
this.reply['showText'] = false; | ||
this.reply['attachments'] = []; | ||
}; | ||
|
||
|
||
/** | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The function description is missing, same below. |
||
* @param {string} name of the file | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 'name of the file' => "The name of the file.", same for other parameters. |
||
* @param {string} type of the file | ||
* @param {string} contents of the file in a string format | ||
* @param {number} size of the file | ||
* @export | ||
*/ | ||
MessagesCtrl.prototype.onFileUpload = function(name, type, contents, size) { | ||
var obj = { | ||
'filename': name, | ||
'type': type, | ||
'encoding': 'base64', | ||
'content': contents, | ||
'size': size | ||
}; | ||
this.reply.attachments.push(obj); | ||
}; | ||
|
||
|
||
/** | ||
* @export | ||
*/ | ||
MessagesCtrl.prototype.removeObj = function() { | ||
if (this.reply.attachments != []) { | ||
this.reply.attachments.pop(); | ||
} | ||
}; | ||
|
||
|
||
|
@@ -109,6 +140,7 @@ MessagesCtrl.prototype.onReply = function() { | |
this.reply['showText'] = true; | ||
this.reply['baseTitle'] = 'send'; | ||
this.reply['content'] = null; | ||
this.reply['attachments'] = []; | ||
setTimeout(function() { | ||
document.querySelector('textarea').focus(); | ||
document.querySelector('#replyButton').scrollIntoView(); | ||
|
@@ -117,7 +149,8 @@ MessagesCtrl.prototype.onReply = function() { | |
var messageLength = this.reply['content'].length; | ||
this.gmailService_.encryptAndSendMail( | ||
this.thread.to, this.threadId_, this.thread.messageId, | ||
this.thread.subject, this.reply['content']).then(goog.bind(function() { | ||
this.thread.subject, this.reply['content'], this.reply['attachments']). | ||
then(goog.bind(function() { | ||
return this.gmailService_.refreshThread(this.threadId_); | ||
}, this)).then(goog.bind(this.cancelReply, this)); | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
margin-bottom: 1em; | ||
} | ||
|
||
.email-detail-from { | ||
.email-detail-from { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's a selector with no definitions, please remove. |
||
|
||
} | ||
|
||
|
@@ -25,6 +25,7 @@ | |
.email-subject { | ||
font-family: Roboto; | ||
color: #505050; | ||
text-align: left !important; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. text-align: left is probably not needed here and in .email-text-content |
||
} | ||
|
||
.email-mime-entry { | ||
|
@@ -34,6 +35,7 @@ | |
|
||
.email-text-content { | ||
white-space: pre-line; | ||
text-align: left !important; | ||
} | ||
|
||
.email-image-content { | ||
|
@@ -49,3 +51,19 @@ | |
border: 1px solid rgba(0,0,0,0.25); | ||
white-space: pre-line; | ||
} | ||
|
||
.single-attachment-received { | ||
background-color: #f5f5f5; | ||
border: 1px solid #dcdcdc; | ||
font-weight: bold; | ||
font-size: 13px; | ||
margin: 0 7px 6px; | ||
color: #1155CC !important; | ||
overflow-y: hidden; | ||
text-align: left; | ||
padding: 2px 6px; | ||
max-width: 448px; | ||
width: 80%; | ||
height: 23px; | ||
margin-bottom: -5px; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
<div class="container"> | ||
<div class="row"> | ||
<div class="col-xs-12"> | ||
<button ng-click="messagesCtrl.showThreads()" class="btn btn-primary btn-focus col-xs-3"> | ||
<button ng-click="messagesCtrl.showThreads()" class="btn btn-primary btn-focus col-xs-3 sidebtnlarge"> | ||
<span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span> | ||
{{'inbox' | translate}} | ||
</button> | ||
|
@@ -38,22 +38,27 @@ <h4 class="col-xs-12 page-header email-subject selectable">{{messagesCtrl.thread | |
</div> | ||
<div class="row email-mime-entry" ng-repeat="mime in mail.mimeContent" ng-show="mail.mimeContent"> | ||
<img class="fade-show email-image-content" ng-src="{{mime.content}}" ng-if="mime.type=='image'"> | ||
<div class="email-text-content col-xs-12" ng-if="mime.type=='text'">{{mime.content}} | ||
</div> | ||
<div class="col-xs-12" ng-if="mime.type=='unsupported'"> | ||
<div class="col-xs-12 email-unsupported-content text-warning">{{mime.content}}</div> | ||
</div> | ||
<div class="email-text-content col-xs-12" ng-if="mime.type=='text'">{{mime.content}}</div> | ||
<div class="col-xs-12 single-attachment-received" ng-if="mime.url"> <a href="{{mime.url}}" download>{{mime.filename}}</div> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The download attribute can have a value https://developers.google.com/web/updates/2011/08/Downloading-resources-in-HTML5-a-download : Please use the download="{{mime.filename}}" |
||
<div class="email-error-content text-danger col-xs-12" ng-if="mime.type=='error'">{{mime.content}}</div> | ||
</div> | ||
</li> | ||
</ul> | ||
|
||
<form class="email-detail-reply-form fade-show" ng-show="messagesCtrl.thread.mails[messagesCtrl.thread.mails.length-1].mimeContent && !messagesCtrl.thread.mails[messagesCtrl.thread.mails.length-1].hasErrors" ng-submit="messagesCtrl.onReply()"> | ||
<textarea ng-show="messagesCtrl.reply.showText" class="form-control fade-show" placeholder="{{'typeReplyPlaceholder' | translate}}" ng-model="messagesCtrl.reply.content" rows="10"></textarea> | ||
<div id="textareaSpace" ng-show="messagesCtrl.reply.showText"> | ||
<textarea id="textareaElement" class="form-control fade-show" placeholder="{{'typeReplyPlaceholder' | translate}}" ng-model="messagesCtrl.reply.content" rows="10"></textarea> | ||
<div id="attachmentRepeat"> | ||
<div ng-repeat="x in messagesCtrl.reply.attachments" class="single-attachment"><span style="margin: 0px; padding:0px;overflow-y: hidden; width:60%;">{{ x.filename | limitTo: 20 }}{{x.filename.length > 20 ? '...' : ''}} </span> <span style="width:30%; overflow-y:hidden;"> {{' (' + x.size/1000 + | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Move the inline style rules to some CSS class. |
||
' K)'}}</span> <span style="width:10%;"> | ||
<button ng-click="threadsCtrl.removeObj()" class="removeAttachment"> x </button> </span></div> | ||
</div> | ||
</div> | ||
<div class="row email-detail-reply-form-button-row"> | ||
<div class="col-xs-12"> | ||
<button id="replyButton" type="submit" class="col-xs-3 btn btn-primary btn-focus pull-right">{{messagesCtrl.reply.baseTitle | translate}}</button> | ||
<button style="margin-top: 1em;" ng-click="messagesCtrl.cancelReply($event)" ng-show="messagesCtrl.reply.showText" class="btn btn-link btn-focus pull-right fade-show">{{'cancel' | translate}}</button> | ||
<button id="replyButton" type="submit" class="col-xs-3 btn btn-primary btn-focus pull-right sidebtn">{{messagesCtrl.reply.baseTitle | translate}}</button> | ||
<button style="margin-top: 1em;" ng-click="messagesCtrl.cancelReply($event)" ng-show="messagesCtrl.reply.showText" class="btn btn-link btn-focus pull-right fade-show sidebtn">{{'cancel' | translate}}</button> | ||
<img src="assets/img/attach2.png" class="attach-img" ng-show="messagesCtrl.reply.showText" as-upload="messagesCtrl.onFileUpload(name, type, contents, size)"/> | ||
</div> | ||
</div> | ||
</form> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we make a
@typedef
of the attachments and makeattachments
and `Array<...Attachment>' ? The mail model file would be a good fit for this new typedef.