Skip to content
This repository was archived by the owner on Apr 21, 2026. It is now read-only.

Commit 6e364d1

Browse files
authored
Finish 1.1.1
Finish 1.1.1
2 parents 09757e8 + 3058f05 commit 6e364d1

16 files changed

Lines changed: 655 additions & 56 deletions

File tree

app/config/routes.cfm

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,10 @@
175175
176176
// settings routes
177177
.get(name="settings", pattern="settings", to="settingsController##index")
178+
.get(name="email-templates", pattern="email-content", to="EmailTemplatesController##index")
179+
.get(name="email-view", pattern="email/edit/[id]", to="EmailTemplatesController##edit")
180+
.get(name="email-edit", pattern="email/view/[id]", to="EmailTemplatesController##view")
181+
.post(name="email-save", pattern="email/save", to="EmailTemplatesController##save")
178182
.post(name="testimonial-settings", pattern="enableTestimonials", to="settingsController##enableTestimonials")
179183
.end()
180184

app/controllers/admin/AdminController.cfc

Lines changed: 27 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -438,21 +438,25 @@ component extends="app.Controllers.Controller" {
438438
var siteurl = "";
439439
if(isPublished && blog.status == "Approved"){
440440
siteurl = urlFor(route="blog-detail",slug=blog.slug ,onlyPath=false);
441+
var emaildata = model("emailTemplate").findAll(where="title = '#trim("Publish Blog")#'");
441442
var emailparams = {
442443
"name" = user.fullname,
443-
"buttonTitle" = "View Your Post",
444-
"content" = "Thank you for contributing to the Wheels.dev community. Your blog post '#blog.title#' has been published and is now live on our platform.",
444+
"buttonTitle" = emaildata.buttonTitle,
445+
"content" = emaildata.message,
446+
"welcomeMessage"= emaildata.welcomeMessage,
445447
"URl" = siteurl,
446-
"Footer" = "If you haven't published a blog post, please disregard this email.",
447-
"footerGreetings" = "Thank you for being part of the Wheels.dev community.",
448+
"footerNote" = emaildata.footerNote,
449+
"footerGreetings" = emaildata.footerGreating,
450+
"closingRemark" = emaildata.closingRemark,
451+
"teamSignature" = emaildata.teamSignature,
448452
"isSubscriber" = user.newsletter
449453
};
450454
emailContent = renderView(template="/email", layout=false, returnAs="string", params=emailparams);
451455
cfheader(name="Content-Type" value="text/html; charset=UTF-8");
452456
cfmail(
453457
to = "#user.email#",
454458
from = "#application.env.mail_from#",
455-
subject = "Your blog post has been published",
459+
subject = "#emaildata.subject#",
456460
server = "#application.env.smtp_host#",
457461
port = "#application.env.smtp_port#",
458462
username = "#application.env.smtp_username#",
@@ -796,20 +800,24 @@ component extends="app.Controllers.Controller" {
796800
comment.isPublished = true;
797801
if(comment.save()){
798802
siteurl = urlFor(route="blog-detail",slug=comment.blog.slug ,onlyPath=false);
803+
var emaildata = model("emailTemplate").findAll(where="title = '#trim("Publish comment")#'");
799804
var emailparams = {
800805
"name" = user.fullname,
801-
"buttonTitle" = "View Your Comment",
802-
"content" = "Thank you for engaging with our community. Your comment has been published and is now visible on the Wheels.dev platform.",
806+
"buttonTitle" = emaildata.buttonTitle,
807+
"content" = emaildata.message,
808+
"welcomeMessage"= emaildata.welcomeMessage,
803809
"URl" = siteurl,
804-
"Footer" = "If you haven't submitted a comment, please disregard this email.",
805-
"footerGreetings" = "Thank you for being part of the Wheels.dev community.",
810+
"footerNote" = emaildata.footerNote,
811+
"footerGreetings" = emaildata.footerGreating,
812+
"closingRemark" = emaildata.closingRemark,
813+
"teamSignature" = emaildata.teamSignature,
806814
"isSubscriber" = user.newsletter
807815
};
808816
emailContent = renderView(template="/email", layout=false, returnAs="string", params=emailparams);
809817
cfmail(
810818
to = "#user.email#",
811819
from = "#application.env.mail_from#",
812-
subject = "Your comment post has been published",
820+
subject = "#emaildata.subject#",
813821
server = "#application.env.smtp_host#",
814822
port = "#application.env.smtp_port#",
815823
username = "#application.env.smtp_username#",
@@ -872,21 +880,25 @@ component extends="app.Controllers.Controller" {
872880
blog.status = "Rejected"; //reject
873881
blog.isPublished = false;
874882
if (blog.save()) {
883+
var emaildata = model("emailTemplate").findAll(where="title = '#trim("Reject blog")#'");
875884
var emailparams = {
876885
"name" = user.fullname,
877-
"buttonTitle" = "View Your Post",
878-
"content" = "Thank you for your contribution to the Wheels.dev community. After careful review, we regret to inform you that your blog post '#blog.title#' has not been approved for publication at this time.",
886+
"buttonTitle" = emaildata.buttonTitle,
887+
"content" = emaildata.message,
888+
"welcomeMessage"= emaildata.welcomeMessage,
879889
"URl" = "",
880-
"Footer" = "If you haven't submitted a blog post, please disregard this email.",
881-
"footerGreetings" = "Thank you for being part of the Wheels.dev community.",
890+
"footerNote" = emaildata.footerNote,
891+
"footerGreetings" = emaildata.footerGreating,
892+
"closingRemark" = emaildata.closingRemark,
893+
"teamSignature" = emaildata.teamSignature,
882894
"isSubscriber" = user.newsletter
883895
};
884896
emailContent = renderView(template="/email", layout=false, returnAs="string", params=emailparams);
885897
cfheader(name="Content-Type" value="text/html; charset=UTF-8");
886898
cfmail(
887899
to = "#user.email#",
888900
from = "#application.env.mail_from#",
889-
subject = "Your blog post has been Rejected to publish",
901+
subject = "#emaildata.subject#",
890902
server = "#application.env.smtp_host#",
891903
port = "#application.env.smtp_port#",
892904
username = "#application.env.smtp_username#",
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
component extends="app.Controllers.Controller" {
2+
3+
function config() {
4+
verifies(except="index,view,edit,save,checkAdminAccess,checkRoleExistance", params="key", paramsTypes="integer");
5+
6+
usesLayout(template="/admin/AdminController/layout");
7+
filters(through="checkAdminAccess");
8+
}
9+
10+
function index(){
11+
emails = model("emailTemplate").findAll();
12+
}
13+
14+
function view(){
15+
email = model("emailTemplate").findAll(where="id = '#params.id#'");
16+
}
17+
18+
function edit(){
19+
email = model("emailTemplate").findAll(where="id = '#params.id#'");
20+
}
21+
22+
function save(){
23+
try{
24+
email = model("emailTemplate").findOne(where="id = '#params.id#'");
25+
if(structKeyExists(params, "id")){
26+
if (not isNull(email)) {
27+
// Edit the existing email post
28+
email.subject = params.subject;
29+
email.message = params.message;
30+
email.welcomeMessage = params.welcomeMessage;
31+
email.footerNote = params.footerNote;
32+
email.footerGreating = params.footerGreating;
33+
email.buttonTitle = params.buttonTitle;
34+
email.closingRemark = params.closingRemark;
35+
email.teamSignature = params.teamSignature;
36+
email.updatedAt = now();
37+
if (structKeyExists(params, "profilePicture") && isDefined("params.profilePicture")) {
38+
email.profilePicture = params.profilePicture
39+
}
40+
email.save();
41+
message = "Email content updated successfully.";
42+
} else {
43+
message = "Email not found for editing.";
44+
}
45+
// renderText("#message#");
46+
redirectto(route="#urlFor(route="adminemail-templates")#", success=message);
47+
return;
48+
}else{
49+
message="Something went wrong email content not updated correctly";
50+
redirectto(route="adminemail-templates", error=message);
51+
}
52+
53+
}catch(any e){
54+
// handle exception
55+
message="Something went wrong email content not updated correctly";
56+
redirectto(route="adminemail-templates", error=message);
57+
}
58+
}
59+
}

app/controllers/admin/testimonialController.cfc

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -217,21 +217,25 @@ component extends="app.Controllers.Controller" {
217217
Testimonial.isApproved = true;
218218
if (Testimonial.save()) {
219219
siteurl = urlFor(route="home", onlyPath=false);
220+
var emaildata = model("emailTemplate").findAll(where="title = '#trim("Publish Testimonial")#'");
220221
var emailparams = {
221222
"name" = user.fullname,
222-
"buttonTitle" = "View Your Testimonial",
223-
"content" = "Thank you for writing a testimonial. Your testimonial has been approved and published on the Wheels website.",
223+
"buttonTitle" = emaildata.buttonTitle,
224+
"content" = emaildata.message,
225+
"welcomeMessage"= emaildata.welcomeMessage,
224226
"URl" = siteurl,
225-
"Footer" = "If you did not write testinomial, you can safely ignore this email.",
226-
"footerGreetings" = "Thank you for being a part of Wheels community.",
227+
"footerNote" = emaildata.footerNote,
228+
"footerGreetings" = emaildata.footerGreating,
229+
"closingRemark" = emaildata.closingRemark,
230+
"teamSignature" = emaildata.teamSignature,
227231
"isSubscriber" = user.newsletter
228232
};
229233
emailContent = renderView(template="/email", layout=false, returnAs="string", params=emailparams);
230234
cfheader(name="Content-Type" value="text/html; charset=UTF-8");
231235
cfmail(
232236
to = "#user.email#",
233237
from = "#application.env.mail_from#",
234-
subject = "Your testimonial has been approved and published",
238+
subject = "#emaildata.subject#",
235239
server = "#application.env.smtp_host#",
236240
port = "#application.env.smtp_port#",
237241
username = "#application.env.smtp_username#",

app/controllers/web/AuthController.cfc

Lines changed: 27 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -524,16 +524,19 @@ component extends="app.Controllers.Controller" {
524524

525525
private function sendVerificationEmail(required string email, required string token) {
526526
var user = model("User").findOne(where="email='#email#'");
527+
var emaildata = model("emailTemplate").findAll(where="title = '#trim("Sign Up Account Verification")#'");
527528
verifyUrl = urlFor(action="verify", onlyPath=false);
528529
verifyUrl = verifyUrl & "?token=" & token;
529530
var emailparams = {
530531
"name" = user.fullname,
531-
"welcomeMessage" = "Welcome to the Wheels.dev Community!",
532-
"buttonTitle" = "Verify Your Account",
533-
"content" = "Thank you for joining the Wheels.dev community. Please click the button below to verify your account and start your journey with us.",
532+
"buttonTitle" = emaildata.buttonTitle,
533+
"content" = emaildata.message,
534+
"welcomeMessage"= emaildata.welcomeMessage,
534535
"URl" = verifyUrl,
535-
"Footer" = "If you haven't created an account, please disregard this email.",
536-
"footerGreetings" = "Thank you for becoming a part of Wheels community."
536+
"footerNote" = emaildata.footerNote,
537+
"footerGreetings" = emaildata.footerGreating,
538+
"closingRemark" = emaildata.closingRemark,
539+
"teamSignature" = emaildata.teamSignature
537540
};
538541
emailContent = renderView(template="/email", layout=false, returnAs="string", params=emailparams);
539542

@@ -542,7 +545,7 @@ component extends="app.Controllers.Controller" {
542545
cfmail(
543546
to = "#user.email#",
544547
from = "#application.env.mail_from#",
545-
subject = "Verify Your Account",
548+
subject = "#emaildata.subject#",
546549
server = "#application.env.smtp_host#",
547550
port = "#application.env.smtp_port#",
548551
username = "#application.env.smtp_username#",
@@ -801,20 +804,24 @@ component extends="app.Controllers.Controller" {
801804
}
802805
);
803806
var resetUrl = urlFor(action="resetPassword", token=token, onlyPath=false);
807+
var emaildata = model("emailTemplate").findAll(where="title = '#trim("Reset Password")#'");
804808
var emailparams = {
805809
"name" = name,
806-
"buttonTitle" = "Reset Password",
807-
"content" = "We received a request to reset the password for your Wheels.dev account. If you initiated this request, please click the button below to create a new password.",
810+
"buttonTitle" = emaildata.buttonTitle,
811+
"content" = emaildata.message,
812+
"welcomeMessage"= emaildata.welcomeMessage,
808813
"URl" = resetUrl,
809-
"Footer" = "If you haven't requested a password reset, please disregard this email.",
810-
"footerGreetings" = "Thank you for being part of the Wheels.dev community."
814+
"footerNote" = emaildata.footerNote,
815+
"footerGreetings" = emaildata.footerGreating,
816+
"closingRemark" = emaildata.closingRemark,
817+
"teamSignature" = emaildata.teamSignature
811818
};
812819
var emailContent = renderView(template="/email", layout=false, returnAs="string", params=emailparams);
813820
cfheader(name="Content-Type" value="text/html; charset=UTF-8");
814821
cfmail(
815822
to = "#arguments.email#",
816823
from = "#application.env.mail_from#",
817-
subject = "Reset Your Password",
824+
subject = "#emaildata.subject#",
818825
server = "#application.env.smtp_host#",
819826
port = "#application.env.smtp_port#",
820827
username = "#application.env.smtp_username#",
@@ -858,21 +865,24 @@ component extends="app.Controllers.Controller" {
858865
}
859866
);
860867
var signUpUrl = urlFor(action="register", onlyPath=false);
868+
var emaildata = model("emailTemplate").findAll(where="title = '#trim("Register Your Account")#'");
861869
var emailparams = {
862870
"name" = "User",
863-
"buttonTitle" = "Join Wheels.dev",
864-
"content" = "We noticed you attempted to reset your password using this email address, but no account was found. If you're new to Wheels.dev, we'd love to welcome you to our community!
865-
<br><br>Click below to create your free account and start building powerful web applications with our framework.",
871+
"buttonTitle" = emaildata.buttonTitle,
872+
"content" = emaildata.message,
873+
"welcomeMessage"= emaildata.welcomeMessage,
866874
"URl" = signUpUrl,
867-
"Footer" = "If you haven't requested a password reset, please disregard this email.",
868-
"footerGreetings" = ""
875+
"footerNote" = emaildata.footerNote,
876+
"footerGreetings" = emaildata.footerGreating,
877+
"closingRemark" = emaildata.closingRemark,
878+
"teamSignature" = emaildata.teamSignature
869879
};
870880
var emailContent = renderView(template="/email", layout=false, returnAs="string", params=emailparams);
871881
cfheader(name="Content-Type" value="text/html; charset=UTF-8");
872882
cfmail(
873883
to = "#arguments.email#",
874884
from = "#application.env.mail_from#",
875-
subject = "No Account Found : Get Started with Wheels Today!",
885+
subject = "#emaildata.subject#",
876886
server = "#application.env.smtp_host#",
877887
port = "#application.env.smtp_port#",
878888
username = "#application.env.smtp_username#",

0 commit comments

Comments
 (0)