Skip to content

Commit

Permalink
make Sign Up more obvious
Browse files Browse the repository at this point in the history
  • Loading branch information
hairedfox committed Apr 5, 2021
1 parent 0c31bb5 commit 56acab8
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 5 deletions.
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']) %>
<%= 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

0 comments on commit 56acab8

Please sign in to comment.