Skip to content

Commit

Permalink
Made some rough Attachment Size feedback (does not upload over 10 MB …
Browse files Browse the repository at this point in the history
…at present), Fixed some silly things with sidebar edit state mailpile#669
  • Loading branch information
bnvk committed Jun 19, 2014
1 parent 969f0b2 commit 0449844
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 9 deletions.
5 changes: 4 additions & 1 deletion static/default/html/partials/sidebar.html
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@
{{ render_sidebar_tag(tag) }}
{%- endfor -%}
</ul>
<a href="#" class="button-sidebar-edit" data-message="{{_("Done Editing")}}" data-state="done">{{_("Edit Sidebar")}}</a>
<a href="#" class="button-sidebar-edit" data-message="{{_("Done Editing")}}" data-state="done">
<span class="icon icon-settings"></span>
<span class="text">{{_("Edit Sidebar")}}</span>
</a>
</nav>
</div>
17 changes: 15 additions & 2 deletions static/default/js/app/compose.js
Original file line number Diff line number Diff line change
Expand Up @@ -625,7 +625,7 @@ var uploader = function(settings) {
multipart_params : {'mid': settings.mid},
file_data_name : 'file-data',
filters : {
max_file_size : '20mb',
max_file_size : '50mb',
mime_types: [
{title : "Audio files", extensions : "mp3,aac,flac,wav,ogg,aiff,midi"},
{title : "Document files", extensions : "pdf,doc,docx,xls"},
Expand Down Expand Up @@ -653,6 +653,8 @@ var uploader = function(settings) {
uploader.refresh();
},
FilesAdded: function(up, files) {
var start_upload = true;

plupload.each(files, function(file) {

// Show Preview while uploading
Expand All @@ -661,8 +663,19 @@ var uploader = function(settings) {
// Add to attachments
var attachment_html = '<li id="' + file.id + '">' + file.name + ' (' + plupload.formatSize(file.size) + ') <b></b></li>';
$('#compose-attachments-files').append(attachment_html);

console.log(file);

// Show Warning for 10mb or larger
if (file.size > 10485760) {
start_upload = false;
alert(file.name + ' is ' + plupload.formatSize(file.size) + '. Some people cannot receive attachments that are 10 mb or larger');
}
});
uploader.start();

if (start_upload) {
uploader.start();
}
},
UploadProgress: function(up, file) {
$('#' + file.id).find('b').html('<span>' + file.percent + '%</span>');
Expand Down
15 changes: 10 additions & 5 deletions static/default/js/app/sidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,9 @@ $(document).on('click', '.is-editing', function(e) {
$(document).on('click', '.button-sidebar-edit', function() {

var new_message = $(this).data('message');
var old_message = $(this).html();
var old_message = $(this).find('span.text').html();

// Make Editable
if ($(this).data('state') === 'done') {

// Disable Drag & Drop
Expand All @@ -53,9 +54,10 @@ $(document).on('click', '.button-sidebar-edit', function() {
});

// Update Edit Button
$(this).data('message', old_message).data('state', 'editing').html('<span class="icon-checkmark"></span> ' + new_message);
}
else {
$(this).data('message', old_message).data('state', 'editing');
$(this).find('span.icon').removeClass('icon-settings').addClass('icon-checkmark');

} else {

// Enable Drag & Drop
$('a.sidebar-tag').draggable({ disabled: false });
Expand All @@ -68,8 +70,11 @@ $(document).on('click', '.button-sidebar-edit', function() {
$('.sidebar-tag-archive').remove();

// Update Edit Button
$(this).data('message', old_message).data('state', 'done').html(new_message);
$(this).data('message', old_message).data('state', 'done');
$(this).find('span.icon').removeClass('icon-checkmark').addClass('icon-settings');
}

$(this).find('span.text').html(new_message);
});


Expand Down
1 change: 1 addition & 0 deletions static/default/less/app/compose.less
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
min-height: 225px;
padding: 10px 15px;
background: @grayLight;
border-bottom: 1px solid @grayMid;
}

.form-compose label {
Expand Down
6 changes: 5 additions & 1 deletion static/default/less/app/sidebar.less
Original file line number Diff line number Diff line change
Expand Up @@ -91,17 +91,21 @@

a.sidebar-tag span.sidebar-tag-archive {
cursor: pointer;
background: @orange;
background: @gray;
color: @white;
vertical-align: middle;
padding: 5px;
position: absolute;
top: 4px;
right: 0px;
font-size: 8px;
line-height: 8px;
border-radius: 10px;
}

a.sidebar-tag span.sidebar-tag-archive:hover {
background: @red;
}

/* Sidebar - Drag & Drop */

Expand Down

0 comments on commit 0449844

Please sign in to comment.