Skip to content
Snippets Groups Projects
Unverified Commit 3358afa7 authored by Connor Shea's avatar Connor Shea
Browse files

Update the help_page_path route to accept paths directly instead of using parameters.

parent 61f0e894
No related branches found
No related tags found
No related merge requests found
Showing
with 34 additions and 36 deletions
Loading
Loading
@@ -12,13 +12,12 @@ class HelpController < ApplicationController
end
 
def show
@category = clean_path_info(path_params[:category])
@file = path_params[:file]
@path = path_params[:path]
 
respond_to do |format|
format.any(:markdown, :md, :html) do
# Note: We are purposefully NOT using `Rails.root.join`
path = File.join(Rails.root, 'doc', @category, "#{@file}.md")
path = File.join(Rails.root, 'doc', "#{@path}.md")
 
if File.exist?(path)
@markdown = File.read(path)
Loading
Loading
@@ -33,7 +32,7 @@ class HelpController < ApplicationController
# Allow access to images in the doc folder
format.any(:png, :gif, :jpeg) do
# Note: We are purposefully NOT using `Rails.root.join`
path = File.join(Rails.root, 'doc', @category, "#{@file}.#{params[:format]}")
path = File.join(Rails.root, 'doc', "#{@path}.#{params[:format]}")
 
if File.exist?(path)
send_file(path, disposition: 'inline')
Loading
Loading
@@ -57,8 +56,7 @@ class HelpController < ApplicationController
private
 
def path_params
params.require(:category)
params.require(:file)
params.require(:path)
 
params
end
Loading
Loading
Loading
Loading
@@ -43,15 +43,15 @@ module SearchHelper
# Autocomplete results for internal help pages
def help_autocomplete
[
{ category: "Help", label: "API Help", url: help_page_path("api", "README") },
{ category: "Help", label: "Markdown Help", url: help_page_path("markdown", "markdown") },
{ category: "Help", label: "Permissions Help", url: help_page_path("permissions", "permissions") },
{ category: "Help", label: "Public Access Help", url: help_page_path("public_access", "public_access") },
{ category: "Help", label: "Rake Tasks Help", url: help_page_path("raketasks", "README") },
{ category: "Help", label: "SSH Keys Help", url: help_page_path("ssh", "README") },
{ category: "Help", label: "System Hooks Help", url: help_page_path("system_hooks", "system_hooks") },
{ category: "Help", label: "Webhooks Help", url: help_page_path("web_hooks", "web_hooks") },
{ category: "Help", label: "Workflow Help", url: help_page_path("workflow", "README") },
{ category: "Help", label: "API Help", url: help_page_path("api/README") },
{ category: "Help", label: "Markdown Help", url: help_page_path("markdown/markdown") },
{ category: "Help", label: "Permissions Help", url: help_page_path("permissions/permissions") },
{ category: "Help", label: "Public Access Help", url: help_page_path("public_access/public_access") },
{ category: "Help", label: "Rake Tasks Help", url: help_page_path("raketasks/README") },
{ category: "Help", label: "SSH Keys Help", url: help_page_path("ssh/README") },
{ category: "Help", label: "System Hooks Help", url: help_page_path("system_hooks/system_hooks") },
{ category: "Help", label: "Webhooks Help", url: help_page_path("web_hooks/web_hooks") },
{ category: "Help", label: "Workflow Help", url: help_page_path("workflow/README") },
]
end
 
Loading
Loading
Loading
Loading
@@ -13,7 +13,7 @@
.col-sm-10
= f.text_area :description, class: "form-control", rows: 10
.hint
Description parsed with #{link_to "GitLab Flavored Markdown", help_page_path('markdown', 'markdown'), target: '_blank'}.
Description parsed with #{link_to "GitLab Flavored Markdown", help_page_path('markdown/markdown'), target: '_blank'}.
.form-group
= f.label :logo, class: 'control-label'
.col-sm-10
Loading
Loading
Loading
Loading
@@ -38,11 +38,11 @@
= source
%span.help-block#import-sources-help
Enabled sources for code import during project creation. OmniAuth must be configured for GitHub
= link_to "(?)", help_page_path("integration", "github")
= link_to "(?)", help_page_path("integration/github")
, Bitbucket
= link_to "(?)", help_page_path("integration", "bitbucket")
= link_to "(?)", help_page_path("integration/bitbucket")
and GitLab.com
= link_to "(?)", help_page_path("integration", "gitlab")
= link_to "(?)", help_page_path("integration/gitlab")
.form-group
%label.control-label.col-sm-2 Enabled Git access protocols
.col-sm-10
Loading
Loading
Loading
Loading
@@ -14,7 +14,7 @@
.col-sm-10
%p.light
Paste a machine public key here. Read more about how to generate it
= link_to "here", help_page_path("ssh", "README")
= link_to "here", help_page_path("ssh/README")
= f.text_area :key, class: "form-control thin_area", rows: 5
 
.form-actions
Loading
Loading
Loading
Loading
@@ -79,7 +79,7 @@
.panel-body.form-holder
%p.light
Read more about project permissions
%strong= link_to "here", help_page_path("permissions", "permissions"), class: "vlink"
%strong= link_to "here", help_page_path("permissions/permissions"), class: "vlink"
 
= form_tag members_update_admin_group_path(@group), id: "new_project_member", class: "bulk_import", method: :put do
%div
Loading
Loading
Loading
Loading
@@ -3,7 +3,7 @@
System hooks
 
