From 1482b17b5baeb7fa388da234a9c7db8903896eb1 Mon Sep 17 00:00:00 2001 From: Matthew Phelan Date: Fri, 19 Nov 2021 14:39:35 +0000 Subject: [PATCH] Your account page / personal details brochureware --- app/controllers/users/account_controller.rb | 4 ++ app/views/users/account/index.html.erb | 71 +++++++++++++++++++ .../users/account/personal_details.html.erb | 3 + config/routes.rb | 2 + spec/features/user_spec.rb | 21 ++++++ 5 files changed, 101 insertions(+) create mode 100644 app/controllers/users/account_controller.rb create mode 100644 app/views/users/account/index.html.erb create mode 100644 app/views/users/account/personal_details.html.erb diff --git a/app/controllers/users/account_controller.rb b/app/controllers/users/account_controller.rb new file mode 100644 index 000000000..ce617f836 --- /dev/null +++ b/app/controllers/users/account_controller.rb @@ -0,0 +1,4 @@ +class Users::AccountController < ApplicationController + def index; end + def personal_details; end +end \ No newline at end of file diff --git a/app/views/users/account/index.html.erb b/app/views/users/account/index.html.erb new file mode 100644 index 000000000..85abb6a07 --- /dev/null +++ b/app/views/users/account/index.html.erb @@ -0,0 +1,71 @@ +
+
+

+ Your account +

+

+ Personal details +

+
+
+
+ Name +
+
+
+
+ + Change name + +
+
+
+
+ Email address +
+
+
+
+ + Change email address + +
+
+
+
+ Password +
+
+ •••••••• +
+
+ + Change password + +
+
+
+
+ Organisation +
+
+
+
+ + +
+
+
+
+ Role +
+
+
+
+ + +
+
+
+
+
\ No newline at end of file diff --git a/app/views/users/account/personal_details.html.erb b/app/views/users/account/personal_details.html.erb new file mode 100644 index 000000000..5c7a746d2 --- /dev/null +++ b/app/views/users/account/personal_details.html.erb @@ -0,0 +1,3 @@ +

+ Personal details +

\ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index 2c0b14673..c9226c8df 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -8,6 +8,8 @@ Rails.application.routes.draw do ActiveAdmin.routes(self) root to: "test#index" get "about", to: "about#index" + get '/users/account', to: 'users/account#index' + get '/users/account/personal_details', to: 'users/account#personal_details' form_handler = FormHandler.instance form = form_handler.get_form("2021_2022") diff --git a/spec/features/user_spec.rb b/spec/features/user_spec.rb index 3f758ec74..10b8ee759 100644 --- a/spec/features/user_spec.rb +++ b/spec/features/user_spec.rb @@ -50,4 +50,25 @@ RSpec.describe "User Features" do expect { click_button("Send email") }.to change { ActionMailer::Base.deliveries.count }.by(1) end end + + context "Your Account " do + it "main page is present and accessible" do + visit("/users/account") + expect(page).to have_content("Your account") + end + + it "personal details page is present and accessible" do + visit("/users/account/personal_details") + expect(page).to have_content("Personal details") + end + + it "can navigate to personal details from main account page" do + visit("/users/account") + click_link("change-name") + expect(page).to have_content("Personal details") + visit("/users/account") + click_link("change-email") + expect(page).to have_content("Personal details") + end + end end