From 0d6f9c4501eb18abb7c9f38594dba8ef0f8e8802 Mon Sep 17 00:00:00 2001 From: Harefx Date: Sun, 4 Apr 2021 04:25:48 +0700 Subject: [PATCH] make Sign Up more obvious --- app/javascript/components/NavBar.vue | 3 +++ app/policies/nav_bar_policy.rb | 1 + app/views/devise/sessions/new.html.erb | 1 + app/views/devise/shared/_links.html.erb | 2 +- spec/policies/nav_bar_policy_spec.rb | 4 ++-- 5 files changed, 8 insertions(+), 3 deletions(-) diff --git a/app/javascript/components/NavBar.vue b/app/javascript/components/NavBar.vue index 862a83fc8..bd78f9ed8 100644 --- a/app/javascript/components/NavBar.vue +++ b/app/javascript/components/NavBar.vue @@ -25,6 +25,9 @@ Login + + Sign Up + Logout diff --git a/app/policies/nav_bar_policy.rb b/app/policies/nav_bar_policy.rb index 359762833..175a1f0d3 100644 --- a/app/policies/nav_bar_policy.rb +++ b/app/policies/nav_bar_policy.rb @@ -2,6 +2,7 @@ class NavBarPolicy < ApplicationPolicy def visible_buttons visible = Set.new visible << (user ? 'Logout' : 'Login') + visible << 'Sign Up' unless user visible << 'Feedback' if user visible.merge %w[Glossary Contributions] if system_settings.peer_to_peer? visible.merge %w[Contributions Matches Admin] if can_admin? diff --git a/app/views/devise/sessions/new.html.erb b/app/views/devise/sessions/new.html.erb index 3e2fedd55..bee6a0a22 100644 --- a/app/views/devise/sessions/new.html.erb +++ b/app/views/devise/sessions/new.html.erb @@ -38,6 +38,7 @@
<%= f.button :submit, "Log in", class: "button is-primary" %> + <%= link_to "Sign Up", new_user_registration_path, class: "button is-success" %>
<% end %> diff --git a/app/views/devise/shared/_links.html.erb b/app/views/devise/shared/_links.html.erb index 3e3fb1f97..3f48d81ec 100644 --- a/app/views/devise/shared/_links.html.erb +++ b/app/views/devise/shared/_links.html.erb @@ -2,7 +2,7 @@ <%= link_to "Log in", new_session_path(resource_name) %>
<% end %> -<%- if devise_mapping.registerable? && controller_name != 'registrations' %> +<%- if devise_mapping.registerable? && !controller_name.in?(['registrations', 'sessions']) %> <%= link_to "Sign up", new_registration_path(resource_name) %>
<% end %> diff --git a/spec/policies/nav_bar_policy_spec.rb b/spec/policies/nav_bar_policy_spec.rb index 7e150f069..2bc3faccd 100644 --- a/spec/policies/nav_bar_policy_spec.rb +++ b/spec/policies/nav_bar_policy_spec.rb @@ -11,11 +11,11 @@ context 'guest' do let(:user) { nil } - it { is_expected.to match_array %w[Login] } + it { is_expected.to match_array ["Login", "Sign Up"] } context 'in peer_to_peer mode' do let(:peer_to_peer?) { true } - it { is_expected.to match_array %w[Glossary Contributions Login] } + it { is_expected.to match_array ["Glossary", "Contributions", "Login", "Sign Up"] } end end