Skip to content

Instantly share code, notes, and snippets.

@rmoura-92
Created October 10, 2013 10:40
Show Gist options
  • Save rmoura-92/6916433 to your computer and use it in GitHub Desktop.
Save rmoura-92/6916433 to your computer and use it in GitHub Desktop.
paritlhaPorEmail
partilhaPorEmail: function(e) {
e.preventDefault();
e.stopPropagation();
if(this.model) {
var model = this.model.toJSON();
page = App.CurrentView.split('/')[0];
switch(page) {
case 'ferias':
case 'escapadinhas':
var body = _.first(_.last(model.detalhes)).coditions
+ _.first(_.last(model.detalhes)).description
+ _.first(_.last(model.detalhes)).itinerary;
break;
case 'hoteis':
var body = this.model.toJSON().info;
break;
}
var emailBodyHead = encodeURIComponent('Agradecemos a sua pesquisa com os seguintes detalhes:\n');
var emailBodyInfo = encodeURIComponent(body.replace(/<\/?([a-z][a-z0-9]*)\b[^>]*>?/gi, '\n'));
var emailSubject = encodeURIComponent('Geostar - Detalhes de Produto');
var url = 'mailto:?subject='+emailSubject+'&body='+emailBodyHead+emailBodyInfo;
window.location.href = url;
} else {
return;
}
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment