summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2018-07-09 14:49:33 +0000
committerDouwe Maan <douwe@gitlab.com>2018-07-09 14:49:33 +0000
commit2b4509c4a45d8c02d89fa48bb24e50c20e51b40c (patch)
treec03a3c24092ed41c08cc3c077edc87ce8075f222
parent9a9b4444ac176dbfda8ed38653550931fe7671f3 (diff)
parent1da22cec12cc2c82fdc59b648149dde55b3fd7b3 (diff)
downloadgitlab-ce-2b4509c4a45d8c02d89fa48bb24e50c20e51b40c.tar.gz
Merge branch 'DustinU/fix/sign-in-button-text-48917' into 'master'
Show "Sign in" instead of "Sign in / Register" when sign up is disabled See merge request gitlab-org/gitlab-ce!20474
-rw-r--r--app/views/layouts/header/_default.html.haml4
-rw-r--r--spec/features/users/show_spec.rb24
2 files changed, 27 insertions, 1 deletions
diff --git a/app/views/layouts/header/_default.html.haml b/app/views/layouts/header/_default.html.haml
index d8e32651b36..3aa8eb18bf3 100644
--- a/app/views/layouts/header/_default.html.haml
+++ b/app/views/layouts/header/_default.html.haml
@@ -61,7 +61,9 @@
- if header_link?(:sign_in)
%li.nav-item
%div
- = link_to "Sign in / Register", new_session_path(:user, redirect_to_referer: 'yes'), class: 'btn btn-sign-in'
+ - sign_in_text = allow_signup? ? 'Sign in / Register' : 'Sign in'
+ = link_to sign_in_text, new_session_path(:user, redirect_to_referer: 'yes'), class: 'btn btn-sign-in'
+
%button.navbar-toggler.d-block.d-sm-none{ type: 'button' }
%span.sr-only Toggle navigation
diff --git a/spec/features/users/show_spec.rb b/spec/features/users/show_spec.rb
index b5bbb2c0ea5..3e2fb704bc6 100644
--- a/spec/features/users/show_spec.rb
+++ b/spec/features/users/show_spec.rb
@@ -14,4 +14,28 @@ describe 'User page' do
expect(page).to have_link('Snippets')
end
end
+
+ context 'signup disabled' do
+ it 'shows the sign in link' do
+ stub_application_setting(signup_enabled: false)
+
+ visit(user_path(user))
+
+ page.within '.navbar-nav' do
+ expect(page).to have_link('Sign in')
+ end
+ end
+ end
+
+ context 'signup enabled' do
+ it 'shows the sign in and register link' do
+ stub_application_setting(signup_enabled: true)
+
+ visit(user_path(user))
+
+ page.within '.navbar-nav' do
+ expect(page).to have_link('Sign in / Register')
+ end
+ end
+ end
end