From 691ae3e0c365a17865b633f3dd0dc9ce5bde3b28 Mon Sep 17 00:00:00 2001 From: Matthew Landauer Date: Wed, 6 Mar 2024 04:28:14 +0000 Subject: [PATCH] Add activate your account step 2 page --- .../_tailwind/users/activations/edit.html.erb | 47 +++++++++++++++++++ spec/features/activate_account_spec.rb | 17 +++++++ 2 files changed, 64 insertions(+) create mode 100644 app/views/_tailwind/users/activations/edit.html.erb diff --git a/app/views/_tailwind/users/activations/edit.html.erb b/app/views/_tailwind/users/activations/edit.html.erb new file mode 100644 index 000000000..83591ceef --- /dev/null +++ b/app/views/_tailwind/users/activations/edit.html.erb @@ -0,0 +1,47 @@ +<%# TODO: This page needs a proper design %> +<%# TODO: Extract out component for this centred block %> +
+ <%# This is using a different style than the standard Heading component %> + <%= render Tailwind::Heading.new(tag: :h1, color: "fuchsia", extra_classes: "my-20 text-center").with_content("Activate your account") %> + + <%= form_with model: @user, url: users_activation_path, method: :put, builder: FormBuilders::Tailwind do |f| %> + <%= f.hidden_field :reset_password_token %> + +
+
+ <%= f.label :name, "Your full name", class: "block" %> + <%= f.text_field :name, class: "mt-1 block w-full", autofocus: true, autocomplete: "name", placeholder: "e.g. Jane Citizen" %> + <%= f.error :name, class: "mt-2" %> +
+ +
+ <%= f.label :password, "Password", class: "block" %> + <%= f.password_field :password, class: "mt-1 block w-full", autocomplete: "new-password" %> + <%= f.error :password, class: "mt-2" %> + <% if @minimum_password_length %> +

<%= @minimum_password_length %> characters minimum

+ <% end %> +
+ +
+ <%= f.button "Activate my account" %> +
+
+ <% end %> +
+ <%= render "privacy_policy" %> +
+
+ +<% +=begin +%> + +

+ After you have activated your account you will be able to login using your + email and password. +

+ +<% +=end +%> \ No newline at end of file diff --git a/spec/features/activate_account_spec.rb b/spec/features/activate_account_spec.rb index 22b3fc2be..f2c9627f6 100644 --- a/spec/features/activate_account_spec.rb +++ b/spec/features/activate_account_spec.rb @@ -37,6 +37,23 @@ # rubocop:enable RSpec/NoExpectationExample end + context "when on final activate your account page in the new design" do + before do + # Do this weird dance to get us on to the new theme + sign_in create(:confirmed_user, tailwind_theme: true) + visit root_path + sign_out :user + # Strictly this page needs a token to function but for the purposes of this we don't need to do that + visit edit_users_activation_path + end + + # rubocop:disable RSpec/NoExpectationExample + it "renders the page", js: true do + page.percy_snapshot("Activate step 2") + end + # rubocop:enable RSpec/NoExpectationExample + end + context "with a confirmed user that has not been activated" do before do u = User.new(email: "matthew@oaf.org.au", from_alert_or_comment: true, confirmed_at: Time.zone.now)