Skip to content

make Sign Up more obvious #925

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions app/javascript/components/NavBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@
<b-navbar-item tag="div" v-if="visible('Login')">
<a href="/users/sign_in" class="button is-outlined">Login</a>
</b-navbar-item>
<b-navbar-item tag="div" v-if="visible('Sign Up')">
<a href="/users/sign_up" class="button is-outlined">Sign Up</a>
</b-navbar-item>
<b-navbar-item tag="div" v-if="visible('Logout')">
<DeleteButton action="/users/sign_out">Logout</DeleteButton>
</b-navbar-item>
Expand Down
1 change: 1 addition & 0 deletions app/policies/nav_bar_policy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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?
Expand Down
7 changes: 5 additions & 2 deletions app/views/devise/sessions/new.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,11 @@
:type => "password"%>
</div>
</div>
<div class="" id="login_button">
<%= f.button :submit, "Log in", class: "button is-primary" %>
<div class="is-flex columns is-centered mt-1">
<div class="" id="login_button">
<%= f.button :submit, "Log in", class: "button is-primary" %>
</div>
<%= link_to "Sign Up", new_user_registration_path, class: "button is-success ml-1" %>
</div>
</div>
<% end %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/devise/shared/_links.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<%= link_to "Log in", new_session_path(resource_name) %><br />
<% end %>

<%- if devise_mapping.registerable? && controller_name != 'registrations' %>
<%- if devise_mapping.registerable? && !controller_name.in?(['registrations', 'sessions']) %>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TIL about in?! 🙏🏾

<%= link_to "Sign up", new_registration_path(resource_name) %><br />
<% end %>

Expand Down
4 changes: 2 additions & 2 deletions spec/policies/nav_bar_policy_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down