Skip to content

Commit

Permalink
Renmaed statusMessage to mailpile.notification and replaced code thro…
Browse files Browse the repository at this point in the history
…ughout other JS calls
  • Loading branch information
bnvk committed Jan 10, 2014
1 parent 73d2b38 commit a3e3a41
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 45 deletions.
6 changes: 2 additions & 4 deletions static/default/js/app/compose.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ MailPile.prototype.compose = function(data) {
if (response.status == 'success') {
window.location.href = mailpile.urls.message_draft + response.result.created + '/';
} else {
statusMessage(response.status, response.message);
mailpile.notification(response.status, response.message);
}
});
}
Expand All @@ -37,7 +37,6 @@ $('#search-query').attr('tabindex', '-1');

var composeContactSelected = function(contact) {
if (contact.object.flags.secure) {
console.log('Whee keys ' + contact.object.keys[0].fingerprint);
$('.message-privacy-state').attr('title', 'The message is encrypted. The recipients & subject are not');
$('.message-privacy-state').removeClass('icon-unencrypted').addClass('icon-encrypted');
$('.message-privacy-state').parent().addClass('bounce');
Expand Down Expand Up @@ -113,7 +112,6 @@ $('#compose-to, #compose-cc, #compose-bcc').select2({
return {"id": term, "fn": term, "address": term, "flags": { "secure" : false }};
} else {
return {"id": term, "fn": term, "address": term, "flags": { "secure" : false }};
console.log('Yo duder: ' + term)
}
},
formatResult: formatComposeResult,
Expand Down Expand Up @@ -188,7 +186,7 @@ $(document).on('click', '.compose-action', function(e) {
window.location.href = mailpile.urls.message_sent + response.result.messages[0].mid;
}
else {
statusMessage(response.status, response.message);
mailpile.notification(response.status, response.message);
}
}
});
Expand Down
19 changes: 1 addition & 18 deletions static/default/js/app/notifications.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,4 @@
var statusHeaderPadding = function() {

if ($('#header').css('position') === 'fixed') {
var padding = $('#header').height() + 50;
}
else {
var padding = 0;
}

return padding;
};


var statusMessage = function(status, message_text, complete, complete_action) {
MailPile.prototype.notification = function(status, message_text, complete, complete_action) {

var default_messages = {
"success" : "Success, we did exactly what you asked.",
Expand All @@ -30,9 +17,6 @@ var statusMessage = function(status, message_text, complete, complete_action) {
// Show Message
message.find('span.message-text').html(message_text),
message.fadeIn(function() {

// Set Padding Top for #content
// $('#header').css('padding-top', statusHeaderPadding());
});

// Complete Action
Expand All @@ -55,7 +39,6 @@ var statusMessage = function(status, message_text, complete, complete_action) {

$(document).ready(function() {


/* Message Close */
$('.message-close').on('click', function() {
$(this).parent().fadeOut(function() {
Expand Down
22 changes: 10 additions & 12 deletions static/default/js/app/pile.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,15 @@ var pileAjaxTag = function(tag_add) {
$.each(mailpile.bulk_cache, function(key, mid) {
$('#pile-message-' + mid).fadeOut('fast');
});

// Empty Bulk Cache
mailpile.bulk_cache = [];

} else {
statusMessage(response.status, response.message);
mailpile.notification(response.status, response.message);
}
}
});

}


Expand All @@ -78,7 +77,6 @@ $(document).on('click', '.bulk-action', function(e) {
else if (action == 'assign-tags') {

}

});


Expand Down Expand Up @@ -176,10 +174,10 @@ $('li.sidebar-tags-draggable').droppable({
}
return '';
}
// Add MID to Cache

// Add MID to Cache
mailpile.bulk_cache_add(ui.draggable.parent().data('mid'));

// Fire at Willhelm
$.ajax({
url : mailpile.api.tag,
Expand All @@ -198,14 +196,14 @@ $('li.sidebar-tags-draggable').droppable({
$.each(mailpile.bulk_cache, function(key, mid) {
$('#pile-message-' + mid).fadeOut('fast');
});

// Empty Bulk Cache
mailpile.bulk_cache = [];

} else {
statusMessage(response.status, response.message);
mailpile.notification(response.status, response.message);
}
}
});
});
}
});
2 changes: 1 addition & 1 deletion static/default/js/app/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ $(document).on('submit', '#form-profile-add', function(e) {
dataType : 'json',
success : function(response) {

statusMessage(response.status, response.message);
mailpile.notification(response.status, response.message);
if (response.status === 'success') {
console.log(response);
}
Expand Down
2 changes: 1 addition & 1 deletion static/default/js/app/tags.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ $(document).on('submit', '#form-tag-add', function(e) {
dataType : 'json',
success: function(response) {

statusMessage(response.status, response.message);
mailpile.notification(response.status, response.message);

if (response.status === 'success') {
console.log(response);
Expand Down
7 changes: 4 additions & 3 deletions static/default/js/app/thread.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@ $(document).on('click', '.thread-show-security', function() {
})

/* Thread - Expand Snippet */
$(document).on('click', '.thread-snippet', function() {

alert('FIXME: Will load full message with mid: ' + $(this).data('mid'));
$(document).on('click', '#thread-messages div.thread-snippet', function(e) {
if (e.target.href === undefined) {
alert('FIXME: Will load full message with mid: ' + $(this).data('mid'));
}
});


Expand Down
10 changes: 5 additions & 5 deletions static/default/js/mailpile-min.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ $(document).on('submit', '#form-profile-add', function(e) {
dataType : 'json',
success : function(response) {

statusMessage(response.status, response.message);
mailpile.notification(response.status, response.message);
if (response.status === 'success') {
console.log(response);
}
Expand Down Expand Up @@ -428,7 +428,7 @@ $(document).on('submit', '#form-tag-add', function(e) {
dataType : 'json',
success: function(response) {

statusMessage(response.status, response.message);
mailpile.notification(response.status, response.message);

if (response.status === 'success') {
console.log(response);
Expand Down Expand Up @@ -624,7 +624,7 @@ $('li.sidebar-tags-draggable').droppable({
mailpile.bulk_cache = [];

} else {
statusMessage(response.status, response.message);
mailpile.notification(response.status, response.message);
}
}
});
Expand Down Expand Up @@ -759,7 +759,7 @@ MailPile.prototype.compose = function(data) {
if (response.status == 'success') {
window.location.href = mailpile.urls.message_draft + response.result.created + '/';
} else {
statusMessage(response.status, response.message);
mailpile.notification(response.status, response.message);
}
});
}
Expand Down Expand Up @@ -934,7 +934,7 @@ $(document).on('click', '.compose-action', function(e) {
window.location.href = mailpile.urls.message_sent + response.result.messages[0].mid;
}
else {
statusMessage(response.status, response.message);
mailpile.notification(response.status, response.message);
}
}
});
Expand Down
2 changes: 1 addition & 1 deletion static/default/js/mailpile.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ MailPile.prototype.keybindings_loadfromserver = function() {

var keybindings = [
["/", "normal", function() { $("#search-query").focus(); return false; }],
["C", "normal", function() { mailpile.go("/_/compose/"); }],
["C", "normal", function() { mailpile.compose(); }],
["g i", "normal", function() { mailpile.go("/Inbox/"); }],
["g c", "normal", function() { mailpile.go("/_/contact/list/"); }],
["g n c", "normal", function() { mailpile.go("/_/contact/add/"); }],
Expand Down

0 comments on commit a3e3a41

Please sign in to comment.