Skip to content

Commit 37d553a

Browse files
committed
Add Thanks page for post-registration
1 parent 6032cb8 commit 37d553a

File tree

6 files changed

+123
-35
lines changed

6 files changed

+123
-35
lines changed

app/controllers/users/registrations_controller.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def create
1717
@user = User.new(create_user_params)
1818
if @user.save
1919
EmailConfirmationNotifier.deliver_to(@user)
20-
redirect_to root_path, notice: "Welcome to Joy of Rails! Please check your email for confirmation instructions"
20+
redirect_to thanks_users_registration_path, notice: "Welcome to Joy of Rails! Please check your email for confirmation instructions"
2121
else
2222
render Users::Registrations::NewView.new(user: @user), status: :unprocessable_entity
2323
end
@@ -58,6 +58,10 @@ def destroy
5858
redirect_to root_path, notice: "Your account has been deleted"
5959
end
6060

61+
def thanks
62+
render Users::Dashboard::IndexView.new
63+
end
64+
6165
private
6266

6367
def feature_enabled!

app/javascript/css/utilities/tailwind.css

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -937,3 +937,15 @@ focus\:ring-0:focus {
937937
.max-w-sm {
938938
max-width: 24rem;
939939
}
940+
941+
.list-disc {
942+
list-style-type: disc;
943+
}
944+
945+
.list-inside {
946+
list-style-position: inside;
947+
}
948+
949+
.list-outside {
950+
list-style-position: outside;
951+
}

app/views/users/dashboard/index_view.rb

Lines changed: 44 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -4,37 +4,50 @@ class Users::Dashboard::IndexView < ApplicationView
44
include Phlex::Rails::Helpers::LinkTo
55

66
def view_template
7-
div(class: "container lg:mt-12 md:mt-8") do
8-
h1 { "Welcome to Joy of Rails!" }
9-
p { "Thank you for signing up." }
10-
p { "Here's what you can do next:" }
11-
ul(class: "list-disc list-inside") do
12-
li do
13-
plain "Check out"
14-
whitespace
15-
strong { link_to("articles", "/articles") }
16-
whitespace
17-
plain "I’ve written on Ruby, Rails, and Hotwire."
18-
end
19-
li do
20-
plain "If you’re interested in learning how this app is built or even contributing to it, check out the"
21-
whitespace
22-
link_to("source code", "https://github.com/joyofrails/joyofrails")
23-
whitespace
24-
plain "on GitHub."
25-
end
26-
li do
27-
plain "Connect with me on"
28-
whitespace
29-
link_to("Twitter", "https://twitter.com/rossta", target: "_blank")
30-
plain ","
31-
whitespace
32-
link_to("Mastodon", "https://ruby.social/rossta", target: "_blank")
33-
whitespace
34-
plain ", and"
35-
whitespace
36-
link_to("LinkedIn", "https://www.linkedin.com/in/rosskaffenberger", target: "_blank")
37-
whitespace
7+
article do
8+
render Pages::Header.new(
9+
title: "Welcome to Joy of Rails!",
10+
description: "Thank you for signing up 😂"
11+
)
12+
13+
div(class: "container article-content") do
14+
p { "Here's what you can do next:" }
15+
ul(class: "list-disc list-outside px-4") do
16+
li do
17+
plain "Check your your email for a confirmation link to activate your account."
18+
whitespace
19+
plain "If you don’t see it, check your spam folder, or you can"
20+
whitespace
21+
link_to("resend the confirmation email", new_users_confirmation_path)
22+
plain "."
23+
end
24+
li do
25+
plain "Check out"
26+
whitespace
27+
strong { link_to("articles", "/articles") }
28+
whitespace
29+
plain "I’ve written on Ruby, Rails, and Hotwire."
30+
end
31+
li do
32+
plain "If you’re interested in learning how this app is built or even contributing to it, check out the"
33+
whitespace
34+
link_to("source code", "https://github.com/joyofrails/joyofrails")
35+
whitespace
36+
plain "on GitHub."
37+
end
38+
li do
39+
plain "Connect with me on"
40+
whitespace
41+
link_to("Twitter", "https://twitter.com/rossta", target: "_blank")
42+
plain ","
43+
whitespace
44+
link_to("Mastodon", "https://ruby.social/rossta", target: "_blank")
45+
whitespace
46+
plain ", and"
47+
whitespace
48+
link_to("LinkedIn", "https://www.linkedin.com/in/rosskaffenberger", target: "_blank")
49+
whitespace
50+
end
3851
end
3952
end
4053
end
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# frozen_string_literal: true
2+
3+
class Users::Registration::ThanksView < ApplicationView
4+
include Phlex::Rails::Helpers::LinkTo
5+
6+
def view_template
7+
article do
8+
render Pages::Header.new(
9+
title: "Welcome to Joy of Rails!",
10+
description: "Thank you for signing up 😂"
11+
)
12+
13+
div(class: "container article-content") do
14+
p { "Here's what you can do next:" }
15+
ul(class: "list-disc list-outside px-4") do
16+
li do
17+
plain "Check your your email for a confirmation link to activate your account."
18+
whitespace
19+
plain "If you don’t see it, check your spam folder, or you can"
20+
whitespace
21+
link_to("resend the confirmation email", new_users_confirmation_path)
22+
plain "."
23+
end
24+
li do
25+
plain "Check out"
26+
whitespace
27+
strong { link_to("articles", "/articles") }
28+
whitespace
29+
plain "I’ve written on Ruby, Rails, and Hotwire."
30+
end
31+
li do
32+
plain "If you’re interested in learning how this app is built or even contributing to it, check out the"
33+
whitespace
34+
link_to("source code", "https://github.com/joyofrails/joyofrails")
35+
whitespace
36+
plain "on GitHub."
37+
end
38+
li do
39+
plain "Connect with me on"
40+
whitespace
41+
link_to("Twitter", "https://twitter.com/rossta", target: "_blank")
42+
plain ","
43+
whitespace
44+
link_to("Mastodon", "https://ruby.social/rossta", target: "_blank")
45+
whitespace
46+
plain ", and"
47+
whitespace
48+
link_to("LinkedIn", "https://www.linkedin.com/in/rosskaffenberger", target: "_blank")
49+
whitespace
50+
end
51+
end
52+
end
53+
end
54+
end
55+
end

config/routes.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,11 @@
3333

3434
namespace :users do
3535
resource :header_navigation, only: [:show]
36-
resource :registration, only: [:new, :create, :edit, :update, :destroy]
36+
resource :registration, only: [:new, :create, :edit, :update, :destroy] do
37+
collection do
38+
get :thanks
39+
end
40+
end
3741
resources :confirmations, only: [:new, :create, :edit, :update], param: :token
3842
resources :passwords, only: [:new, :create, :edit, :update], param: :token
3943

spec/requests/users/registrations_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
Flipper[:user_registration].enable
88
end
99

10-
describe "GET create" do
10+
describe "GET new" do
1111
it "succeeds for signed out user" do
1212
get new_users_registration_path
1313

@@ -31,7 +31,7 @@
3131
params: {user: {email: email, password: "password", password_confirmation: "password"}}
3232
}.to change(User, :count).by(1)
3333

34-
expect(response).to redirect_to(root_path)
34+
expect(response).to redirect_to(thanks_users_registration_path)
3535
expect(flash[:notice]).to eq("Welcome to Joy of Rails! Please check your email for confirmation instructions")
3636

3737
perform_enqueued_jobs_and_subsequently_enqueued_jobs

0 commit comments

Comments
 (0)