Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
e09ddc62
Commit
e09ddc62
authored
Jun 13, 2017
by
Robin Bobbitt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Help landing page customizations
parent
5bea82de
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
108 additions
and
14 deletions
+108
-14
app/controllers/admin/application_settings_controller.rb
app/controllers/admin/application_settings_controller.rb
+2
-0
app/helpers/application_helper.rb
app/helpers/application_helper.rb
+4
-0
app/models/application_setting.rb
app/models/application_setting.rb
+12
-2
app/views/admin/application_settings/_form.html.haml
app/views/admin/application_settings/_form.html.haml
+14
-0
app/views/help/index.html.haml
app/views/help/index.html.haml
+11
-9
app/views/help/show.html.haml
app/views/help/show.html.haml
+1
-1
changelogs/unreleased/help-landing-page-customizations.yml
changelogs/unreleased/help-landing-page-customizations.yml
+4
-0
lib/api/entities.rb
lib/api/entities.rb
+3
-0
lib/api/settings.rb
lib/api/settings.rb
+4
-0
spec/features/admin/admin_settings_spec.rb
spec/features/admin/admin_settings_spec.rb
+5
-0
spec/features/help_pages_spec.rb
spec/features/help_pages_spec.rb
+24
-1
spec/helpers/application_helper_spec.rb
spec/helpers/application_helper_spec.rb
+17
-0
spec/requests/api/settings_spec.rb
spec/requests/api/settings_spec.rb
+7
-1
No files found.
app/controllers/admin/application_settings_controller.rb
View file @
e09ddc62
...
...
@@ -100,6 +100,8 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController
:enabled_git_access_protocol
,
:gravatar_enabled
,
:help_page_text
,
:help_page_hide_commercial_content
,
:help_page_support_url
,
:home_page_url
,
:housekeeping_bitmaps_enabled
,
:housekeeping_enabled
,
...
...
app/helpers/application_helper.rb
View file @
e09ddc62
...
...
@@ -204,6 +204,10 @@ module ApplicationHelper
'https://'
+
promo_host
end
def
support_url
current_application_settings
.
help_page_support_url
.
presence
||
promo_url
+
'/getting-help/'
end
def
page_filter_path
(
options
=
{})
without
=
options
.
delete
(
:without
)
add_label
=
options
.
delete
(
:label
)
...
...
app/models/application_setting.rb
View file @
e09ddc62
...
...
@@ -37,7 +37,12 @@ class ApplicationSetting < ActiveRecord::Base
validates
:home_page_url
,
allow_blank:
true
,
url:
true
,
if: :home_page_url_column_exist
if: :home_page_url_column_exists?
validates
:help_page_support_url
,
allow_blank:
true
,
url:
true
,
if: :help_page_support_url_column_exists?
validates
:after_sign_out_path
,
allow_blank:
true
,
...
...
@@ -215,6 +220,7 @@ class ApplicationSetting < ActiveRecord::Base
domain_whitelist:
Settings
.
gitlab
[
'domain_whitelist'
],
gravatar_enabled:
Settings
.
gravatar
[
'enabled'
],
help_page_text:
nil
,
help_page_hide_commercial_content:
false
,
unique_ips_limit_per_user:
10
,
unique_ips_limit_time_window:
3600
,
unique_ips_limit_enabled:
false
,
...
...
@@ -263,10 +269,14 @@ class ApplicationSetting < ActiveRecord::Base
end
end
def
home_page_url_column_exist
def
home_page_url_column_exist
s?
ActiveRecord
::
Base
.
connection
.
column_exists?
(
:application_settings
,
:home_page_url
)
end
def
help_page_support_url_column_exists?
ActiveRecord
::
Base
.
connection
.
column_exists?
(
:application_settings
,
:help_page_support_url
)
end
def
sidekiq_throttling_column_exists?
ActiveRecord
::
Base
.
connection
.
column_exists?
(
:application_settings
,
:sidekiq_throttling_enabled
)
end
...
...
app/views/admin/application_settings/_form.html.haml
View file @
e09ddc62
...
...
@@ -180,11 +180,25 @@
.col-sm-10
=
f
.
text_area
:sign_in_text
,
class:
'form-control'
,
rows:
4
.help-block
Markdown enabled
%fieldset
%legend
Help Page
.form-group
=
f
.
label
:help_page_text
,
class:
'control-label col-sm-2'
.col-sm-10
=
f
.
text_area
:help_page_text
,
class:
'form-control'
,
rows:
4
.help-block
Markdown enabled
.form-group
.col-sm-offset-2.col-sm-10
.checkbox
=
f
.
label
:help_page_hide_commercial_content
do
=
f
.
check_box
:help_page_hide_commercial_content
Hide marketing-related entries from help
.form-group
=
f
.
label
:help_page_support_url
,
'Support page URL'
,
class:
'control-label col-sm-2'
.col-sm-10
=
f
.
text_field
:help_page_support_url
,
class:
'form-control'
,
placeholder:
'http://company.example.com/getting-help'
,
:'aria-describedby'
=>
'support_help_block'
%span
.help-block
#support_help_block
Alternate support URL for help page
%fieldset
%legend
Pages
...
...
app/views/help/index.html.haml
View file @
e09ddc62
%div
-
if
current_application_settings
.
help_page_text
.
present?
=
markdown_field
(
current_application_settings
,
:help_page_text
)
%hr
-
unless
current_application_settings
.
help_page_hide_commercial_content?
%h1
GitLab
Community Edition
...
...
@@ -18,13 +23,9 @@
Used by more than 100,000 organizations, GitLab is the most popular solution to manage git repositories on-premises.
%br
Read more about GitLab at
#{
link_to
promo_host
,
promo_url
,
target:
'_blank'
,
rel:
'noopener noreferrer'
}
.
-
if
current_application_settings
.
help_page_text
.
present?
%hr
=
markdown_field
(
current_application_settings
,
:help_page_text
)
%hr
%hr
.row
.row
.prepend-top-default
.col-md-8
.documentation-index
=
markdown
(
@help_index
)
...
...
@@ -33,8 +34,9 @@
.panel-heading
Quick help
%ul
.well-list
%li
=
link_to
'See our website for getting help'
,
promo_url
+
'/getting-help/'
%li
=
link_to
'See our website for getting help'
,
support_url
%li
=
link_to
'Use the search bar on the top of this page'
,
'#'
,
onclick:
'Shortcuts.focusSearch(event)'
%li
=
link_to
'Use shortcuts'
,
'#'
,
onclick:
'Shortcuts.toggleHelp()'
%li
=
link_to
'Get a support subscription'
,
'https://about.gitlab.com/pricing/'
%li
=
link_to
'Compare GitLab editions'
,
'https://about.gitlab.com/features/#compare'
-
unless
current_application_settings
.
help_page_hide_commercial_content?
%li
=
link_to
'Get a support subscription'
,
'https://about.gitlab.com/pricing/'
%li
=
link_to
'Compare GitLab editions'
,
'https://about.gitlab.com/features/#compare'
app/views/help/show.html.haml
View file @
e09ddc62
-
page_title
@path
.
split
(
"/"
).
reverse
.
map
(
&
:humanize
)
.documentation.wiki
.documentation.wiki
.prepend-top-default
=
markdown
@markdown
changelogs/unreleased/help-landing-page-customizations.yml
0 → 100644
View file @
e09ddc62
---
title
:
Help landing page customizations
merge_request
:
11878
author
:
Robin Bobbitt
lib/api/entities.rb
View file @
e09ddc62
...
...
@@ -603,6 +603,9 @@ module API
expose
:plantuml_url
expose
:terminal_max_session_time
expose
:polling_interval_multiplier
expose
:help_page_hide_commercial_content
expose
:help_page_text
expose
:help_page_support_url
end
class
Release
<
Grape
::
Entity
...
...
lib/api/settings.rb
View file @
e09ddc62
...
...
@@ -39,7 +39,9 @@ module API
:email_author_in_body
,
:enabled_git_access_protocol
,
:gravatar_enabled
,
:help_page_hide_commercial_content
,
:help_page_text
,
:help_page_support_url
,
:home_page_url
,
:housekeeping_enabled
,
:html_emails_enabled
,
...
...
@@ -101,7 +103,9 @@ module API
optional
:home_page_url
,
type:
String
,
desc:
'We will redirect non-logged in users to this page'
optional
:after_sign_out_path
,
type:
String
,
desc:
'We will redirect users to this page after they sign out'
optional
:sign_in_text
,
type:
String
,
desc:
'The sign in text of the GitLab application'
optional
:help_page_hide_commercial_content
,
type:
Boolean
,
desc:
'Hide marketing-related entries from help'
optional
:help_page_text
,
type:
String
,
desc:
'Custom text displayed on the help page'
optional
:help_page_support_url
,
type:
String
,
desc:
'Alternate support URL for help page'
optional
:shared_runners_enabled
,
type:
Boolean
,
desc:
'Enable shared runners for new projects'
given
shared_runners_enabled:
->
(
val
)
{
val
}
do
requires
:shared_runners_text
,
type:
String
,
desc:
'Shared runners text '
...
...
spec/features/admin/admin_settings_spec.rb
View file @
e09ddc62
...
...
@@ -20,10 +20,15 @@ feature 'Admin updates settings', feature: true do
uncheck
'Gravatar enabled'
fill_in
'Home page URL'
,
with:
'https://about.gitlab.com/'
fill_in
'Help page text'
,
with:
'Example text'
check
'Hide marketing-related entries from help'
fill_in
'Support page URL'
,
with:
'http://example.com/help'
click_button
'Save'
expect
(
current_application_settings
.
gravatar_enabled
).
to
be_falsey
expect
(
current_application_settings
.
home_page_url
).
to
eq
"https://about.gitlab.com/"
expect
(
current_application_settings
.
help_page_text
).
to
eq
"Example text"
expect
(
current_application_settings
.
help_page_hide_commercial_content
).
to
be_truthy
expect
(
current_application_settings
.
help_page_support_url
).
to
eq
"http://example.com/help"
expect
(
page
).
to
have_content
"Application settings saved successfully"
end
...
...
spec/features/help_pages_spec.rb
View file @
e09ddc62
...
...
@@ -37,7 +37,7 @@ describe 'Help Pages', feature: true do
context
'in a production environment with version check enabled'
,
:js
do
before
do
allow
(
Rails
.
env
).
to
receive
(
:production?
)
{
true
}
allow
(
current_application_settings
).
to
receive
(
:version_check_enabled
)
{
true
}
allow
_any_instance_of
(
ApplicationSetting
).
to
receive
(
:version_check_enabled
)
{
true
}
allow_any_instance_of
(
VersionCheck
).
to
receive
(
:url
)
{
'/version-check-url'
}
login_as
:user
...
...
@@ -53,4 +53,27 @@ describe 'Help Pages', feature: true do
expect
(
find
(
'.js-version-status-badge'
,
visible:
false
)).
not_to
be_visible
end
end
describe
'when help page is customized'
do
before
do
allow_any_instance_of
(
ApplicationSetting
).
to
receive
(
:help_page_hide_commercial_content?
)
{
true
}
allow_any_instance_of
(
ApplicationSetting
).
to
receive
(
:help_page_text
)
{
"My Custom Text"
}
allow_any_instance_of
(
ApplicationSetting
).
to
receive
(
:help_page_support_url
)
{
"http://example.com/help"
}
login_as
:user
visit
help_path
end
it
'should display custom help page text'
do
expect
(
page
).
to
have_text
"My Custom Text"
end
it
'should hide marketing content when enabled'
do
expect
(
page
).
not_to
have_link
"Get a support subscription"
end
it
'should use a custom support url'
do
expect
(
page
).
to
have_link
"See our website for getting help"
,
href:
"http://example.com/help"
end
end
end
spec/helpers/application_helper_spec.rb
View file @
e09ddc62
...
...
@@ -257,4 +257,21 @@ describe ApplicationHelper do
it
{
expect
(
helper
.
active_when
(
true
)).
to
eq
(
'active'
)
}
it
{
expect
(
helper
.
active_when
(
false
)).
to
eq
(
nil
)
}
end
describe
'#support_url'
do
context
'when alternate support url is specified'
do
let
(
:alternate_url
)
{
'http://company.example.com/getting-help'
}
before
{
allow
(
current_application_settings
).
to
receive
(
:help_page_support_url
)
{
alternate_url
}
}
it
'returns the alternate support url'
do
expect
(
helper
.
support_url
).
to
eq
(
alternate_url
)
end
end
context
'when alternate support url is not specified'
do
it
'builds the support url from the promo_url'
do
expect
(
helper
.
support_url
).
to
eq
(
helper
.
promo_url
+
'/getting-help/'
)
end
end
end
end
spec/requests/api/settings_spec.rb
View file @
e09ddc62
...
...
@@ -40,7 +40,10 @@ describe API::Settings, 'Settings' do
plantuml_url:
'http://plantuml.example.com'
,
default_snippet_visibility:
'internal'
,
restricted_visibility_levels:
[
'public'
],
default_artifacts_expire_in:
'2 days'
default_artifacts_expire_in:
'2 days'
,
help_page_text:
'custom help text'
,
help_page_hide_commercial_content:
true
,
help_page_support_url:
'http://example.com/help'
expect
(
response
).
to
have_http_status
(
200
)
expect
(
json_response
[
'default_projects_limit'
]).
to
eq
(
3
)
expect
(
json_response
[
'signin_enabled'
]).
to
be_falsey
...
...
@@ -53,6 +56,9 @@ describe API::Settings, 'Settings' do
expect
(
json_response
[
'default_snippet_visibility'
]).
to
eq
(
'internal'
)
expect
(
json_response
[
'restricted_visibility_levels'
]).
to
eq
([
'public'
])
expect
(
json_response
[
'default_artifacts_expire_in'
]).
to
eq
(
'2 days'
)
expect
(
json_response
[
'help_page_text'
]).
to
eq
(
'custom help text'
)
expect
(
json_response
[
'help_page_hide_commercial_content'
]).
to
be_truthy
expect
(
json_response
[
'help_page_support_url'
]).
to
eq
(
'http://example.com/help'
)
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment