Created
October 10, 2013 10:40
-
-
Save rmoura-92/6916433 to your computer and use it in GitHub Desktop.
paritlhaPorEmail
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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