BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
6bdfeff6
Commit
6bdfeff6
authored
Jun 14, 2017
by
Douwe Maan
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'help-landing-page-customizations' into 'master'
Allow more customization to Help landing page See merge request !11878
parents
5771b946
e09ddc62
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
129 additions
and
14 deletions
+129
-14
application_settings_controller.rb
app/controllers/admin/application_settings_controller.rb
+2
-0
application_helper.rb
app/helpers/application_helper.rb
+4
-0
application_setting.rb
app/models/application_setting.rb
+12
-2
_form.html.haml
app/views/admin/application_settings/_form.html.haml
+14
-0
index.html.haml
app/views/help/index.html.haml
+11
-9
show.html.haml
app/views/help/show.html.haml
+1
-1
help-landing-page-customizations.yml
changelogs/unreleased/help-landing-page-customizations.yml
+4
-0
20170602154736_add_help_page_hide_commercial_content_to_application_settings.rb
...p_page_hide_commercial_content_to_application_settings.rb
+9
-0
20170602154813_add_help_page_support_url_to_application_settings.rb
...4813_add_help_page_support_url_to_application_settings.rb
+9
-0
schema.rb
db/schema.rb
+3
-0
entities.rb
lib/api/entities.rb
+3
-0
settings.rb
lib/api/settings.rb
+4
-0
admin_settings_spec.rb
spec/features/admin/admin_settings_spec.rb
+5
-0
help_pages_spec.rb
spec/features/help_pages_spec.rb
+24
-1
application_helper_spec.rb
spec/helpers/application_helper_spec.rb
+17
-0
settings_spec.rb
spec/requests/api/settings_spec.rb
+7
-1
No files found.
app/controllers/admin/application_settings_controller.rb
View file @
6bdfeff6
...
...
@@ -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 @
6bdfeff6
...
...
@@ -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 @
6bdfeff6
...
...
@@ -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 @
6bdfeff6
...
...
@@ -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 @
6bdfeff6
%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 @
6bdfeff6
-
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 @
6bdfeff6
---
title
:
Help landing page customizations
merge_request
:
11878
author
:
Robin Bobbitt
db/migrate/20170602154736_add_help_page_hide_commercial_content_to_application_settings.rb
0 → 100644
View file @
6bdfeff6
class
AddHelpPageHideCommercialContentToApplicationSettings
<
ActiveRecord
::
Migration
include
Gitlab
::
Database
::
MigrationHelpers
DOWNTIME
=
false
def
change
add_column
:application_settings
,
:help_page_hide_commercial_content
,
:boolean
,
default:
false
end
end
db/migrate/20170602154813_add_help_page_support_url_to_application_settings.rb
0 → 100644
View file @
6bdfeff6
class
AddHelpPageSupportUrlToApplicationSettings
<
ActiveRecord
::
Migration
include
Gitlab
::
Database
::
MigrationHelpers
DOWNTIME
=
false
def
change
add_column
:application_settings
,
:help_page_support_url
,
:string
end
end
db/schema.rb
View file @
6bdfeff6
...
...
@@ -12,6 +12,7 @@
# It's strongly recommended that you check this file into your version control system.
ActiveRecord
::
Schema
.
define
(
version:
20170606202615
)
do
# These are extensions that must be enabled in order to support this database
enable_extension
"plpgsql"
enable_extension
"pg_trgm"
...
...
@@ -123,6 +124,8 @@ ActiveRecord::Schema.define(version: 20170606202615) do
t
.
boolean
"clientside_sentry_enabled"
,
default:
false
,
null:
false
t
.
string
"clientside_sentry_dsn"
t
.
boolean
"prometheus_metrics_enabled"
,
default:
false
,
null:
false
t
.
boolean
"help_page_hide_commercial_content"
,
default:
false
t
.
string
"help_page_support_url"
end
create_table
"audit_events"
,
force: :cascade
do
|
t
|
...
...
lib/api/entities.rb
View file @
6bdfeff6
...
...
@@ -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 @
6bdfeff6
...
...
@@ -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 @
6bdfeff6
...
...
@@ -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 @
6bdfeff6
...
...
@@ -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 @
6bdfeff6
...
...
@@ -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 @
6bdfeff6
...
...
@@ -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