%p.light
#{link_to "System hooks ", help_page_path("system_hooks", "system_hooks"), class: "vlink"} can be
#{link_to "System hooks ", help_page_path("system_hooks/system_hooks"), class: "vlink"} can be
used for binding events when GitLab creates a User or Project.
 
%hr
Loading
Loading
Loading
Loading
@@ -132,7 +132,7 @@
- else
passed.
 
= link_to icon('question-circle'), help_page_path('administration', 'repository_checks')
= link_to icon('question-circle'), help_page_path('administration/repository_checks')
 
.form-group
= f.submit 'Trigger repository check', class: 'btn btn-primary'
Loading
Loading
Loading
Loading
@@ -3,4 +3,4 @@
%h3 Access Denied
%hr
%p You are not allowed to access this page.
%p Read more about project permissions #{link_to "here", help_page_path("permissions", "permissions"), class: "vlink"}
%p Read more about project permissions #{link_to "here", help_page_path("permissions/permissions"), class: "vlink"}
Loading
Loading
@@ -12,7 +12,7 @@
= select_tag :access_level, options_for_select(GroupMember.access_level_roles, @group_member.access_level), class: "project-access-select select2"
.help-block
Read more about role permissions
%strong= link_to "here", help_page_path("permissions", "permissions"), class: "vlink"
%strong= link_to "here", help_page_path("permissions/permissions"), class: "vlink"
 
.form-actions
= f.submit 'Add users to group', class: "btn btn-create"
- page_title @file.humanize, *@category.split("/").reverse.map(&:humanize)
- page_title @path.split("/").reverse.map(&:humanize)
.documentation.wiki
= markdown @markdown.gsub('$your_email', current_user.try(:email) || "email@example.com")
Loading
Loading
@@ -549,4 +549,4 @@
%li wiki page
%li help page
 
You can check how markdown rendered at #{link_to 'Markdown help page', help_page_path("markdown", "markdown")}.
You can check how markdown rendered at #{link_to 'Markdown help page', help_page_path("markdown/markdown")}.
Loading
Loading
@@ -38,6 +38,6 @@
As an administrator you may like to configure
- else
Consider asking your GitLab administrator to configure
= link_to 'GitHub integration', help_page_path("integration", "github")
= link_to 'GitHub integration', help_page_path("integration/github")
which will allow login via GitHub and allow importing projects without
generating a Personal Access Token.
Loading
Loading
@@ -11,7 +11,7 @@
Add an SSH key
%p.profile-settings-content
Before you can add an SSH key you need to
= link_to "generate it.", help_page_path("ssh", "README")
= link_to "generate it.", help_page_path("ssh/README")
= render 'form'
%hr
%h5
Loading
Loading
Loading
Loading
@@ -43,12 +43,12 @@
.form-group
= f.label :dashboard, class: 'label-light' do
Default Dashboard
= link_to('(?)', help_page_path('profile', 'preferences') + '#default-dashboard', target: '_blank')
= link_to('(?)', help_page_path('profile/preferences') + '#default-dashboard', target: '_blank')
= f.select :dashboard, dashboard_choices, {}, class: 'form-control'
.form-group
= f.label :project_view, class: 'label-light' do
Project view
= link_to('(?)', help_page_path('profile', 'preferences') + '#default-project-view', target: '_blank')
= link_to('(?)', help_page_path('profile/preferences') + '#default-project-view', target: '_blank')
= f.select :project_view, project_view_choices, {}, class: 'form-control'
.help-block
Choose what content you want to see on a project's home page.
Loading
Loading
Loading
Loading
@@ -14,7 +14,7 @@
- else
%p
Download the Google Authenticator application from App Store or Google Play Store and scan this code.
More information is available in the #{link_to('documentation', help_page_path('profile', 'two_factor_authentication'))}.
More information is available in the #{link_to('documentation', help_page_path('profile/two_factor_authentication'))}.
.row.append-bottom-10
.col-md-3
= raw @qr_code
Loading
Loading
Loading
Loading
@@ -10,4 +10,4 @@
as administrator you need to configure
- else
ask your GitLab administrator to configure
== #{link_to 'OAuth integration', help_page_path("integration", "bitbucket")}.
== #{link_to 'OAuth integration', help_page_path("integration/bitbucket")}.
Loading
Loading
@@ -4,7 +4,7 @@
- unless @repository.gitlab_ci_yml
.form-group
%p Builds need to be configured before you can begin using Continuous Integration.
= link_to 'Get started with Builds', help_page_path('ci', 'quick_start', 'README'), class: 'btn btn-info'
= link_to 'Get started with Builds', help_page_path('ci/quick_start/README'), class: 'btn btn-info'
.form-group
%p Get recent application code using the following command:
.radio
Loading
Loading
Loading
Loading
@@ -10,4 +10,4 @@
as administrator you need to configure
- else
ask your GitLab administrator to configure
== #{link_to 'OAuth integration', help_page_path("integration", "gitlab")}.
== #{link_to 'OAuth integration', help_page_path("integration/gitlab")}.
Loading
Loading
@@ -8,4 +8,4 @@
%strong Only allow merge requests to be merged if the build succeeds
.help-block
Builds need to be configured to enable this feature.
= link_to icon('question-circle'), help_page_path('workflow', 'merge_requests', anchor: 'only-allow-merge-requests-to-be-merged-if-the-build-succeeds')
= link_to icon('question-circle'), help_page_path('workflow/merge_requests', anchor: 'only-allow-merge-requests-to-be-merged-if-the-build-succeeds')
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment