Commit 0e4bc4e6deafe90fc1632f9abbfb20c8206ea444

Authored by Dmitriy Zaporozhets
2 parents 749d198f 17a696a9

Merge branch 'link-doc-help' into 'master'

Readme on the help page

Adds the readme from the docs to the help page instead of the current links.

Fixes #1117
app/assets/stylesheets/application.scss
... ... @@ -34,6 +34,7 @@
34 34 /**
35 35 * Page specific styles (issues, projects etc):
36 36 */
  37 +
37 38 @import "sections/*";
38 39  
39 40 /**
... ...
app/assets/stylesheets/sections/help.scss 0 → 100644
... ... @@ -0,0 +1,11 @@
  1 +.documentation {
  2 + padding-bottom: 10px;
  3 + p {
  4 + padding: 10px;
  5 + margin: 0;
  6 + }
  7 + li {
  8 + list-style-type: none;
  9 + padding-left: 10px;
  10 + }
  11 +}
... ...
app/controllers/help_controller.rb
... ... @@ -13,6 +13,17 @@ class HelpController < ApplicationController
13 13 end
14 14 end
15 15  
  16 + def show
  17 + @category = params[:category]
  18 + @file = params[:file]
  19 +
  20 + if File.exists?(Rails.root.join('doc', @category, @file + '.md'))
  21 + render 'show'
  22 + else
  23 + not_found!
  24 + end
  25 + end
  26 +
16 27 def shortcuts
17 28 end
18 29 end
... ...
app/helpers/search_helper.rb
... ... @@ -33,15 +33,15 @@ module SearchHelper
33 33 # Autocomplete results for internal help pages
34 34 def help_autocomplete
35 35 [
36   - { label: "help: API Help", url: help_api_path },
37   - { label: "help: Markdown Help", url: help_markdown_path },
38   - { label: "help: Permissions Help", url: help_permissions_path },
39   - { label: "help: Public Access Help", url: help_public_access_path },
40   - { label: "help: Rake Tasks Help", url: help_raketasks_path },
41   - { label: "help: SSH Keys Help", url: help_ssh_path },
42   - { label: "help: System Hooks Help", url: help_system_hooks_path },
43   - { label: "help: Web Hooks Help", url: help_web_hooks_path },
44   - { label: "help: Workflow Help", url: help_workflow_path },
  36 + { label: "help: API Help", url: help_page_path("api", "README") },
  37 + { label: "help: Markdown Help", url: help_page_path("markdown", "markdown") },
  38 + { label: "help: Permissions Help", url: help_page_path("permissions", "permissions") },
  39 + { label: "help: Public Access Help", url: help_page_path("public_access", "public_access") },
  40 + { label: "help: Rake Tasks Help", url: help_page_path("raketasks", "README") },
  41 + { label: "help: SSH Keys Help", url: help_page_path("ssh", "README") },
  42 + { label: "help: System Hooks Help", url: help_page_path("system_hooks", "system_hooks") },
  43 + { label: "help: Web Hooks Help", url: help_page_path("web_hooks", "web_hooks") },
  44 + { label: "help: Workflow Help", url: help_page_path("workflow", "README") },
45 45 ]
46 46 end
47 47  
... ...
app/views/admin/groups/show.html.haml
... ... @@ -51,7 +51,7 @@
51 51 .body.form-holder
52 52 %p.light
53 53 Read more about project permissions
54   - %strong= link_to "here", help_permissions_path, class: "vlink"
  54 + %strong= link_to "here", help_page_path("permissions", "permissions"), class: "vlink"
55 55  
56 56 = form_tag project_teams_update_admin_group_path(@group), id: "new_team_member", class: "bulk_import", method: :put do
57 57 %div
... ...
app/views/admin/hooks/index.html.haml
... ... @@ -2,7 +2,7 @@
2 2 System hooks
3 3  
4 4 %p.light
5   - #{link_to "System hooks ", help_system_hooks_path, class: "vlink"} can be
  5 + #{link_to "System hooks ", help_page_path("system_hooks", "system_hooks"), class: "vlink"} can be
6 6 used for binding events when GitLab creates a User or Project.
7 7  
8 8 %hr
... ...
app/views/errors/access_denied.html.haml
... ... @@ -2,4 +2,4 @@
2 2 %h3.page-title Access Denied
3 3 %hr
4 4 %p You are not allowed to access this page.
5   -%p Read more about project permissions #{link_to "here", help_permissions_path, class: "vlink"}
  5 +%p Read more about project permissions #{link_to "here", help_page_path("permissions", "permissions"), class: "vlink"}
... ...
app/views/groups/members.html.haml
... ... @@ -5,7 +5,7 @@
5 5 %p.light
6 6 Members of group have access to all group projects.
7 7 Read more about permissions
8   - %strong= link_to "here", help_permissions_path, class: "vlink"
  8 + %strong= link_to "here", help_page_path("permissions", "permissions"), class: "vlink"
9 9  
10 10 %hr
11 11  
... ...
app/views/help/_layout.html.haml
1 1 .row
2 2 .col-md-3
3 3 %h3.page-title Help
4   - %ul.nav.nav-pills.nav-stacked
5   - - links = {:"Workflow" => help_workflow_path, :"SSH Keys" => help_ssh_path, :"GitLab Markdown" => help_markdown_path, :"Permissions" => help_permissions_path, :"API" => help_api_path, :"Web Hooks" => help_web_hooks_path, :"Rake Tasks" => help_raketasks_path, :"System Hooks" => help_system_hooks_path, :"Public Access" => help_public_access_path, :"Security" => help_security_path}
6   - - links.each do |title,path|
7   - %li{class: current_page?(path) ? 'active' : nil}
8   - = link_to title, path
9   -
10 4 .col-md-9
11 5 .wiki
12 6 = yield
... ...
app/views/help/index.html.haml
... ... @@ -33,53 +33,12 @@
33 33 Use
34 34 = link_to "shortcuts", '#', onclick: "new Shortcuts()"
35 35  
36   - .col-md-4
37   - .ui-box
38   - .title
39   - User documentation
40   - %ul.well-list
41   - %li
42   - %strong= link_to "Workflow", help_workflow_path
43   - %p Learn how to use Git and GitLab together.
44   -
45   - %li
46   - %strong= link_to "SSH keys", help_ssh_path
47   - %p Setup secure access to your projects.
48   -
49   - %li
50   - %strong= link_to "GitLab Markdown", help_markdown_path
51   - %p Learn what you can do with GitLab's advanced formatting system.
52   -
53   - %li
54   - %strong= link_to "Permissions", help_permissions_path
55   - %p Get familiar with GitLab's permission levels.
56   -
57   - %li
58   - %strong= link_to "API", help_api_file_path(category: 'README')
59   - %p Explore how you can access GitLab via a simple and powerful API.
60   -
61   - %li
62   - %strong= link_to "Web Hooks", help_web_hooks_path
63   - %p Let GitLab notify you when new code has been pushed to your project.
64   -
65   - .col-md-4
66   - .ui-box
67   - .title
68   - Admin documentation
69   - %ul.well-list
70   -
71   - %li
72   - %strong= link_to "Rake Tasks", help_raketasks_path
73   - %p Explore what GitLab has in store for you to make administration easier.
74   -
75   - %li
76   - %strong= link_to "System Hooks", help_system_hooks_path
77   - %p Let GitLab notify you when certain management tasks need to be carried out.
78   -
79   - %li
80   - %strong= link_to "Public Access", help_public_access_path
81   - %p Learn how you can allow public access to a project.
82   -
83   - %li
84   - %strong= link_to "Security", help_security_path
85   - %p Learn what you can do to secure your GitLab instance.
  36 + .col-md-8
  37 + .ui-box.documentation
  38 + .title Documentation
  39 +
  40 + = preserve do
  41 + - readme_text = File.read(Rails.root.join("doc", "README.md"))
  42 + - text = readme_text.dup
  43 + - readme_text.scan(/\]\(([^(]+)\)/) { |match| text.gsub!(match.first, "help/#{match.first}") }
  44 + = markdown text
... ...
app/views/help/show.html.haml 0 → 100644
... ... @@ -0,0 +1,3 @@
  1 +.col-md-12
  2 + .documentation
  3 + = markdown File.read(Rails.root.join('doc', @category, @file + '.md'))
... ...
app/views/profiles/keys/index.html.haml
... ... @@ -6,7 +6,7 @@
6 6 SSH keys allow you to establish a secure connection between your computer and GitLab
7 7 %br
8 8 Before you can add an SSH key you need to
9   - = link_to "generate it", help_ssh_path
  9 + = link_to "generate it", help_page_path("ssh", "README")
10 10 %hr
11 11  
12 12  
... ...
app/views/profiles/keys/new.html.haml
1 1 %h3.page-title Add an SSH Key
2 2 %p.light
3   - Paste your public key here. Read more about how to generate a key on #{link_to "the SSH help page", help_ssh_path}.
  3 + Paste your public key here. Read more about how to generate a key on #{link_to "the SSH help page", help_page_path("ssh", "README")}.
4 4 %hr
5 5 = render 'form'
6 6  
... ...
app/views/projects/_visibility_level.html.haml
1 1 .form-group.project-visibility-level-holder
2 2 = f.label :visibility_level, class: 'control-label' do
3 3 Visibility Level
4   - = link_to "(?)", help_public_access_path
  4 + = link_to "(?)", help_page_path("public_access", "public_access")
5 5 .col-sm-10
6 6 - if can_change_visibility_level
7 7 - Gitlab::VisibilityLevel.values.each do |level|
... ...
app/views/projects/deploy_keys/_form.html.haml
... ... @@ -14,7 +14,7 @@
14 14 .col-sm-10
15 15 %p.light
16 16 Paste a machine public key here. Read more about how to generate it
17   - = link_to "here", help_ssh_path
  17 + = link_to "here", help_page_path("ssh", "README")
18 18 = f.text_area :key, class: "form-control thin_area", rows: 5
19 19  
20 20 .form-actions
... ...
app/views/projects/hooks/index.html.haml
... ... @@ -2,7 +2,7 @@
2 2 Web hooks
3 3  
4 4 %p.light
5   - #{link_to "Web hooks ", help_web_hooks_path, class: "vlink"} can be
  5 + #{link_to "Web hooks ", help_page_path("web_hooks", "web_hooks"), class: "vlink"} can be
6 6 used for binding events when something is happening within the project.
7 7  
8 8 %hr.clearfix
... ...
app/views/projects/issues/_form.html.haml
... ... @@ -22,7 +22,7 @@
22 22 .col-sm-10
23 23 = f.text_area :description, class: 'form-control js-gfm-input markdown-area', rows: 14
24 24 .col-sm-12.hint
25   - .pull-left Issues are parsed with #{link_to "GitLab Flavored Markdown", help_markdown_path, target: '_blank'}.
  25 + .pull-left Issues are parsed with #{link_to "GitLab Flavored Markdown", help_page_path("markdown", "markdown"), target: '_blank'}.
26 26 .pull-right Attach images (JPG, PNG, GIF) by dragging & dropping, #{link_to "selecting them", '#', class: 'markdown-selector' } or pasting from the clipboard.
27 27 .clearfix
28 28 .error-alert
... ...
app/views/projects/merge_requests/_form.html.haml
... ... @@ -24,9 +24,8 @@
24 24 .col-sm-10
25 25 = f.text_area :description, class: "form-control js-gfm-input markdown-area", rows: 14
26 26 .col-sm-12.hint
27   - .pull-left Description is parsed with #{link_to "GitLab Flavored Markdown", help_markdown_path, target: '_blank'}.
  27 + .pull-left Description is parsed with #{link_to "GitLab Flavored Markdown", help_page_path("markdown", "markdown"), target: '_blank'}.
28 28 .pull-right Attach images (JPG, PNG, GIF) by dragging & dropping, #{link_to "selecting them", '#', class: 'markdown-selector' } or pasting from the clipboard.
29   -
30 29 .clearfix
31 30 .error-alert
32 31 %hr
... ...
app/views/projects/merge_requests/_new_submit.html.haml
... ... @@ -25,9 +25,8 @@
25 25 = f.label :description, "Description"
26 26 = f.text_area :description, class: "form-control js-gfm-input markdown-area", rows: 10
27 27 .col-sm-12.hint
28   - .pull-left Description is parsed with #{link_to "GitLab Flavored Markdown", help_markdown_path, target: '_blank'}.
  28 + .pull-left Description is parsed with #{link_to "GitLab Flavored Markdown", help_page_path("markdown", "markdown"), target: '_blank'}.
29 29 .pull-right Attach images (JPG, PNG, GIF) by dragging & dropping, #{link_to "selecting them", '#', class: 'markdown-selector' } or pasting from the clipboard.
30   -
31 30 .clearfix
32 31 .error-alert
33 32 .form-group
... ...
app/views/projects/milestones/_form.html.haml
... ... @@ -23,7 +23,7 @@
23 23 .col-sm-10
24 24 = f.text_area :description, maxlength: 2000, class: "form-control markdown-area", rows: 10
25 25 .hint
26   - .pull-left Milestones are parsed with #{link_to "GitLab Flavored Markdown", help_markdown_path, target: '_blank'}.
  26 + .pull-left Milestones are parsed with #{link_to "GitLab Flavored Markdown", help_page_path("markdown", "markdown"), target: '_blank'}.
27 27 .pull-left Attach images (JPG, PNG, GIF) by dragging & dropping, #{link_to "selecting them", '#', class: 'markdown-selector' } or pasting from the clipboard.
28 28 .clearfix
29 29 .error-alert
... ...
app/views/projects/notes/_form.html.haml
... ... @@ -17,7 +17,7 @@
17 17 = f.text_area :note, size: 255, class: 'note_text js-note-text js-gfm-input markdown-area'
18 18  
19 19 .light.clearfix.hint
20   - .pull-left Comments are parsed with #{link_to "GitLab Flavored Markdown", help_markdown_path, target: '_blank'}.
  20 + .pull-left Comments are parsed with #{link_to "GitLab Flavored Markdown", help_page_path("markdown", "markdown"), target: '_blank'}
21 21 .pull-right Attach images (JPG, PNG, GIF) by dragging & dropping, #{link_to "selecting them", '#', class: 'markdown-selector' } or pasting from the clipboard.
22 22 .error-alert
23 23 .note-preview-holder.hide
... ...
app/views/projects/protected_branches/index.html.haml
... ... @@ -5,10 +5,10 @@
5 5 .bs-callout.bs-callout-info
6 6 %p Protected branches designed to
7 7 %ul
8   - %li prevent push for all except #{link_to "masters", help_permissions_path, class: "vlink"}.
  8 + %li prevent push for all except #{link_to "masters", help_page_path("permissions", "permissions"), class: "vlink"}.
9 9 %li prevent branch from force push
10 10 %li prevent branch from removal
11   - %p Read more about project permissions #{link_to "here", help_permissions_path, class: "underlined-link"}
  11 + %p Read more about project permissions #{link_to "here", help_page_path("permissions", "permissions"), class: "underlined-link"}
12 12  
13 13 - if can? current_user, :admin_project, @project
14 14 = form_for [@project, @protected_branch], html: { class: 'form-horizontal' } do |f|
... ...
app/views/projects/team_members/index.html.haml
... ... @@ -10,7 +10,7 @@
10 10  
11 11 %p.light
12 12 Read more about project permissions
13   - %strong= link_to "here", help_permissions_path, class: "vlink"
  13 + %strong= link_to "here", help_page_path("permissions", "permissions"), class: "vlink"
14 14 = render "team", members: @users_projects
15 15 - if @group
16 16 = render "group_members"
... ...
app/views/projects/wikis/_form.html.haml
... ... @@ -24,9 +24,8 @@
24 24 .col-sm-10
25 25 = f.text_area :content, class: 'form-control js-gfm-input markdown-area', rows: 18
26 26 .col-sm-12.hint
27   - .pull-left Wiki content is parsed with #{link_to "GitLab Flavored Markdown", help_markdown_path, target: '_blank'}.
  27 + .pull-left Wiki content is parsed with #{link_to "GitLab Flavored Markdown", help_page_path("markdown", "markdown"), target: '_blank'}
28 28 .pull-right Attach images (JPG, PNG, GIF) by dragging & dropping, #{link_to "selecting them", '#', class: 'markdown-selector' } or pasting from the clipboard.
29   -
30 29 .clearfix
31 30 .error-alert
32 31 .form-group
... ...
config/routes.rb
... ... @@ -31,19 +31,10 @@ Gitlab::Application.routes.draw do
31 31 #
32 32 # Help
33 33 #
34   - get 'help' => 'help#index'
35   - get 'help/api' => 'help#api'
36   - get 'help/api/:category' => 'help#api', as: 'help_api_file'
37   - get 'help/markdown' => 'help#markdown'
38   - get 'help/permissions' => 'help#permissions'
39   - get 'help/public_access' => 'help#public_access'
40   - get 'help/raketasks' => 'help#raketasks'
41   - get 'help/ssh' => 'help#ssh'
42   - get 'help/system_hooks' => 'help#system_hooks'
43   - get 'help/web_hooks' => 'help#web_hooks'
44   - get 'help/workflow' => 'help#workflow'
  34 +
  35 + get 'help' => 'help#index'
  36 + get 'help/:category/:file' => 'help#show', as: :help_page
45 37 get 'help/shortcuts'
46   - get 'help/security'
47 38  
48 39 #
49 40 # Global snippets
... ...
doc/workflow/README.md
1   -+ [Workflow](workflow/workflow.md)
2   -+ [Project Features](workflow/project_features.md)
  1 ++ [Workflow](workflow.md)
  2 ++ [Project Features](project_features.md)
... ...
features/steps/help.rb
... ... @@ -8,14 +8,14 @@ class Spinach::Features::Help < Spinach::FeatureSteps
8 8 end
9 9  
10 10 step 'I visit the "Rake Tasks" help page' do
11   - visit help_raketasks_path
  11 + visit help_page_path("raketasks", "maintenance")
12 12 end
13 13  
14 14 step 'I should see "Rake Tasks" page markdown rendered' do
15   - page.should have_content "GitLab provides some specific rake tasks to enable special features or perform maintenance tasks"
  15 + page.should have_content "Gather information about GitLab and the system it runs on"
16 16 end
17 17  
18 18 step 'Header "Rebuild project satellites" should have correct ids and links' do
19   - header_should_have_correct_id_and_link(3, '(Re-)Create satellite repos', 're-create-satellite-repos')
  19 + header_should_have_correct_id_and_link(3, '(Re-)Create satellite repos', 're-create-satellite-repos', '.documentation')
20 20 end
21 21 end
... ...
spec/routing/routing_spec.rb
... ... @@ -79,35 +79,35 @@ describe HelpController, "routing" do
79 79 end
80 80  
81 81 it "to #permissions" do
82   - get("/help/permissions").should route_to('help#permissions')
  82 + get("/help/permissions/permissions").should route_to('help#show', category: "permissions", file: "permissions")
83 83 end
84 84  
85 85 it "to #workflow" do
86   - get("/help/workflow").should route_to('help#workflow')
  86 + get("/help/workflow/README").should route_to('help#show', category: "workflow", file: "README")
87 87 end
88 88  
89 89 it "to #api" do
90   - get("/help/api").should route_to('help#api')
  90 + get("/help/api/README").should route_to('help#show', category: "api", file: "README")
91 91 end
92 92  
93 93 it "to #web_hooks" do
94   - get("/help/web_hooks").should route_to('help#web_hooks')
  94 + get("/help/web_hooks/web_hooks").should route_to('help#show', category: "web_hooks", file: "web_hooks")
95 95 end
96 96  
97 97 it "to #system_hooks" do
98   - get("/help/system_hooks").should route_to('help#system_hooks')
  98 + get("/help/system_hooks/system_hooks").should route_to('help#show', category: "system_hooks", file: "system_hooks")
99 99 end
100 100  
101 101 it "to #markdown" do
102   - get("/help/markdown").should route_to('help#markdown')
  102 + get("/help/markdown/markdown").should route_to('help#show',category: "markdown", file: "markdown")
103 103 end
104 104  
105 105 it "to #ssh" do
106   - get("/help/ssh").should route_to('help#ssh')
  106 + get("/help/ssh/README").should route_to('help#show', category: "ssh", file: "README")
107 107 end
108 108  
109 109 it "to #raketasks" do
110   - get("/help/raketasks").should route_to('help#raketasks')
  110 + get("/help/raketasks/README").should route_to('help#show', category: "raketasks", file: "README")
111 111 end
112 112 end
113 113  
... ...