pyc-website

main website for pyc inc.

git clone https://9o.is/git/pyc-website.git

commit 69e7bd12f3e62d6fac9713d0cf7227ad9164162c
parent 0a0f824d90dc2d1d01b15b07576c26bee722d999
Author: Jul <jul@9o.is>
Date:   Fri, 17 Oct 2014 19:04:20 -0400

removed logo, teaser, and title for token emails.

Diffstat:
Msrc/main/scala/inc/pyc/lib/HtmlEmail.scala | 64++++++++++++++++++++++++++++++++++++++++++++++++----------------
Msrc/main/scala/inc/pyc/model/EmailResetToken.scala | 2+-
Msrc/main/scala/inc/pyc/model/User.scala | 10++++++----
Msrc/main/scala/inc/pyc/snippet/UtilSnips.scala | 4++++
Msrc/main/webapp/templates-hidden/base-wrap.html | 2+-
Msrc/main/webapp/templates-hidden/email/base-dev.html | 10+++++-----
Msrc/main/webapp/templates-hidden/email/base.html | 10+++++-----
7 files changed, 70 insertions(+), 32 deletions(-)

diff --git a/src/main/scala/inc/pyc/lib/HtmlEmail.scala b/src/main/scala/inc/pyc/lib/HtmlEmail.scala @@ -1,7 +1,7 @@ package inc.pyc package lib -import snippet.Social +import snippet.{Social, PYC} import xml._ import net.liftweb._ import util._ @@ -21,17 +21,35 @@ object HtmlEmail { * Creates main HTML template message. */ def create( - teaser: String, - title: String, - subtitle: String, - body: NodeSeq, + teaser: String, + title: String, + subtitle: String, + body: NodeSeq, + includeTitle: Boolean = true, + includeLogo: Boolean = true, leftColumn: NodeSeq = NodeSeq.Empty, rightColumn: NodeSeq = NodeSeq.Empty): Box[NodeSeq] = { Templates("templates-hidden" :: "email" :: "base" :: Nil) map { - "#pteaser" #> teaser & + { + if(teaser.isEmpty) "#pteaser-wrapper" #> NodeSeq.Empty + else "#pteaser" #> teaser + } & + { + if(!includeTitle) { + "#ptitle-wrapper" #> NodeSeq.Empty & + "#psubtitle-wrapper" #> NodeSeq.Empty + } else { + "#psubtitle" #> subtitle + } + } & { + if(!includeLogo) { + "#logo-wrapper" #> NodeSeq.Empty + } else { + "#logo" #> PYC.logo + } + } & ".ptitle" #> title & - "#psubtitle" #> subtitle & "#pbody" #> body & "#pleftcolumn" #> leftColumn & "#prightcolumn" #> rightColumn & @@ -47,14 +65,22 @@ object HtmlEmail { def simpleMessage( title: String, subtitle: String, - body: NodeSeq): Box[NodeSeq] = { + body: NodeSeq, + includeLogo: Boolean = true): Box[NodeSeq] = { + + def teaser = { + val text = body.text + if(text.length > 80) text.take(80)+"..." + else text + + } - create(body.text.take(80)+"...", title, subtitle, + create(teaser, title, subtitle, <span> <br/> {body} <br/> - </span> + </span>, (title != ""), includeLogo ) } @@ -67,7 +93,8 @@ object HtmlEmail { subtitle: String, btnName: String, link: String, - body: NodeSeq): Box[NodeSeq] = { + body: NodeSeq, + includeLogo: Boolean = true): Box[NodeSeq] = { val actionButton = button(btnName, link) @@ -80,7 +107,7 @@ object HtmlEmail { <br/><br/> If the button above is not working, follow the link below. <br/><a href={link}>{link}</a> - </span> + </span>, (title != ""), includeLogo ) } @@ -88,16 +115,21 @@ object HtmlEmail { * Creates a fixed HTML template message for generic user token links. */ def createToken( + tease: Boolean, title: String, msg: String, - link: String): Box[NodeSeq] = { + btnName: String, + link: String, + includeLogo: Boolean): Box[NodeSeq] = { - val actionButton = button("Complete "+title, link) + val actionButton = button(btnName, link) val notice = "If you did not request this, you can safely ignore it. "+ "It will expire 48 hours from the time this message was sent." - create(msg, title, + def teaser = if(tease) msg else "" + + create(teaser, title, "Click the blue button below to continue", <span> <br/> @@ -111,7 +143,7 @@ object HtmlEmail { <br/><br/> If the button above is not working, follow the link below. <br/><a href={link}>{link}</a> - </span> + </span>, (title != ""), includeLogo ) } diff --git a/src/main/scala/inc/pyc/model/EmailResetToken.scala b/src/main/scala/inc/pyc/model/EmailResetToken.scala @@ -65,7 +65,7 @@ object EmailResetToken extends EmailResetToken with MongoMetaRecord[EmailResetTo val title = "Reset Email" val msg = s"Hello ${user.fname.get}, you requested to change your account to this email." - HtmlEmail.createToken(title, msg, token.url) map { + HtmlEmail.createToken(false, "", msg, title, url, false) map { sendMail( From(MongoAuth.systemFancyEmail), Subject("%s: %s".format(MongoAuth.siteName.vend, title)), diff --git a/src/main/scala/inc/pyc/model/User.scala b/src/main/scala/inc/pyc/model/User.scala @@ -172,9 +172,10 @@ object User extends User with ProtoAuthUserMeta[User] with RogueMetaRecord[User] val token = LoginToken.createRecord.userId(user.id.get).save() val url = "%s%s?token=%s".format(Site.host, MongoAuth.loginTokenUrl.vend, token.id.toString) val title = "Account Login" - val msg = s"Hello, someone requested a link to log in to your account." + val btn = "Complete "+title + val msg = "Hello, someone requested a link to log in to your account." - HtmlEmail.createToken(title, msg, url) map { + HtmlEmail.createToken(false, "", msg, btn, url, false) map { sendMail( From(MongoAuth.systemFancyEmail), Subject("%s: %s".format(siteName, title)), @@ -193,9 +194,10 @@ object User extends User with ProtoAuthUserMeta[User] with RogueMetaRecord[User] val token = LoginToken.createRecord.userId(user.id.get).save() val url = "%s%s?token=%s".format(Site.host, MongoAuth.loginTokenUrl.vend, token.id.toString) val title = "Account Registration" - val msg = s"Thank you for using bitcoin. Please follow the link to complete your registration." + val btn = "Complete "+title + val msg = "Thank you for using bitcoin. Please follow the link to complete your registration." - HtmlEmail.createToken(title, msg, url) map { + HtmlEmail.createToken(false, "", msg, btn, url, false) map { sendMail( From(MongoAuth.systemFancyEmail), Subject("%s: %s".format(siteName, title)), diff --git a/src/main/scala/inc/pyc/snippet/UtilSnips.scala b/src/main/scala/inc/pyc/snippet/UtilSnips.scala @@ -84,6 +84,10 @@ object ProductionOnly { object Selector extends USStatesSelector +object PYC { + def logo: CssSel = "* [src]" #> "https://s3.amazonaws.com/assets-pyc/logo-noslogan.png" +} + object Social { def facebookLink: CssSel = "* [href]" #> "https://www.facebook.com/pycinc" def twitterLink: CssSel = "* [href]" #> "https://twitter.com/pyc_inc" diff --git a/src/main/webapp/templates-hidden/base-wrap.html b/src/main/webapp/templates-hidden/base-wrap.html @@ -32,7 +32,7 @@ <span class="icon-bar"></span> <span class="icon-bar"></span> </button> - <a class="navbar-brand" href="/"><img src="https://s3.amazonaws.com/assets-pyc/logo-noslogan.png"></a> + <a class="navbar-brand" href="/"><img data-lift="PYC.logo" src=""></a> </div> <div collapse="navCollapsed" class="collapse navbar-collapse navbar-responsive-collapse"> <div class="row"> diff --git a/src/main/webapp/templates-hidden/email/base-dev.html b/src/main/webapp/templates-hidden/email/base-dev.html @@ -548,7 +548,7 @@ <td align="center" valign="top" id="bodyCell"> <!-- BEGIN TEMPLATE // --> <table border="0" cellpadding="0" cellspacing="0" id="templateContainer"> - <tr> + <tr id="pteaser-wrapper"> <td align="center" valign="top"> <!-- BEGIN PREHEADER // --> <table border="0" cellpadding="0" cellspacing="0" width="100%" id="templatePreheader"> @@ -561,13 +561,13 @@ <!-- // END PREHEADER --> </td> </tr> - <tr> + <tr id="logo-wrapper"> <td align="center" valign="top"> <!-- BEGIN HEADER // --> <table border="0" cellpadding="0" cellspacing="0" width="100%" id="templateHeader"> <tr> <td valign="top" class="headerContent"> - <img src="https://s3.amazonaws.com/assets-pyc/logo.png" style="max-width:160px;" id="headerImage" mc:label="header_image" mc:edit="header_image" mc:allowdesigner mc:allowtext /> + <img id="logo" src="" style="max-width:160px;" id="headerImage" mc:label="header_image" mc:edit="header_image" mc:allowdesigner mc:allowtext /> </td> </tr> </table> @@ -580,8 +580,8 @@ <table border="0" cellpadding="0" cellspacing="0" width="100%" id="templateBody"> <tr> <td valign="top" class="bodyContent" mc:edit="body_content"> - <h1><span class="ptitle"></span></h1> - <h3><span id="psubtitle"></span></h3> + <h1 id="ptitle-wrapper"><span class="ptitle"></span></h1> + <h3 id="psubtitle-wrapper"><span id="psubtitle"></span></h3> <span id="pbody"></span> </td> </tr> diff --git a/src/main/webapp/templates-hidden/email/base.html b/src/main/webapp/templates-hidden/email/base.html @@ -548,7 +548,7 @@ <td align="center" valign="top" id="bodyCell" style="-webkit-text-size-adjust: 100%;-ms-text-size-adjust: 100%;mso-table-lspace: 0pt;mso-table-rspace: 0pt;margin: 0;padding: 20px;border-top: 4px solid #FFFFFF;height: 100% !important;width: 100% !important;"> <!-- BEGIN TEMPLATE // --> <table border="0" cellpadding="0" cellspacing="0" id="templateContainer" style="-webkit-text-size-adjust: 100%;-ms-text-size-adjust: 100%;mso-table-lspace: 0pt;mso-table-rspace: 0pt;width: 600px;border: 1px solid #BBBBBB;border-collapse: collapse !important;"> - <tr> + <tr id="pteaser-wrapper"> <td align="center" valign="top" style="-webkit-text-size-adjust: 100%;-ms-text-size-adjust: 100%;mso-table-lspace: 0pt;mso-table-rspace: 0pt;"> <!-- BEGIN PREHEADER // --> <table border="0" cellpadding="0" cellspacing="0" width="100%" id="templatePreheader" style="-webkit-text-size-adjust: 100%;-ms-text-size-adjust: 100%;mso-table-lspace: 0pt;mso-table-rspace: 0pt;background-color: #3E648D;border-bottom: 1px solid #CCCCCC;border-collapse: collapse !important;"> @@ -561,13 +561,13 @@ <!-- // END PREHEADER --> </td> </tr> - <tr> + <tr id="logo-wrapper"> <td align="center" valign="top" style="-webkit-text-size-adjust: 100%;-ms-text-size-adjust: 100%;mso-table-lspace: 0pt;mso-table-rspace: 0pt;"> <!-- BEGIN HEADER // --> <table border="0" cellpadding="0" cellspacing="0" width="100%" id="templateHeader" style="-webkit-text-size-adjust: 100%;-ms-text-size-adjust: 100%;mso-table-lspace: 0pt;mso-table-rspace: 0pt;background-color: #FFFFFF;border-collapse: collapse !important;"> <tr> <td valign="top" class="headerContent" style="-webkit-text-size-adjust: 100%;-ms-text-size-adjust: 100%;mso-table-lspace: 0pt;mso-table-rspace: 0pt;color: #505050;font-family: Helvetica;font-size: 20px;font-weight: bold;line-height: 100%;padding-top: 10px;padding-right: 10px;padding-bottom: 10px;padding-left: 10px;text-align: left;vertical-align: middle;"> - <img src="https://s3.amazonaws.com/assets-pyc/logo.png" style="max-width: 160px;-ms-interpolation-mode: bicubic;border: 0;height: auto;line-height: 100%;outline: none;text-decoration: none;" id="headerImage" mc:label="header_image" mc:edit="header_image" mc:allowdesigner mc:allowtext> + <img id="logo" src="" style="max-width: 160px;-ms-interpolation-mode: bicubic;border: 0;height: auto;line-height: 100%;outline: none;text-decoration: none;" id="headerImage" mc:label="header_image" mc:edit="header_image" mc:allowdesigner mc:allowtext> </td> </tr> </table> @@ -580,8 +580,8 @@ <table border="0" cellpadding="0" cellspacing="0" width="100%" id="templateBody" style="-webkit-text-size-adjust: 100%;-ms-text-size-adjust: 100%;mso-table-lspace: 0pt;mso-table-rspace: 0pt;background-color: #FFFFFF;border-collapse: collapse !important;"> <tr> <td valign="top" class="bodyContent" mc:edit="body_content" style="-webkit-text-size-adjust: 100%;-ms-text-size-adjust: 100%;mso-table-lspace: 0pt;mso-table-rspace: 0pt;color: #505050;font-family: Helvetica;font-size: 16px;line-height: 150%;padding-top: 20px;padding-right: 20px;padding-bottom: 20px;padding-left: 20px;text-align: left;"> - <h1 style="display: block;font-family: Helvetica;font-size: 26px;font-style: normal;font-weight: bold;line-height: 100%;letter-spacing: normal;margin-top: 0;margin-right: 0;margin-bottom: 10px;margin-left: 0;text-align: left;color: #202020 !important;"><span class="ptitle"></span></h1> - <h3 style="display: block;font-family: Helvetica;font-size: 16px;font-style: italic;font-weight: normal;line-height: 100%;letter-spacing: normal;margin-top: 0;margin-right: 0;margin-bottom: 10px;margin-left: 0;text-align: left;color: #606060 !important;"><span id="psubtitle"></span></h3> + <h1 id="ptitle-wrapper" style="display: block;font-family: Helvetica;font-size: 26px;font-style: normal;font-weight: bold;line-height: 100%;letter-spacing: normal;margin-top: 0;margin-right: 0;margin-bottom: 10px;margin-left: 0;text-align: left;color: #202020 !important;"><span class="ptitle"></span></h1> + <h3 id="psubtitle-wrapper" style="display: block;font-family: Helvetica;font-size: 16px;font-style: italic;font-weight: normal;line-height: 100%;letter-spacing: normal;margin-top: 0;margin-right: 0;margin-bottom: 10px;margin-left: 0;text-align: left;color: #606060 !important;"><span id="psubtitle"></span></h3> <span id="pbody"></span> </td> </tr>