-
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
Threads controller UI and removing attachments #28
Changes from 41 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
6a96d34
c60c039
30881f1
ccc91c0
38444f1
a6ef384
e7ac26a
0add0a6
f013f4c
7e059b9
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 |
---|---|---|
|
@@ -159,6 +159,77 @@ div.big-icon > img { | |
cursor: pointer; | ||
} | ||
|
||
.attach-icon { | ||
margin-top: 13px; | ||
} | ||
|
||
.attach-icon:hover { | ||
fill: #66afe9; | ||
} | ||
|
||
.sidebtn { | ||
width: 70px; | ||
height: 30px; | ||
font-size: 12px; | ||
padding: 0; | ||
float: 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. Using |
||
} | ||
|
||
.sidebtnlarge { | ||
width: 100px; | ||
height: 35px; | ||
font-size: 15px; | ||
padding: 0px; | ||
float: left !important; | ||
} | ||
|
||
.single-attachment { | ||
background-color: #f5f5f5; | ||
border: 1px solid #dcdcdc; | ||
font-weight: bold; | ||
font-size: 13px; | ||
margin: 0 7px 6px; | ||
color: #1155CC !important; | ||
text-align: left; | ||
padding: 2px 6px; | ||
max-width: 448px; | ||
width: 80%; | ||
height: 23px; | ||
display: flex; | ||
} | ||
|
||
#textareaSpace { | ||
min-height: 250px; | ||
max-height: 500px; | ||
overflow: auto; | ||
background-color: white; | ||
} | ||
|
||
#textareaElement { | ||
flex;flex-direction: column; | ||
min-height: 250px; | ||
text-align: left; | ||
border: none; | ||
background-color: white; | ||
outline: none; | ||
resize: none; | ||
margin-bottom: 0px; | ||
} | ||
|
||
#attachmentRepeat { | ||
background-color: white; | ||
min-height: 20px; | ||
padding-top: 10px; | ||
display: flex; | ||
flex-direction: column; | ||
} | ||
|
||
.removeAttachment { | ||
border: none; | ||
font-size: 13px; | ||
color: gray; | ||
background-color: inherit; | ||
margin: 0 !important; | ||
padding: 0; | ||
float: right; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -176,7 +176,7 @@ e2email.pages.threads.ThreadsCtrl = function( | |
* invalidRecipient: ?string, | ||
* subject: ?string, | ||
* message: ?string, | ||
* attachments: Array<Object> | ||
* attachments: Array<e2email.models.mail.Attachment> | ||
* }} | ||
*/ | ||
e2email.pages.threads.ThreadsCtrl.Compose; | ||
|
@@ -478,6 +478,24 @@ ThreadsCtrl.prototype.onFileUpload = function(name, type, contents, size) { | |
}; | ||
|
||
|
||
/** | ||
* Removes the attachment object from the list of attachments. | ||
* @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. The name of the file. |
||
* @export | ||
*/ | ||
ThreadsCtrl.prototype.removeObj = function(name) { | ||
var at = this.compose.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. Better way to remove an element from an Array is to use goog.array.removeIf. E.g.
However, can you guarantee that the filename is unique in the attachments list? Does it e.g. also contain the filepath? A user might want to attach two files of a same filename from different directories. If this is for the purpose of removing attachments upon user click, the object you click on should identify the attachments by an ever-increasing counter. You could e.g. reuse the array index for that, but then instead of removing the attachment you'd set the value at certain index to null and you'd use The better solution is to use goog.structs.Map instead of an array and generate keys upon adding from e.g. a Threads-controller property attachmentsCounter (it would ++ every time new attachment is added to the map and used as a Map key). You'd have to store the map key in some UI element property and use it in Map.remove(). To iterate over a map in Angular, use |
||
|
||
if (at != []) { | ||
var i; | ||
for (i = at.length - 1; i >= 0; i--) { | ||
if (at[i].filename == name) | ||
at.splice(i, 1); | ||
} | ||
} | ||
}; | ||
|
||
|
||
/** | ||
* Requests the contents of the compose model to be delivered. | ||
* @export | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -56,21 +56,28 @@ | |
</div> | ||
|
||
<input tabindex="2" type="text" class="form-control ac-tabbable email-main-subject-input" placeholder="Subject" required="required" ng-hide="threadsCtrl.compose.missingRecipient" ng-model="threadsCtrl.compose.subject" ng-keypress="threadsCtrl.onSubjectKeyPress($event)"/> | ||
<div class="compose-content"> | ||
<div tabindex="3" id="textareaSpace"> | ||
<textarea id="textareaElement" class="form-control email-main-compose-textarea" placeholder="{{threadsCtrl.compose.validRecipient ? 'typeMessagePlaceholder' : 'invalidRecipientPlaceholder' | translate}}" rows="10" ng-disabled="!threadsCtrl.compose.validRecipient" ng-model="threadsCtrl.compose.message" ng-hide="threadsCtrl.compose.missingRecipient" required="required"> | ||
</textarea> | ||
</textarea> </div> | ||
<div id="attachmentRepeat"> | ||
<div ng-repeat="x in threadsCtrl.compose.attachments" class="single-attachment">{{x.filename + ' (' + x.size + 'K)'}}</div> | ||
</div> | ||
<div ng-repeat="x in threadsCtrl.compose.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 + ')'}} </span> <span style="width:10%;"> | ||
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. Alternatively, use 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 to a class. |
||
<button ng-click="threadsCtrl.removeObj(x.filename)" class="removeAttachment"> x </button> </span></div> | ||
</div> | ||
<div class="row email-main-compose-form-button-row" ng-hide="threadsCtrl.compose.missingRecipient"> | ||
</div> | ||
<div class="row email-main-compose-form-button-row"> | ||
<div class="col-xs-12"> | ||
<button tabindex="4" type="submit" class="col-xs-3 btn btn-primary btn-focus sidebtn">{{'send' | translate}}</button> | ||
<button tabindex="5" ng-click="threadsCtrl.showCompose(false)" class="btn btn-link btn-focus sidebtn">{{'cancel' | translate}}</button> | ||
<img tabindex="6" src="assets/img/attach.png" class="attach-img" as-upload="threadsCtrl.onFileUpload(name, type, contents, size)"/> | ||
<span tabindex="6" class="attach-img" as-upload="threadsCtrl.onFileUpload(name, type, contents, size)"> | ||
<svg class="attach-icon" xmlns="http://www.w3.org/2000/svg" width="24px" height="24px" viewBox="0 0 24 24" fill="#757575"> | ||
<path d="M16.5 6v11.5c0 2.21-1.79 4-4 4s-4-1.79-4-4V5c0-1.38 1.12-2.5 2.5-2.5s2.5 1.12 2.5 2.5v10.5c0 .55-.45 1-1 1s-1-.45-1-1V6H10v9.5c0 1.38 1.12 2.5 2.5 2.5s2.5-1.12 2.5-2.5V5c0-2.21-1.79-4-4-4S7 2.79 7 5v12.5c0 3.04 2.46 5.5 5.5 5.5s5.5-2.46 5.5-5.5V6h-1.5z"/> | ||
<path d="M0 0h24v24H0z" fill="none"/> | ||
</svg> | ||
</span> | ||
</div> | ||
</div> | ||
</form> | ||
</form> | ||
|
||
<ul class="list-unstyled"> | ||
<li class="email-subject-entry btn-focus" ng-repeat="thread in threadsCtrl.threads|orderBy:'-updated'" ng-click="threadsCtrl.showMessages(thread.id)"> | ||
|
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.
Why are attachment-specific definitions needed in app.css? Do they need to be shared across pages?
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.
The CSS for the attachment icon and attachment input/display is in two pages: Threads.html and Messages.html, I put it on app.css not to have repetitive code.