Skip to content

Commit

Permalink
Adding send raw email link to Email Dialog. Thanks to @Tylast for the…
Browse files Browse the repository at this point in the history
… idea.
  • Loading branch information
samuelclay committed Apr 26, 2012
1 parent 121adb1 commit 48d6633
Showing 1 changed file with 34 additions and 1 deletion.
35 changes: 34 additions & 1 deletion media/js/newsblur/reader_send_email.js
Expand Up @@ -76,7 +76,7 @@ NEWSBLUR.ReaderSendEmail.prototype = _.extend({}, NEWSBLUR.Modal.prototype, {
$.make('div', { className: 'NB-modal-submit' }, [
$.make('input', { type: 'submit', className: 'NB-modal-submit-save NB-modal-submit-green', value: 'Send this story' }),
' or ',
$.make('a', { href: '#', className: 'NB-modal-cancel' }, 'cancel')
$.make('a', { href: '#', className: 'NB-modal-emailclient' }, 'open in an email client')
])
])
]);
Expand Down Expand Up @@ -133,6 +133,33 @@ NEWSBLUR.ReaderSendEmail.prototype = _.extend({}, NEWSBLUR.Modal.prototype, {
$('.NB-modal-loading', this.$modal).removeClass('NB-active');
},

open_email_client: function() {
var from_name = $('input[name=from_name]', this.$modal).val();
var from_email = $('input[name=from_email]', this.$modal).val();
var to = $('input[name=to]', this.$modal).val();
var comments = $('textarea', this.$modal).val();

var url = [
'mailto:',
to,
'?subject=',
from_name,
' is sharing a story: ',
this.story.story_title,
'&body=',
comments,
'%0D%0A%0D%0A--%0D%0A%0D%0A',
this.story.story_permalink,
'%0D%0A%0D%0A',
$(this.story.story_content).text(),
'%0D%0A%0D%0A',
'--',
'%0D%0A%0D%0A',
'Shared with NewsBlur.com'
].join('');
window.open(url);
},

// ===========
// = Actions =
// ===========
Expand All @@ -146,6 +173,12 @@ NEWSBLUR.ReaderSendEmail.prototype = _.extend({}, NEWSBLUR.Modal.prototype, {
self.save();
return false;
});
$.targetIs(e, { tagSelector: '.NB-modal-emailclient' }, function($t, $p) {
e.preventDefault();

self.open_email_client();
return false;
});
}

});

1 comment on commit 48d6633

@JWegener
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mmm, pretty

Please sign in to comment.