Skip to content

Commit

Permalink
Made Compose init to not use classes #594
Browse files Browse the repository at this point in the history
  • Loading branch information
bnvk committed Oct 16, 2014
1 parent 34571e2 commit 35000c6
Showing 1 changed file with 17 additions and 19 deletions.
36 changes: 17 additions & 19 deletions static/default/html/jsapi/compose/init.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
/* Compose - DOM ready */
/* Compose - Create new instance of composer */
Mailpile.compose_init = function(mid) {

console.log('running init for composer');

// Reset tabindex for To: field
$('#search-query').attr('tabindex', '-1');

Expand All @@ -11,31 +9,31 @@ Mailpile.compose_init = function(mid) {
Mailpile.compose_load_crypto_states();

// Instantiate select2
$('.compose-address-field').each(function(key, elem) {
Mailpile.compose_address_field($(elem).attr('id'));
});
Mailpile.compose_address_field('compose-to-' + mid);
// FIXME: move to click events
Mailpile.compose_address_field('compose-cc-' + mid);
Mailpile.compose_address_field('compose-bcc-' + mid);


// Save Text Composing Objects (move to data model)
Mailpile.messages_composing['compose-text-' + mid] = $('compose-text-' + mid).val();

// Save Text Composing Objects
$('.compose-text').each(function(key, elem) {
Mailpile.messages_composing[$(elem).attr('id')] = $(elem).val()
});

// Run Autosave
// FIXME: this should be moved to the global event loop
Mailpile.compose_autosave_timer.play();
Mailpile.compose_autosave_timer.set({ time : 20000, autostart : true });


// Initialize Attachments
// FIXME: needs dynamic support for multi composers on a page
$('.compose-attachments').each(function(key, elem) {
var mid = $(elem).data('mid');
console.log('js uploader: ' + mid);
uploader({
browse_button: 'compose-attachment-pick-' + mid,
container: 'compose-attachments-' + mid,
mid: mid
});
// FIXME: needs to be bound to unique ID that can be destroyed
uploader({
browse_button: 'compose-attachment-pick-' + mid,
container: 'compose-attachments-' + mid,
mid: mid
});


// Show Crypto Tooltips
Mailpile.tooltip_compose_crypto_signature();
Mailpile.tooltip_compose_crypto_encryption();
Expand Down

0 comments on commit 35000c6

Please sign in to comment.