Skip to content

Commit 28aa8b3

Browse files
author
Lewis Youl
committed
feat: add new user sign up/in pages
1 parent 10c9ecd commit 28aa8b3

File tree

9 files changed

+49
-74
lines changed

9 files changed

+49
-74
lines changed

app/controllers/confirmations_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
class ConfirmationsController < Devise::ConfirmationsController
2-
layout 'modal_fake'
2+
layout 'basic'
33

44
before_action :set_content
55

app/controllers/modals/users_controller.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@ def sign_in_sign_up
77
def sign_in
88
@user = User.new
99
@header = "Sign in to your account"
10-
@sub_header = "Don't have an account yet? #{view_context.link_to('Sign up', '', class: "text-cyan hover:text-cyan-hover", data: { controller: 'modal', modal_url_value: sign_up_modals_users_path, action: 'click->modal#present' })}".html_safe
10+
@sub_header = "Don't have an account yet? #{view_context.link_to('Sign up', '', class: "text-cyan hover:text-cyan-hover font-medium", data: { controller: 'modal', modal_url_value: sign_up_modals_users_path, action: 'click->modal#present' })}".html_safe
1111
@footer = view_context.link_to("Didn't receive confirmation instructions?", new_user_confirmation_path).html_safe
1212
end
1313

1414
def sign_up
1515
@user = User.new
1616
@header = 'Sign up for an account'
17-
@sub_header = "Already have an account? #{view_context.link_to('Sign in', '', class: "text-cyan hover:text-cyan-hover", data: { controller: 'modal', modal_url_value: sign_in_modals_users_path, action: 'click->modal#present' })}".html_safe
17+
@sub_header = "Already have an account? #{view_context.link_to('Sign in', '', class: "text-cyan hover:text-cyan-hover font-medium", data: { controller: 'modal', modal_url_value: sign_in_modals_users_path, action: 'click->modal#present' })}".html_safe
1818
end
1919

2020
def edit_avatar; end

app/controllers/passwords_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
class PasswordsController < Devise::PasswordsController
2-
layout 'modal_fake'
2+
layout 'basic'
33

44
def new
55
@header = 'Forgot your password?'

app/controllers/registrations_controller.rb

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
class RegistrationsController < Devise::RegistrationsController
2-
layout :pick_layout
2+
layout 'basic'
33

44
def new
55
@user = User.new
66
@header = 'Sign up for an account'
7-
@sub_header = "Already have an account? #{view_context.link_to('Sign in', new_user_session_path, class: "text-cyan hover:text-cyan-hover")}".html_safe
7+
@sub_header = "Already have an account? #{view_context.link_to('Sign in', new_user_session_path, class: "text-cyan hover:text-cyan-hover font-medium")}".html_safe
88

99
super
1010
end
@@ -14,7 +14,7 @@ def create
1414
format.html do
1515
@user = User.new
1616
@header = 'Sign up for an account'
17-
@sub_header = "Already have an account? #{view_context.link_to('Sign in', new_user_session_path, class: "text-cyan hover:text-cyan-hover")}".html_safe
17+
@sub_header = "Already have an account? #{view_context.link_to('Sign in', new_user_session_path, class: "text-cyan hover:text-cyan-hover font-medium")}".html_safe
1818

1919
super
2020
end
@@ -48,10 +48,4 @@ def update
4848
def user_params
4949
params.require(:user).permit(:email, :name, :password, :password_confirmation)
5050
end
51-
52-
APPLICATION_LAYOUTS = %w(edit update).freeze
53-
54-
def pick_layout
55-
APPLICATION_LAYOUTS.include?(action_name) ? 'application' : 'modal_fake'
56-
end
5751
end

app/controllers/sessions_controller.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
class SessionsController < Devise::SessionsController
2-
layout 'modal_fake'
2+
layout 'basic'
33

44
before_action :set_content, only: :new
55

@@ -27,7 +27,7 @@ def user_params
2727

2828
def set_content
2929
@header = "Sign in to your account"
30-
@sub_header = "Don't have an account yet? #{view_context.link_to('Sign up', new_user_registration_path, class: "text-cyan hover:text-cyan-hover")}".html_safe
30+
@sub_header = "Don't have an account yet? #{view_context.link_to('Sign up', new_user_registration_path, class: "text-cyan hover:text-cyan-hover font-medium")}".html_safe
3131
@footer = view_context.link_to("Didn't receive confirmation instructions?", new_user_confirmation_path).html_safe
3232
end
3333
end

app/views/layouts/basic.html.erb

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<title>Snippet Safe | Create, file and share code snippets</title>
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
7+
<%= csrf_meta_tags %>
8+
<%= csp_meta_tag %>
9+
10+
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
11+
12+
<%= javascript_pack_tag 'snippet_app' %>
13+
<%= javascript_pack_tag 'application', 'data-turbolinks-track': 'reload' %>
14+
15+
<%= favicon_link_tag '/favicon.ico' %>
16+
<%= stylesheet_pack_tag "application", "data-turbo-track": "reload" %>
17+
</head>
18+
19+
<body>
20+
<%= yield %>
21+
</body>
22+
</html>

app/views/layouts/modal_fake.html.erb

Lines changed: 0 additions & 46 deletions
This file was deleted.
Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,19 @@
1-
<div>
2-
<h1 class="text-center text-4xl"><%= header %></h1>
3-
<p class="text-center mt-2"><%= sub_header %></p>
4-
5-
<div class="m-auto max-w-sm bg-cyan-light p-4 mt-8 mb-10 rounded-sm">
6-
<%= yield %>
1+
<div class="min-h-screen bg-gray-50 flex flex-col justify-center py-12 sm:px-6 lg:px-8">
2+
<div class="sm:mx-auto sm:w-full sm:max-w-md">
3+
<%= link_to unauthenticated_root_path do %>
4+
<img class="mx-auto h-12 w-auto mb-4" src="/logos/logo_square.png" alt="Workflow">
5+
<% end %>
6+
<h1 class="text-center text-4xl"><%= header %></h1>
7+
<p class="text-center mt-2"><%= sub_header %></p>
78
</div>
89

9-
<% if defined?(footer) %>
10-
<p class="text-center text-cyan hover:text-cyan-hover"><%= footer %></p>
11-
<% end %>
12-
</div>
10+
<div class="mt-8 sm:mx-auto sm:w-full sm:max-w-md">
11+
<div class="bg-cyan-light py-8 px-4 sm:rounded-lg sm:px-10">
12+
<%= yield %>
13+
</div>
14+
15+
<% if defined?(footer) %>
16+
<p class="text-center text-cyan hover:text-cyan-hover mt-8 font-medium"><%= footer %></p>
17+
<% end %>
18+
</div>
19+
</div>

app/views/snippets/_snippets.html.erb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
<% if @snippets.any? %>
2-
<% @snippets.each do |snippet| %>
3-
<%= render partial: 'snippets/snippet_preview', locals: { snippet: snippet } %>
4-
<% end %>
2+
<%= render partial: 'snippets/snippet_preview', collection: @snippets, as: :snippet %>
53
<% else %>
64
<%= render 'shared/empty_state_message' do %>
75
<span class="color-grey block text-center margin-top">It looks like there aren't any snippets to show. You can <%= link_to('click here', @modal_url, data: { controller: 'modal', action: 'modal#present', modal_url_value: @modal_url }, class: 'color-primary') %> to create one or why not <%= link_to 'follow', connect_path, class: 'color-primary' %> some people that have?</span>

0 commit comments

Comments
 (0)