Skip to content

Commit

Permalink
fixes #216
Browse files Browse the repository at this point in the history
  • Loading branch information
scarvell committed Feb 11, 2013
1 parent 9d9bb29 commit c7f34e4
Show file tree
Hide file tree
Showing 6 changed files with 165 additions and 8 deletions.
2 changes: 1 addition & 1 deletion controllers/ajax.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ exports.addRegistration = (req, res) ->
models.registrations.add req.query, (err, results) ->
if err then console.log err
if results.affectedRows is 1

res.send status: 200

else
Expand Down
9 changes: 5 additions & 4 deletions controllers/enquiries.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ exports.create = (req, res) ->
User.getUserById record.listed_by , (err, developer) ->

if developer.length is 0
developer = 'Developer'
developer = 'Service'
else
developer = developer[0].first_name

Expand All @@ -40,8 +40,8 @@ exports.create = (req, res) ->
barn: 'barn-deal-enquiry'

if template_map[entity_type]?

template = template_map[entity_type]

user =
email: developer[0].email or ''
firstName: req.body.name or res.locals.objUser.displayName
Expand All @@ -53,6 +53,7 @@ exports.create = (req, res) ->
owl_id: record.id
contactName: req.body.name
address: record.address or ''
title: record.name or ''
description: req.body.enquiry
contact_method: req.body.contact or 'phone'
enquiryEmail: req.body.email or res.locals.objUser.email
Expand All @@ -65,8 +66,8 @@ exports.create = (req, res) ->
firstName: res.locals.objUser.displayName
lastName: ''

system.helpers.mailer 'property-enquiry-confirmation', 'Property Enquiry Confirmation', user, secondary, ->
system.helpers.mailer "#{entity_type}-enquiry-confirmation", "Enquiry Confirmation", user, secondary, ->
if results is true
res.send status: 200
else
res.send status: 500
res.send status: 500
2 changes: 1 addition & 1 deletion lib/helpers/mailer.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ module.exports = (template, subject, objUser, secondary, callback) ->
html: data

switch template
when 'listing-approval','password-reset','forgot-password','barn-deal-enquiry', 'barn-deal-registration-developer', 'barn-deal-registration', 'expression-of-interest', 'withdraw-interest', 'signup-confirmation', 'service-enquiry', 'service-enquiry-confirmation', 'property-recommendations', 'property-enquiry-confirmation', 'owl-deal-registration-developer', 'owl-deal-registration','owl-deal-enquiry', 'barn-deal-enquiry', 'new-listing', 'listing-confirmation'
when 'affiliate-enquiry-confirmation', 'listing-approval','password-reset','forgot-password','barn-deal-enquiry', 'barn-deal-registration-developer', 'barn-deal-registration', 'expression-of-interest', 'withdraw-interest', 'signup-confirmation', 'service-enquiry', 'service-enquiry-confirmation', 'property-recommendations', 'property-enquiry-confirmation', 'owl-deal-registration-developer', 'owl-deal-registration','owl-deal-enquiry', 'barn-deal-enquiry', 'new-listing', 'listing-confirmation'
email.setCategory 'Property Owl'
email.addSubVal '{{contact_name}}', secondary.contact_name
email.addSubVal '{{contactName}}', secondary.contactName
Expand Down
9 changes: 8 additions & 1 deletion models/affiliate.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ module.exports = class Affiliate extends Model
@table = new Table
name: 'affiliates'
key: 'affiliate_id'


@field 'user_id'
@field 'name'
@field 'logo'
@field 'phone'
Expand Down Expand Up @@ -52,6 +53,12 @@ module.exports = class Affiliate extends Model
Enquiry.for this, (error, enquiries) =>
@enquiries = enquiries
callback error

user: (callback) =>
system.models.user.getUserById @user_id, (error, [user]) =>
return callback error if error?
@user = user
do callback

, (error) => super callback

Expand Down
149 changes: 149 additions & 0 deletions public/emails/affiliate-enquiry-confirmation.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Property Owl Products and Services Enquiry Confirmation</title>
<style type="text/css">
body{
margin:0;
padding:0;
background:#eee;
}
</style>
</head>

<body>
<table width="720" border="0" align="center" cellpadding="0" cellspacing="0" style="background:#fff; margin:0 auto;">
<tr>
<td width="20" align="left" valign="top" style="margin:0; padding:0;"></td>
<td align="left" valign="top" style="margin:0; padding:0;">

