From fd476cf62013e49acf23a301b841e7c09197e9ae Mon Sep 17 00:00:00 2001 From: Job van der Voort <job@gitlab.com> Date: Fri, 18 Apr 2014 17:21:21 +0200 Subject: [PATCH] render items from doc --- app/assets/stylesheets/sections/help.scss | 20 ++++++++++---------- app/controllers/help_controller.rb | 11 +++++++++++ app/views/help/_layout.html.haml | 10 +++++----- app/views/help/index.html.haml | 2 +- app/views/help/show.html.haml | 1 + config/routes.rb | 16 +++------------- 6 files changed, 31 insertions(+), 29 deletions(-) create mode 100644 app/views/help/show.html.haml diff --git a/app/assets/stylesheets/sections/help.scss b/app/assets/stylesheets/sections/help.scss index c8881853706..6488e7c1e8e 100644 --- a/app/assets/stylesheets/sections/help.scss +++ b/app/assets/stylesheets/sections/help.scss @@ -1,11 +1,11 @@ .documentation { - padding-bottom: 10px; - p { - padding: 10px; - margin: 0; - } - li { - list-style-type: none; - padding-left: 10px; - } -} \ No newline at end of file + padding-bottom: 10px; + p { + padding: 10px; + margin: 0; + } + li { + list-style-type: none; + padding-left: 10px; + } +} diff --git a/app/controllers/help_controller.rb b/app/controllers/help_controller.rb index 051cbdfaf05..a4fcd4b29e8 100644 --- a/app/controllers/help_controller.rb +++ b/app/controllers/help_controller.rb @@ -13,6 +13,17 @@ class HelpController < ApplicationController end end + def show + @category = params[:category] + @file = params[:file] + + if File.exists?(Rails.root.join('doc', @category, @file + '.md')) + render 'show' + else + not_found! + end + end + def shortcuts end end diff --git a/app/views/help/_layout.html.haml b/app/views/help/_layout.html.haml index 201d63ca243..72547ed0141 100644 --- a/app/views/help/_layout.html.haml +++ b/app/views/help/_layout.html.haml @@ -1,11 +1,11 @@ .row .col-md-3 %h3.page-title Help - %ul.nav.nav-pills.nav-stacked - - 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} - - links.each do |title,path| - %li{class: current_page?(path) ? 'active' : nil} - = link_to title, path + / %ul.nav.nav-pills.nav-stacked + / - 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} + / - links.each do |title,path| + / %li{class: current_page?(path) ? 'active' : nil} + / = link_to title, path .col-md-9 .wiki diff --git a/app/views/help/index.html.haml b/app/views/help/index.html.haml index 8f0db82d473..ca8e17d1527 100644 --- a/app/views/help/index.html.haml +++ b/app/views/help/index.html.haml @@ -38,4 +38,4 @@ .title Documentation = preserve do - = markdown File.read(Rails.root.join("doc", "README.md")) \ No newline at end of file + = markdown File.read(Rails.root.join("doc", "README.md")) diff --git a/app/views/help/show.html.haml b/app/views/help/show.html.haml new file mode 100644 index 00000000000..d7785d307ef --- /dev/null +++ b/app/views/help/show.html.haml @@ -0,0 +1 @@ += markdown File.read(Rails.root.join('doc', @category, @file + '.md')) diff --git a/config/routes.rb b/config/routes.rb index ada9bb1d77a..bab8fb1d218 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -31,19 +31,9 @@ Gitlab::Application.routes.draw do # # Help # - get 'help' => 'help#index' - get 'help/api' => 'help#api' - get 'help/api/:category' => 'help#api', as: 'help_api_file' - get 'help/markdown' => 'help#markdown' - get 'help/permissions' => 'help#permissions' - get 'help/public_access' => 'help#public_access' - get 'help/raketasks' => 'help#raketasks' - get 'help/ssh' => 'help#ssh' - get 'help/system_hooks' => 'help#system_hooks' - get 'help/web_hooks' => 'help#web_hooks' - get 'help/workflow' => 'help#workflow' - get 'help/shortcuts' - get 'help/security' + + get 'help' => 'help#index' + get 'help/:category/:file' => 'help#show' # # Global snippets -- GitLab