From e90a3138674afff285476c704a7f23a789d93218 Mon Sep 17 00:00:00 2001
From: capak07 <69026837+capak07@users.noreply.github.com>
Date: Sun, 24 Jul 2022 22:01:46 -0300
Subject: [PATCH 1/2] Added mail methods
---
Gemfile | 1 +
Gemfile.lock | 7 ++++++
app/assets/stylesheets/application.css | 11 +++++++++-
.../concerns/accounts_controller.rb | 6 +++--
app/mailers/user_mailer.rb | 2 +-
app/views/accounts/show.html.erb | 2 +-
app/views/layouts/mailer.html.erb | 1 -
app/views/pages/about.html.erb | 2 +-
app/views/pages/home.html.erb | 2 +-
app/views/user_mailer/demo.text.erb | 8 +++----
app/views/user_mailer/welcome_email.html.erb | 17 +++++++++-----
config/environments/development.rb | 19 ++++++++++++++++
config/environments/production.rb | 22 ++++++++++++++++++-
test/mailers/previews/user_mailer_preview.rb | 4 ++++
14 files changed, 85 insertions(+), 19 deletions(-)
diff --git a/Gemfile b/Gemfile
index f72e1f6..ce1af1f 100644
--- a/Gemfile
+++ b/Gemfile
@@ -73,4 +73,5 @@ group :test do
gem "httparty"
gem "uri"
gem "net-http"
+ gem "sidekiq"
end
diff --git a/Gemfile.lock b/Gemfile.lock
index 9c324a2..c5a17e6 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -83,6 +83,7 @@ GEM
xpath (~> 3.2)
childprocess (4.1.0)
concurrent-ruby (1.1.10)
+ connection_pool (2.2.5)
crass (1.0.6)
debug (1.6.1)
irb (>= 1.3.6)
@@ -193,6 +194,7 @@ GEM
thor (~> 1.0)
zeitwerk (~> 2.5)
rake (13.0.6)
+ redis (4.7.1)
regexp_parser (2.5.0)
reline (0.3.1)
io-console (~> 0.5)
@@ -203,6 +205,10 @@ GEM
rexml (~> 3.2, >= 3.2.5)
rubyzip (>= 1.2.2, < 3.0)
websocket (~> 1.0)
+ sidekiq (6.5.1)
+ connection_pool (>= 2.2.2)
+ rack (~> 2.0)
+ redis (>= 4.2.0)
sprockets (4.1.1)
concurrent-ruby (~> 1.0)
rack (> 1, < 3)
@@ -262,6 +268,7 @@ DEPENDENCIES
puma (~> 5.0)
rails (~> 7.0.3, >= 7.0.3.1)
selenium-webdriver
+ sidekiq
sprockets-rails
sqlite3 (~> 1.4)
stimulus-rails
diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css
index 0ae6f4f..49872d0 100644
--- a/app/assets/stylesheets/application.css
+++ b/app/assets/stylesheets/application.css
@@ -66,7 +66,6 @@ body {
-moz-background-size: cover;
background-size: cover;
-o-background-size: cover;
- height: 682px;
}
h1 {
color: hsl(0, 0%, 28%);
@@ -94,4 +93,14 @@ body {
100% {
background-position: 680px;
}
+ }
+
+ .connect{
+
+ min-height: 700px;
+ -webkit-background-size: cover;
+ -moz-background-size: cover;
+ background-size: cover;
+ -o-background-size: cover;
+ }
}
\ No newline at end of file
diff --git a/app/controllers/concerns/accounts_controller.rb b/app/controllers/concerns/accounts_controller.rb
index 0eef0c8..3ae3690 100644
--- a/app/controllers/concerns/accounts_controller.rb
+++ b/app/controllers/concerns/accounts_controller.rb
@@ -36,8 +36,8 @@ def transact
# POST /accounts or /accounts.json
def create
@account = Account.new(account_params)
- user = User.create(id: @account.id,name: @account.first_name + " " + @account.last_name,email: @account.email)
- UserMailer.with(user: user).welcome_email.deliver_now
+ user = User.create(name: @account.first_name + " " + @account.last_name, email: @account.email)
+ UserMailer.with(user: user).welcome_email.deliver_now
respond_to do |format|
if @account.save
format.json { render json: { status: 'success', message: 'Account was created', data: @account } }
@@ -65,7 +65,9 @@ def update
# DELETE /accounts/1 or /accounts/1.json
def destroy
+ @account = Account.find(params[:id])
user = User.find(@account.id)
+ debugger
@account.destroy
user.destroy
respond_to do |format|
diff --git a/app/mailers/user_mailer.rb b/app/mailers/user_mailer.rb
index 077d10a..c0b96b7 100644
--- a/app/mailers/user_mailer.rb
+++ b/app/mailers/user_mailer.rb
@@ -5,7 +5,7 @@ class UserMailer < ApplicationMailer
def demo
- mail(to: "atharvabkadam@gmail.com", subject: "Test", message: "Test Email sent successfully")
+ mail(to: "akadam1@unb.ca", subject: "Test", message: "Test Email sent successfully")
end
diff --git a/app/views/accounts/show.html.erb b/app/views/accounts/show.html.erb
index 71fc8f0..ce38025 100644
--- a/app/views/accounts/show.html.erb
+++ b/app/views/accounts/show.html.erb
@@ -6,5 +6,5 @@
<%= link_to "Debit", debit_account_path ,class: "btn btn-dark" %>
<%= link_to "Back to accounts", accounts_path, class: "btn btn-primary" %>
- <%= link_to "Destroy this account", @account, method: :delete, class: "btn btn-danger mt-3" %>
+ <%= link_to "Destroy this account",@account,method: :delete, class: "btn btn-danger mt-3" %>
\ No newline at end of file
diff --git a/app/views/layouts/mailer.html.erb b/app/views/layouts/mailer.html.erb
index cbd34d2..62fb5d2 100644
--- a/app/views/layouts/mailer.html.erb
+++ b/app/views/layouts/mailer.html.erb
@@ -3,7 +3,6 @@
diff --git a/app/views/user_mailer/demo.text.erb b/app/views/user_mailer/demo.text.erb index 147c223..54967f0 100644 --- a/app/views/user_mailer/demo.text.erb +++ b/app/views/user_mailer/demo.text.erb @@ -1,9 +1,7 @@ -Welcome to example.com, +Welcome to localhost:3000 =============================================== -You have successfully signed up to example.com, -your username is: - -To login to the site, just follow this link: +This was a test email sent by Atharva Kadam +You can delete this email Thanks for joining and have a great day! \ No newline at end of file diff --git a/app/views/user_mailer/welcome_email.html.erb b/app/views/user_mailer/welcome_email.html.erb index 0bda8a5..b8e3ef4 100644 --- a/app/views/user_mailer/welcome_email.html.erb +++ b/app/views/user_mailer/welcome_email.html.erb @@ -4,14 +4,21 @@
-
- You have successfully signed up to example.com,
- your username is: <%= @user.login %>.
+ You have successfully registered account with us.
+ Your username is: <%= @user.login %>.
- To login to the site, just follow this link: <%= @url %>.
+ If you need to check your balance go to:
+ <%= @user.email%>
Thanks for joining and have a great day!
+Thanks for joining and have a great day!
+ ----------------------------------------------------------------------------------
+ This is an auto generated email, do not reply
+ ----------------------------------------------------------------------------------
+
+