Skip to content

Commit

Permalink
File attachments: show file size, bold filename, make icon bigger
Browse files Browse the repository at this point in the history
FREEBIE
  • Loading branch information
scottnonnenberg committed May 9, 2017
1 parent 2a04fa0 commit ee00ad0
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 17 deletions.
7 changes: 5 additions & 2 deletions background.html
Expand Up @@ -152,8 +152,11 @@ <h3>{{ welcomeToSignal }}</h3>
<a class='x close' alt='remove attachment' href='#'></a>
</script>
<script type='text/x-tmpl-mustache' id='file-view'>
<span class='icon'></span>
<span class='fileName' alt='{{ fileName }}' title='{{ altText }}'>{{ fileName }}</a>
<div class='icon'></div>
<div class='text'>
<div class='fileName' alt='{{ fileName }}' title='{{ altText }}'>{{ fileName }}</div>
<div class='fileSize'>{{ fileSize }}</div>
</div>
</script>
<script type='text/x-tmpl-mustache' id='hasRetry'>
{{ messageNotSent }}
Expand Down
14 changes: 9 additions & 5 deletions js/views/attachment_view.js
Expand Up @@ -9,10 +9,7 @@
className: 'fileView',
templateName: 'file-view',
render_attributes: function() {
return {
fileName : this.model.fileName,
altText : i18n('unsupportedAttachment')
};
return this.model;
}
});

Expand Down Expand Up @@ -163,7 +160,14 @@
this.renderFileView();
},
renderFileView: function() {
this.view = new FileView({model: {fileName: this.suggestedName()}});
this.view = new FileView({
model: {
fileName: this.suggestedName(),
fileSize: window.filesize(this.model.size),
altText: i18n('unsupportedAttachment')
}
});

this.view.$el.appendTo(this.$el.empty());
this.view.render();
this.update();
Expand Down
17 changes: 13 additions & 4 deletions stylesheets/_conversation.scss
Expand Up @@ -466,21 +466,30 @@ li.entry .error-icon-container {
}

.fileView {
display: flex;
align-items: center;

position: relative;
padding: 5px;
padding-right: 10px;

background-color: #fafafa;
border: 1px solid $grey_l2;
border-radius: $border-radius;
cursor: pointer;
color: $grey_d;

.icon, .fileName {
.fileName {
font-weight: bold;
margin-bottom: 0.25em;
}

.icon, .text {
opacity: 0.75;
}

&:hover {
.icon, .fileName {
.icon, .text {
opacity: 1.0;
}
}
Expand All @@ -491,8 +500,8 @@ li.entry .error-icon-container {
&:before {
content: '';
display: inline-block;
width: $button-height;
height: $button-height;
width: $button-height * 2;
height: $button-height * 2;
@include color-svg('/images/file.svg', black);
}
}
Expand Down
18 changes: 12 additions & 6 deletions stylesheets/manifest.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit ee00ad0

Please sign in to comment.