<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="20" align="left" valign="top" style="margin:0; padding:0;"></td>
</tr>
<tr>
<td align="left" valign="top" style="margin:0; padding:0;"><a href="#"><img src="https://propertyowl.com.au/emails/images/topbg-enquiry-thanks.png" width="680" height="130" alt="Thanks for your enquiry" style="border:none; padding:0; margin:0; display:block;"/></a></td>
</tr>
<tr>
<td height="26" align="left" valign="top" style="margin:0; padding:0;"></td>
</tr>
<tr>
<td height="28" align="left" valign="top" style="margin:0; padding:0; font-family:Arial, Helvetica, sans-serif; font-size:20px; color:#4778ad; border-bottom:1px solid #e0e0e0;">Dear {{firstname}},</td>
</tr>
<tr>
<td height="21" align="left" valign="top" style="margin:0; padding:0; font-family:Arial, Helvetica, sans-serif; font-size:13px; color:#707070;">&nbsp;</td>
</tr>
<tr>
<td align="left" valign="top" style="margin:0; padding:0;font-family:Arial, Helvetica, sans-serif; font-size:13px; color:#707070;">Welcome to the Property Owl Products and Services guide. Property Owl has sourced respected businesses in the property industry who we know will complement your purchasing and ownership needs.<br /><br />The Seller or their representative from <b>{{title}}</b> will be in touch with you to discuss the buying process. Property Owl will always follow up to make sure you have been contacted promptly.<br /><br />
Remember, Refer a Friend to a property and start building your nest egg with a $1000 boost when they join <a href="http://www.propertyowl.com.au" style="color:#4778ad">propertyowl.com.au</a> and buy a property displayed on the website.<br /><br />
All the best and remember to swoop in on <em>Australia's Best Property Deals</em>.</td>
</tr>
<tr>
<td height="83" align="left" valign="top" style="margin:0; padding:0;border-bottom:1px solid #e0e0e0;">&nbsp;</td>
</tr>
<tr>
<td align="left" valign="top" style="margin:0; padding:0;">&nbsp;</td>
</tr>
<tr>
<td height="14" align="left" valign="top" style="margin:0; padding:0;font-family:Arial, Helvetica, sans-serif; font-size:13px; color:#707070;">Regards,<br /></td>
</tr>
<tr>
<td align="left" valign="top" style="margin:0; padding:0;font-family:Arial, Helvetica, sans-serif; font-size:13px; color:#353535;">The Property Owl team</td>
</tr>
<tr>
<td height="35" align="left" valign="top" style="margin:0; padding:0;"></td>
</tr>
<tr>
<td height="6" align="left" valign="top" style="margin:0; padding:0;"><img src="http://po.node.digital8.com.au/emails/images/topcurve.jpg" width="680" height="6" alt="topcurve" style="border:none; padding:0; margin:0; display:block;" /></td>
</tr>
<tr>
<td height="126" align="center" valign="top" bgcolor="#0c6ab4" style="margin:0; padding:0;">
<table width="634" border="0" align="center" cellpadding="0" cellspacing="0">
<tr align="left">
<td height="15" valign="top" style="padding:0; margin:0;"></td>
<td height="15" valign="top" style="padding:0; margin:0;"></td>
<td height="15" valign="top" style="padding:0; margin:0;"></td>
<td height="15" valign="top" style="padding:0; margin:0;"></td>
</tr>
<tr>
<td width="165" valign="top" style="padding:0; margin:0;"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="28" valign="top" style="padding:0; margin:0; font-family:Arial, Helvetica, sans-serif; color:#fff; font-size:12px; text-transform:uppercase;"><strong>company</strong></td>
</tr>
<tr>
<td height="22" valign="middle" style="padding:0; margin:0; font-family:Arial, Helvetica, sans-serif; color:#7dd3ff; font-size:12px;"><a href="#" style="text-decoration:none; color:#7dd3ff;">Terms and Conditions</a></td>
</tr>
<tr>
<td height="22" valign="middle" style="padding:0; margin:0; font-family:Arial, Helvetica, sans-serif; color:#7dd3ff; font-size:12px;"><a href="#" style="text-decoration:none; color:#7dd3ff;">Privacy Policy</a></td>
</tr>
<tr>
<td height="22" valign="middle" style="padding:0; margin:0; font-family:Arial, Helvetica, sans-serif; color:#7dd3ff; font-size:12px;"><a href="#" style="text-decoration:none; color:#7dd3ff;">About Us</a></td>
</tr>
</table></td>
<td width="203" align="left" valign="top" style="padding:0; margin:0;"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="28" valign="top" style="padding:0; margin:0; font-family:Arial, Helvetica, sans-serif; color:#fff; font-size:12px; text-transform:uppercase;"><strong>WHAT IS PROPERTY OWL?</strong></td>
</tr>
<tr>
<td height="22" valign="middle" style="padding:0; margin:0; font-family:Arial, Helvetica, sans-serif; color:#7dd3ff; font-size:12px;"><a href="#" style="text-decoration:none; color:#7dd3ff;">Why the Owl?</a></td>
</tr>
<tr>
<td height="22" valign="middle" style="padding:0; margin:0; font-family:Arial, Helvetica, sans-serif; color:#7dd3ff; font-size:12px;"><a href="#" style="text-decoration:none; color:#7dd3ff;">Home Page</a></td>
</tr>
<tr>
<td height="22" valign="middle" style="padding:0; margin:0; font-family:Arial, Helvetica, sans-serif; color:#7dd3ff; font-size:12px;"><a href="#" style="text-decoration:none; color:#7dd3ff;">FAQs</a></td>
</tr>
</table></td>
<td width="117" align="left" valign="top" style="padding:0; margin:0;"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="28" valign="top" style="padding:0; margin:0; font-family:Arial, Helvetica, sans-serif; color:#fff; font-size:12px; text-transform:uppercase;"><strong>Follow us</strong></td>
</tr>
<tr>
<td height="22" valign="middle" style="padding:0; margin:0; font-family:Arial, Helvetica, sans-serif; color:#7dd3ff; font-size:12px;"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="18%" align="left" valign="middle" style="padding:0; margin:0;"><a href="#"><img src="http://po.node.digital8.com.au/emails/images/facebook.png" width="21" height="21" alt="facebook" style="border:none; padding:0; margin:0; display:block;" /></a></td>
<td width="9%" align="left" valign="middle" style="padding:0; margin:0;">&nbsp;</td>
<td width="73%" align="left" valign="middle" style="padding:0; margin:0;"><a href="#"><img src="http://po.node.digital8.com.au/emails/images/twitter.png" width="21" height="21" alt="twitter" style="border:none; padding:0; margin:0; display:block;" /></a></td>
</tr>
</table></td>
</tr>
</table></td>
<td align="left" valign="top" style="padding:0; margin:0;"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="28" valign="top" style="padding:0; margin:0; font-family:Arial, Helvetica, sans-serif; color:#fff; font-size:12px; text-transform:uppercase;"><strong>partnerships</strong></td>
</tr>
<tr>
<td height="22" valign="middle" style="padding:0; margin:0; font-family:Arial, Helvetica, sans-serif; color:#7dd3ff; font-size:12px;"><a href="#" style="text-decoration:none; color:#7dd3ff;">Developer Enquiries</a><br /></td>
</tr>
<tr>
<td height="22" valign="middle" style="padding:0; margin:0; font-family:Arial, Helvetica, sans-serif; color:#7dd3ff; font-size:12px;"><a href="#" style="text-decoration:none; color:#7dd3ff;">Agent Enquiries</a></td>
</tr>
<tr>
<td height="22" valign="middle" style="padding:0; margin:0; font-family:Arial, Helvetica, sans-serif; color:#7dd3ff; font-size:12px;"><a href="#" style="text-decoration:none; color:#7dd3ff;">Advertising Enquiries</a></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
<tr>
<td height="27" align="center" valign="middle" bgcolor="#013c64" style="margin:0; padding:0;"><table width="634" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="27" align="left" valign="middle" style="margin:0; padding:0; font-family:Arial, Helvetica, sans-serif; font-size:11px; color:#b9d0e2;">&copy; Copyright 2012 <a href="#" style=" color:#b9d0e2; text-decoration:none;">Property Owl</a></td>
<td align="right" valign="middle" style="margin:0; padding:0; font-family:Arial, Helvetica, sans-serif; font-size:11px; color:#b9d0e2;">Powered by <a href="#" style=" text-decoration:none; color:#b9d0e2;">Digital8</a></td>
</tr>
</table></td>
</tr>
<tr>
<td height="7" align="left" valign="top" style="margin:0; padding:0;"><img src="http://po.node.digital8.com.au/emails/images/bottomcurve.jpg" width="680" height="7" alt="bottom" style="border:none; padding:0; margin:0; display:block;" /></td>
</tr>
<tr>
<td align="left" valign="top" style="margin:0; padding:0;">&nbsp;</td>
</tr>
</table></td>
<td width="20" align="left" valign="top" style="margin:0; padding:0;"></td>
</tr>
</table>

</body>
</html>
2 changes: 1 addition & 1 deletion public/emails/service-enquiry.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<td height="20" align="left" valign="top" style="margin:0; padding:0;"></td>
</tr>
<tr>
<td align="left" valign="top" style="margin:0; padding:0;"><a href="#"><img src="http://po.node.digital8.com.au/emails/images/topbg-product-services.png" width="680" height="130" alt="Products and Services Enquiry" style="border:none; padding:0; margin:0; display:block;"/></a></td>
<td align="left" valign="top" style="margin:0; padding:0;"><a href="#"><img src="https://propertyowl.com.au/emails/images/topbg-product-services.png" width="680" height="130" alt="Products and Services Enquiry" style="border:none; padding:0; margin:0; display:block;"/></a></td>
</tr>
<tr>
<td height="26" align="left" valign="top" style="margin:0; padding:0;"></td>
Expand Down

0 comments on commit c7f34e4

Please sign in to comment.