From f36f6866a7a6b2d5881b0f15c518533302588120 Mon Sep 17 00:00:00 2001 From: Sebastian Kippe Date: Wed, 23 Feb 2022 18:07:54 -0600 Subject: [PATCH] Port signup to new layout --- app/assets/stylesheets/legacy/_layout.scss | 2 +- app/controllers/admin/base_controller.rb | 5 +- app/controllers/invitations_controller.rb | 2 - app/controllers/signup_controller.rb | 7 +- app/views/layouts/admin.html.erb | 93 ------------------ app/views/layouts/application.html.erb | 15 ++- app/views/layouts/signup.html.erb | 40 -------- app/views/signup/index.html.erb | 27 +++--- app/views/signup/steps.html.erb | 102 +++++++++++--------- app/views/welcome/check_your_email.html.erb | 5 +- app/views/welcome/index.html.erb | 6 -- 11 files changed, 94 insertions(+), 210 deletions(-) delete mode 100644 app/views/layouts/admin.html.erb delete mode 100644 app/views/layouts/signup.html.erb delete mode 100644 app/views/welcome/index.html.erb diff --git a/app/assets/stylesheets/legacy/_layout.scss b/app/assets/stylesheets/legacy/_layout.scss index 7889464..afb2ef5 100644 --- a/app/assets/stylesheets/legacy/_layout.scss +++ b/app/assets/stylesheets/legacy/_layout.scss @@ -8,7 +8,7 @@ body { background-attachment: fixed; } -body#admin-panel { +body#admin { background: linear-gradient(35deg, rgba(255,0,255,0.2) 0, rgba(153,12,14,0.9) 100%), url('/img/bg-1.jpg'); background-size: cover; diff --git a/app/controllers/admin/base_controller.rb b/app/controllers/admin/base_controller.rb index 8688535..957328e 100644 --- a/app/controllers/admin/base_controller.rb +++ b/app/controllers/admin/base_controller.rb @@ -2,7 +2,10 @@ class Admin::BaseController < ApplicationController before_action :authenticate_user! before_action :authorize_admin + before_action :set_context - layout "admin" + def set_context + @context = :admin + end end diff --git a/app/controllers/invitations_controller.rb b/app/controllers/invitations_controller.rb index 72743e5..147cb6a 100644 --- a/app/controllers/invitations_controller.rb +++ b/app/controllers/invitations_controller.rb @@ -2,8 +2,6 @@ class InvitationsController < ApplicationController before_action :require_user_signed_in, except: ["show"] before_action :require_user_signed_out, only: ["show"] - layout "signup", only: ["show"] - # GET /invitations def index @invitations_unused = current_user.invitations.unused diff --git a/app/controllers/signup_controller.rb b/app/controllers/signup_controller.rb index a355b75..bfbf02e 100644 --- a/app/controllers/signup_controller.rb +++ b/app/controllers/signup_controller.rb @@ -3,8 +3,7 @@ class SignupController < ApplicationController before_action :require_invitation before_action :set_invitation before_action :set_new_user, only: ["steps", "validate"] - - layout "signup" + before_action :set_context def index @invited_by_name = @invitation.user.address @@ -105,4 +104,8 @@ class SignupController < ApplicationController invitation: @invitation ) end + + def set_context + @context = :signup + end end diff --git a/app/views/layouts/admin.html.erb b/app/views/layouts/admin.html.erb deleted file mode 100644 index 0141516..0000000 --- a/app/views/layouts/admin.html.erb +++ /dev/null @@ -1,93 +0,0 @@ - - - - Admin Panel | Kosmos Accounts - <%= csrf_meta_tags %> - <%= csp_meta_tag %> - - - <%= stylesheet_link_tag 'legacy', "data-turbo-track": "reload" %> - <%= stylesheet_link_tag 'application', "data-turbo-track": "reload" %> - <%= javascript_importmap_tags %> - - -
- - -
-
- <% flash.each do |type, data| %> - <%= render NotificationComponent.new(type: type, data: data) %> - <% end %> -
-
- - <%= yield %> -
- - diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 9c93bc3..d3de420 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -10,7 +10,7 @@ <%= stylesheet_link_tag 'application', "data-turbo-track": "reload" %> <%= javascript_importmap_tags %> - + class="h-full <%= @context == :admin ? "bg-red-500" : "bg-sky-900" %>">
-
<% flash.each do |type, data| %> diff --git a/app/views/layouts/signup.html.erb b/app/views/layouts/signup.html.erb deleted file mode 100644 index 3c02649..0000000 --- a/app/views/layouts/signup.html.erb +++ /dev/null @@ -1,40 +0,0 @@ - - - - Sign up | Kosmos Accounts - <%= csrf_meta_tags %> - <%= csp_meta_tag %> - - - <%= stylesheet_link_tag 'legacy', "data-turbo-track": "reload" %> - <%= stylesheet_link_tag 'application', "data-turbo-track": "reload" %> - <%= javascript_importmap_tags %> - - -
-
-

- <%= render partial: "shared/icons/comet" %> - Kosmos - Sign Up -

- <% if user_signed_in? %> -

- Signed in as <%= current_user.cn %>@kosmos.org. - <%= link_to "Log out", destroy_user_session_path, method: :delete %> -

- <% end %> -
- - <% flash.each do |type, msg| %> -
-

<%= msg %>

