Commit fd476cf62013e49acf23a301b841e7c09197e9ae

Authored by Job van der Voort
Committed by Marin Jankovski
1 parent e61e3eaa

render items from doc

app/assets/stylesheets/sections/help.scss
1 .documentation { 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 -}  
12 \ No newline at end of file 2 \ No newline at end of file
  3 + padding-bottom: 10px;
  4 + p {
  5 + padding: 10px;
  6 + margin: 0;
  7 + }
  8 + li {
  9 + list-style-type: none;
  10 + padding-left: 10px;
  11 + }
  12 +}
app/controllers/help_controller.rb
@@ -13,6 +13,17 @@ class HelpController < ApplicationController @@ -13,6 +13,17 @@ class HelpController < ApplicationController
13 end 13 end
14 end 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 def shortcuts 27 def shortcuts
17 end 28 end
18 end 29 end
app/views/help/_layout.html.haml
1 .row 1 .row
2 .col-md-3 2 .col-md-3
3 %h3.page-title Help 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 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 9
10 .col-md-9 10 .col-md-9
11 .wiki 11 .wiki
app/views/help/index.html.haml
@@ -38,4 +38,4 @@ @@ -38,4 +38,4 @@
38 .title Documentation 38 .title Documentation
39 39
40 = preserve do 40 = preserve do
41 - = markdown File.read(Rails.root.join("doc", "README.md"))  
42 \ No newline at end of file 41 \ No newline at end of file
  42 + = markdown File.read(Rails.root.join("doc", "README.md"))
app/views/help/show.html.haml 0 → 100644
@@ -0,0 +1 @@ @@ -0,0 +1 @@
  1 += markdown File.read(Rails.root.join('doc', @category, @file + '.md'))
config/routes.rb
@@ -31,19 +31,9 @@ Gitlab::Application.routes.draw do @@ -31,19 +31,9 @@ Gitlab::Application.routes.draw do
31 # 31 #
32 # Help 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'  
45 - get 'help/shortcuts'  
46 - get 'help/security' 34 +
  35 + get 'help' => 'help#index'
  36 + get 'help/:category/:file' => 'help#show'
47 37
48 # 38 #
49 # Global snippets 39 # Global snippets