// Setup Bindings
$(function () {
$('#message-maven').click(function (){
if (logged_in) {
$('#messageModal').modal();
} else {
window.location = '/account/signup/';
}
return false;
});
if ($('#portal-sidebar-email-capture').length) {
analytics.track('Lead: Capture Displayed', {
product: $('#portal-sidebar-email-capture').data('product'),
label: 'portal_sidebar',
category: 'Portal'
});
}
$('#portal-sidebar-email-capture').restForm({
success: function () {
$('#portal-sidebar-email-capture').addClass('hide').siblings('.email-capture-success').removeClass('hide');
analytics.track('Lead: Capture Success', {
product: this.data('product'),
label: 'portal_sidebar',
category: 'Portal'
});
},
beforeError: function (errorObject) {
analytics.track('Lead: Capture Error', {
product: this.data('product'),
label: 'portal_sidebar',
category: 'Portal',
error: errorObject
});
},
fieldHandlers: {
email: {
error: function (errorArray) {
var field = this.find('[name=email]');
var errorHTML = $("").addClass("help-inline alert-error").text(errorArray.join('
'));
field.parents('.control-group').addClass('error').find('.controls').append(errorHTML);
}
}
}
});
});