diff options
author | Douwe Maan <douwe@gitlab.com> | 2015-09-24 07:51:52 +0000 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2015-09-24 14:26:12 -0400 |
commit | 55d771104c2e5b61dbbca3eeb3f2eec9542d7394 (patch) | |
tree | bc2fca28131ff5891ca4139700aead19a11d6612 | |
parent | ae51989e19cc3ecf8f9739d9ceccd6c926135e69 (diff) | |
download | gitlab-ce-55d771104c2e5b61dbbca3eeb3f2eec9542d7394.tar.gz |
Merge branch 'rs-help-page' into 'master'
Help page improvements
- Only signed-in users can see version information
- Add "Community Edition" text so the header is
less barren when version information is hidden
- Minor copy edits
- Make all "Quick help" link text the entire body
of the link. Prior, it wasn't obvious which part
of each item was an actual link.
Closes #2721
See merge request !1415
-rw-r--r-- | app/helpers/version_check_helper.rb | 2 | ||||
-rw-r--r-- | app/views/help/index.html.haml | 30 | ||||
-rw-r--r-- | spec/views/help/index.html.haml_spec.rb | 41 |
3 files changed, 52 insertions, 21 deletions
diff --git a/app/helpers/version_check_helper.rb b/app/helpers/version_check_helper.rb index f64d730b448..a674564c4ec 100644 --- a/app/helpers/version_check_helper.rb +++ b/app/helpers/version_check_helper.rb @@ -1,6 +1,6 @@ module VersionCheckHelper def version_status_badge - if Rails.env.production? + if Rails.env.production? && current_application_settings.version_check_enabled image_tag VersionCheck.new.url end end diff --git a/app/views/help/index.html.haml b/app/views/help/index.html.haml index ab7ed1b5d95..57bc91ea5a9 100644 --- a/app/views/help/index.html.haml +++ b/app/views/help/index.html.haml @@ -1,14 +1,15 @@ %div %h1 GitLab - %span= Gitlab::VERSION - %small= Gitlab::REVISION - - if current_application_settings.version_check_enabled + Community Edition + - if user_signed_in? + %span= Gitlab::VERSION + %small= Gitlab::REVISION = version_status_badge %p.slead GitLab is open source software to collaborate on code. %br - Manage git repositories with fine grained access controls that keep your code secure. + Manage git repositories with fine-grained access controls that keep your code secure. %br Perform code reviews and enhance collaboration with merge requests. %br @@ -33,19 +34,8 @@ .panel-heading Quick help %ul.well-list - %li - See our website for - = link_to 'getting help', promo_url + '/getting-help/' - %li - Use the - = link_to 'search bar', '#', onclick: 'Shortcuts.focusSearch(event)' - on the top of this page - %li - Use - = link_to 'shortcuts', '#', onclick: 'Shortcuts.showHelp(event)' - %li - Get a support - = link_to 'subscription', 'https://about.gitlab.com/pricing/' - %li - = link_to 'Compare', 'https://about.gitlab.com/features/#compare' - GitLab editions + %li= link_to 'See our website for getting help', promo_url + '/getting-help/' + %li= link_to 'Use the search bar on the top of this page', '#', onclick: 'Shortcuts.focusSearch(event)' + %li= link_to 'Use shortcuts', '#', onclick: 'Shortcuts.showHelp(event)' + %li= link_to 'Get a support subscription', 'https://about.gitlab.com/pricing/' + %li= link_to 'Compare GitLab editions', 'https://about.gitlab.com/features/#compare' diff --git a/spec/views/help/index.html.haml_spec.rb b/spec/views/help/index.html.haml_spec.rb new file mode 100644 index 00000000000..6b07fcfc987 --- /dev/null +++ b/spec/views/help/index.html.haml_spec.rb @@ -0,0 +1,41 @@ +require 'rails_helper' + +describe 'help/index' do + describe 'version information' do + it 'is hidden from guests' do + stub_user(nil) + stub_version('8.0.2', 'abcdefg') + stub_helpers + + render + + expect(rendered).not_to match '8.0.2' + expect(rendered).not_to match 'abcdefg' + end + + it 'is shown to users' do + stub_user + stub_version('8.0.2', 'abcdefg') + stub_helpers + + render + + expect(rendered).to match '8.0.2' + expect(rendered).to match 'abcdefg' + end + end + + def stub_user(user = double) + allow(view).to receive(:user_signed_in?).and_return(user) + end + + def stub_version(version, revision) + stub_const('Gitlab::VERSION', version) + stub_const('Gitlab::REVISION', revision) + end + + def stub_helpers + allow(view).to receive(:markdown).and_return('') + allow(view).to receive(:version_status_badge).and_return('') + end +end |