Add support page link in help menu

Creates a new item in help dropdown to show configured support page link
This commit is contained in:
Diego Louzán 2019-07-30 17:03:17 +00:00 committed by Paul Slaughter
parent 9ba87676c8
commit e20538088b
7 changed files with 46 additions and 6 deletions

View file

@ -16,6 +16,6 @@
.form-group .form-group
= f.label :help_page_support_url, _('Support page URL'), class: 'label-bold' = f.label :help_page_support_url, _('Support page URL'), class: 'label-bold'
= f.text_field :help_page_support_url, class: 'form-control', placeholder: 'http://company.example.com/getting-help', :'aria-describedby' => 'support_help_block' = f.text_field :help_page_support_url, class: 'form-control', placeholder: 'http://company.example.com/getting-help', :'aria-describedby' => 'support_help_block'
%span.form-text.text-muted#support_help_block= _('Alternate support URL for help page') %span.form-text.text-muted#support_help_block= _('Alternate support URL for help page and help dropdown')
= f.submit _('Save changes'), class: "btn btn-success" = f.submit _('Save changes'), class: "btn btn-success"

View file

@ -2,6 +2,8 @@
- if current_user_menu?(:help) - if current_user_menu?(:help)
%li %li
= link_to _("Help"), help_path = link_to _("Help"), help_path
%li
= link_to _("Support"), support_url
= render_if_exists "shared/learn_gitlab_menu_item" = render_if_exists "shared/learn_gitlab_menu_item"
%li.divider %li.divider
%li %li

View file

@ -0,0 +1,5 @@
---
title: Add admin-configurable "Support page URL" link to top Help dropdown menu
merge_request: 30459
author: Diego Louzán
type: added

View file

@ -230,7 +230,7 @@ are listed in the descriptions of the relevant settings.
| `gravatar_enabled` | boolean | no | Enable Gravatar. | | `gravatar_enabled` | boolean | no | Enable Gravatar. |
| `hashed_storage_enabled` | boolean | no | Create new projects using hashed storage paths: Enable immutable, hash-based paths and repository names to store repositories on disk. This prevents repositories from having to be moved or renamed when the Project URL changes and may improve disk I/O performance. (EXPERIMENTAL) | | `hashed_storage_enabled` | boolean | no | Create new projects using hashed storage paths: Enable immutable, hash-based paths and repository names to store repositories on disk. This prevents repositories from having to be moved or renamed when the Project URL changes and may improve disk I/O performance. (EXPERIMENTAL) |
| `help_page_hide_commercial_content` | boolean | no | Hide marketing-related entries from help. | | `help_page_hide_commercial_content` | boolean | no | Hide marketing-related entries from help. |
| `help_page_support_url` | string | no | Alternate support URL for help page. | | `help_page_support_url` | string | no | Alternate support URL for help page and help dropdown. |
| `help_page_text` | string | no | Custom text displayed on the help page. | | `help_page_text` | string | no | Custom text displayed on the help page. |
| `help_text` | string | no | **(PREMIUM)** GitLab server administrator information | | `help_text` | string | no | **(PREMIUM)** GitLab server administrator information |
| `hide_third_party_offers` | boolean | no | Do not display offers from third parties within GitLab. | | `hide_third_party_offers` | boolean | no | Do not display offers from third parties within GitLab. |

View file

@ -59,7 +59,7 @@ module API
optional :grafana_url, type: String, desc: 'Grafana URL' optional :grafana_url, type: String, desc: 'Grafana URL'
optional :gravatar_enabled, type: Boolean, desc: 'Flag indicating if the Gravatar service is enabled' optional :gravatar_enabled, type: Boolean, desc: 'Flag indicating if the Gravatar service is enabled'
optional :help_page_hide_commercial_content, type: Boolean, desc: 'Hide marketing-related entries from help' optional :help_page_hide_commercial_content, type: Boolean, desc: 'Hide marketing-related entries from help'
optional :help_page_support_url, type: String, desc: 'Alternate support URL for help page' optional :help_page_support_url, type: String, desc: 'Alternate support URL for help page and help dropdown'
optional :help_page_text, type: String, desc: 'Custom text displayed on the help page' optional :help_page_text, type: String, desc: 'Custom text displayed on the help page'
optional :home_page_url, type: String, desc: 'We will redirect non-logged in users to this page' optional :home_page_url, type: String, desc: 'We will redirect non-logged in users to this page'
optional :housekeeping_enabled, type: Boolean, desc: 'Enable automatic repository housekeeping (git repack, git gc)' optional :housekeeping_enabled, type: Boolean, desc: 'Enable automatic repository housekeeping (git repack, git gc)'

View file

@ -966,7 +966,7 @@ msgstr ""
msgid "Allows you to add and manage Kubernetes clusters." msgid "Allows you to add and manage Kubernetes clusters."
msgstr "" msgstr ""
msgid "Alternate support URL for help page" msgid "Alternate support URL for help page and help dropdown"
msgstr "" msgstr ""
msgid "Alternatively, you can use a %{personal_access_token_link}. When you create your Personal Access Token, you will need to select the <code>repo</code> scope, so we can display a list of your public and private repositories which are available to import." msgid "Alternatively, you can use a %{personal_access_token_link}. When you create your Personal Access Token, you will need to select the <code>repo</code> scope, so we can display a list of your public and private repositories which are available to import."
@ -10586,6 +10586,9 @@ msgstr ""
msgid "Sunday" msgid "Sunday"
msgstr "" msgstr ""
msgid "Support"
msgstr ""
msgid "Support for custom certificates is disabled. Ask your system's administrator to enable it." msgid "Support for custom certificates is disabled. Ask your system's administrator to enable it."
msgstr "" msgstr ""

View file

@ -356,16 +356,18 @@ describe 'Admin updates settings' do
end end
it 'Change Help page' do it 'Change Help page' do
new_support_url = 'http://example.com/help'
page.within('.as-help-page') do page.within('.as-help-page') do
fill_in 'Help page text', with: 'Example text' fill_in 'Help page text', with: 'Example text'
check 'Hide marketing-related entries from help' check 'Hide marketing-related entries from help'
fill_in 'Support page URL', with: 'http://example.com/help' fill_in 'Support page URL', with: new_support_url
click_button 'Save changes' click_button 'Save changes'
end end
expect(current_settings.help_page_text).to eq "Example text" expect(current_settings.help_page_text).to eq "Example text"
expect(current_settings.help_page_hide_commercial_content).to be_truthy expect(current_settings.help_page_hide_commercial_content).to be_truthy
expect(current_settings.help_page_support_url).to eq "http://example.com/help" expect(current_settings.help_page_support_url).to eq new_support_url
expect(page).to have_content "Application settings saved successfully" expect(page).to have_content "Application settings saved successfully"
end end
@ -415,6 +417,34 @@ describe 'Admin updates settings' do
end end
end end
context 'Nav bar' do
it 'Shows default help links in nav' do
default_support_url = 'https://about.gitlab.com/getting-help/'
visit root_dashboard_path
find('.header-help-dropdown-toggle').click
page.within '.header-help' do
expect(page).to have_link(text: 'Help', href: help_path)
expect(page).to have_link(text: 'Support', href: default_support_url)
end
end
it 'Shows custom support url in nav when set' do
new_support_url = 'http://example.com/help'
stub_application_setting(help_page_support_url: new_support_url)
visit root_dashboard_path
find('.header-help-dropdown-toggle').click
page.within '.header-help' do
expect(page).to have_link(text: 'Support', href: new_support_url)
end
end
end
def check_all_events def check_all_events
page.check('Active') page.check('Active')
page.check('Push') page.check('Push')