Skip to content

Commit

Permalink
Added 'Attach Encryption Key' to Composer
Browse files Browse the repository at this point in the history
  • Loading branch information
bnvk committed Oct 19, 2014
1 parent e8821f6 commit 49e2e83
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 4 deletions.
10 changes: 10 additions & 0 deletions static/default/html/jsapi/compose/crypto.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,4 +181,14 @@ Mailpile.Composer.Crypto.encryption_toggle = function(status) {

Mailpile.Composer.Crypto.set_state();
}
};


Mailpile.Composer.Crypto.AttachKey = function(mid) {
$checkbox = $('#compose-attach-key-' + mid)
if ($checkbox.is(':checked')) {
$checkbox.val('yes');
} else {
$checkbox.val('no');
}
};
10 changes: 8 additions & 2 deletions static/default/html/jsapi/compose/events.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ $(document).on('click', '.compose-action', function(e) {
}
// Is Thread Reply
else if (action === 'reply' && response.status === 'success') {
Mailpile.Composer.render_message_thread(response.result.thread_ids[0]);
Mailpile.Composer.Complete(response.result.thread_ids[0]);
}
else {
Mailpile.notification(response);
Expand Down Expand Up @@ -221,7 +221,13 @@ $(document).on('click', '.compose-attachment-remove', function(e) {
alert('This should delete an attachment: ' + aid + ' for mid: ' + mid + ' just need API endpoint to do so');
});

/* Compose - Autogrow composer boxes */

$(document).on('focus', '.compose-text', function() {
$(this).autosize();
});


$(document).on('click', '.compose-attach-key', function(e) {
var mid = $(this).data('mid');
Mailpile.Composer.Crypto.AttachKey(mid);
});
8 changes: 6 additions & 2 deletions static/default/html/partials/compose.html
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,12 @@
{% endif %}
</ul>
<div class="clearfix"></div>
<a id="compose-attachment-pick-{{mid}}" class="compose-attachment-pick hide" href="#"><span class="icon-attachment"></span>Add Attachment</a>
<span class="attachment-browswer-unsupported">Unable to add attachments, <a href="">update your browser?</a></span>
<a id="compose-attachment-pick-{{mid}}" class="compose-attachment-pick hide" href="#"><span class="icon-attachment"></span>{{_("Add Attachment")}}</a>
<span class="attachment-browswer-unsupported">{{_("Unable to add attachments")}}, <a href="">{{_("update your browser")}}</a></span>
<label class="right compose-attach-key" data-mid="{{mid}}">
<input type="checkbox" id="compose-attach-key-{{mid}}" name="attach-pgp-pubkey" {% if config.prefs.gpg_email_key %}value="yes" checked{% else %}value="no"{% endif %}>
{{_("Send Encryption Key")}}
</label>
</div>
</div>
<div class="compose-actions clearfix">
Expand Down
16 changes: 16 additions & 0 deletions static/default/less/app/compose.less
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,22 @@
color: @gray;
}

label.compose-attach-key {
color: @grayDark;
cursor: pointer;
font-weight: bold;
}

label.compose-attach-key:hover,
label.compose-attach-key:hover span.icon-key {
color: @red;
}

label.compose-attach-key span.icon-key {
color: @grayDark;
font-weight: normal;
}


/* Compose - From Menu */

Expand Down

0 comments on commit 49e2e83

Please sign in to comment.