-
- <% end %> - -
- <%= yield %> -
-
- - diff --git a/app/views/signup/index.html.erb b/app/views/signup/index.html.erb index 25ed61e..fa72390 100644 --- a/app/views/signup/index.html.erb +++ b/app/views/signup/index.html.erb @@ -1,12 +1,15 @@ -

Welcome

-

- Hey there! You were invited to sign up for a Kosmos account by - <%= @invited_by_name %>. -

-

- This invitation can only be used once, and sign-up is currently only possible - by invitation. Seems like you have good friends! -

-

- <%= link_to "Get started", signup_steps_path(1), class: "btn btn-md btn-blue" %> -

+<%= render HeaderCompactComponent.new(title: "Welcome") %> + +<%= render MainCompactComponent.new do %> +

+ Hey there! You were invited to sign up for a Kosmos account by + <%= @invited_by_name %>. +

+

+ This invitation can only be used once, and sign-up is currently only possible + by invitation. Seems like you have good friends! +

+

+ <%= link_to "Get started", signup_steps_path(1), class: "btn btn-md btn-blue" %> +

+<% end %> diff --git a/app/views/signup/steps.html.erb b/app/views/signup/steps.html.erb index 53cf237..00a4d70 100644 --- a/app/views/signup/steps.html.erb +++ b/app/views/signup/steps.html.erb @@ -1,54 +1,60 @@ -<% case @step %> -<% when 1 %> -

Choose a username

- <%= form_for @user, :url => signup_validate_url do |f| %> -

- <%= f.label :cn, 'Username', class: 'hidden' %> - <%= f.text_field :cn, autofocus: true, autocomplete: "username", - class: 'text-xl' %> - @ - kosmos.org -

- <% if @validation_error.present? %> -

Username <%= @validation_error %>

- <% end %> -

- <%= f.submit "Continue", class: 'btn btn-md btn-blue' %> -

- <% end %> +<%= render HeaderCompactComponent.new(title: "Signup") %> -<% when 2 %> -

What's your email?

- <%= form_for @user, :url => signup_validate_url do |f| %> -

- <%= f.label :email, 'Email address', class: 'hidden' %> - <%= f.email_field :email, autofocus: true, autocomplete: 'email', class: 'text-xl' %> -

- <% if @validation_error.present? %> -

Email <%= @validation_error %>

+<%= render MainCompactComponent.new do %> + <% case @step %> + <% when 1 %> +

Choose a username

+ <%= form_for @user, :url => signup_validate_url do |f| %> +

+ <%= f.label :cn, 'Username', class: 'hidden' %> + <%= f.text_field :cn, autofocus: true, autocomplete: "username", + class: 'text-xl w-full md:w-3/5 mb-1' %> + @ + kosmos.org +

+ <% if @validation_error.present? %> +

Username <%= @validation_error %>

+ <% end %> +

+ <%= f.submit "Continue", class: 'btn btn-md btn-blue' %> +

<% end %> -

- <%= f.submit "Continue", class: 'btn btn-md btn-blue' %> -

- <% end %> -<% when 3 %> -

Choose a password

- - <%= form_for @user, :url => signup_validate_url do |f| %> -

- <%= f.label :password, 'Password', class: 'hidden' %> - <%= f.password_field :password, autofocus: true, class: 'text-xl' %> -

- <% if @validation_error.present? %> -

Password <%= @validation_error %>

+ <% when 2 %> +

What's your email?

+ <%= form_for @user, :url => signup_validate_url do |f| %> +

+ <%= f.label :email, 'Email address', class: 'hidden' %> + <%= f.email_field :email, autofocus: true, autocomplete: 'email', + class: 'text-xl w-full' %> +

+ <% if @validation_error.present? %> +

Email <%= @validation_error %>

+ <% end %> +

+ <%= f.submit "Continue", class: 'btn btn-md btn-blue' %> +

+ <% end %> + + <% when 3 %> +

Choose a password

+ + <%= form_for @user, :url => signup_validate_url do |f| %> +

+ <%= f.label :password, 'Password', class: 'hidden' %> + <%= f.password_field :password, autofocus: true, + class: 'text-xl w-full' %> +

+ <% if @validation_error.present? %> +

Password <%= @validation_error %>

+ <% end %> +

+ By clicking the button below, you accept our future Terms of Service + and Privacy Policy. Don't worry, they will be excellent! +

+

+ <%= f.submit "Create account", class: 'btn-md btn-blue' %> +

<% end %> -

- By clicking the button below, you accept our future Terms of Service - and Privacy Policy. Don't worry, they will be excellent! -

-

- <%= f.submit "Create account", class: 'btn-md btn-blue' %> -

<% end %> <% end %> diff --git a/app/views/welcome/check_your_email.html.erb b/app/views/welcome/check_your_email.html.erb index c16305a..c30f511 100644 --- a/app/views/welcome/check_your_email.html.erb +++ b/app/views/welcome/check_your_email.html.erb @@ -2,6 +2,9 @@ <%= render MainCompactComponent.new do %>

- You can close this window or tab now. + Please check your inbox! +

+

+ (You can close this window or tab now.)

<% end %> diff --git a/app/views/welcome/index.html.erb b/app/views/welcome/index.html.erb deleted file mode 100644 index a4984de..0000000 --- a/app/views/welcome/index.html.erb +++ /dev/null @@ -1,6 +0,0 @@ -

- <%=link_to "Sign up for a new account" %> -

-

- <%=link_to "Manage your existing account", new_user_session_path %> -