summaryrefslogtreecommitdiff
path: root/app/controllers/help_controller.rb
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-05-02 07:34:58 +0000
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-05-02 07:34:58 +0000
commitcfbff017d0ba1ba4fd896b4762b23853f123c60a (patch)
tree1f381ccc24888ccbd82a8b220ad1254fc5be7afb /app/controllers/help_controller.rb
parent812c7a85df81c526b6f21de8c057eb3ba0c20874 (diff)
parenta2eee3181c6b0fc3ef8b95f3187704a2b12774e4 (diff)
downloadgitlab-ce-cfbff017d0ba1ba4fd896b4762b23853f123c60a.tar.gz
Merge branch 'you-get-a-title-and-you-get-a-title-and-everyone-gets-a-title' into 'master'
Add a page title to every page. ![You get a title, and you get a title; everyone gets a title!](https://i.imgflip.com/kvmq8.jpg) The `page_title` helper pushes the provided string at the end of the title, but because of the order that layouts are rendered in by ActionView, the result is always this: ``` <title from view> | <title from as specified in the controller or by its layout> | <title from layouts/_head> ``` For example: `Merge Requests | GitLab.org / Gitlab Community Edition | GitLab`. All a developer needs to know is to put a `page_title` call describing the page in question at the start of every template. To get everything where I wanted it to go without too much duplication, I had to make some changes around layouts, sidebars and controllers. See merge request !593
Diffstat (limited to 'app/controllers/help_controller.rb')
-rw-r--r--app/controllers/help_controller.rb10
1 files changed, 6 insertions, 4 deletions
diff --git a/app/controllers/help_controller.rb b/app/controllers/help_controller.rb
index 35ece5b270b..8a45dc8860d 100644
--- a/app/controllers/help_controller.rb
+++ b/app/controllers/help_controller.rb
@@ -1,14 +1,16 @@
class HelpController < ApplicationController
+ layout 'help'
+
def index
end
def show
- category = clean_path_info(path_params[:category])
- file = path_params[:file]
+ @category = clean_path_info(path_params[:category])
+ @file = path_params[:file]
respond_to do |format|
format.any(:markdown, :md, :html) do
- path = Rails.root.join('doc', category, "#{file}.md")
+ path = Rails.root.join('doc', @category, "#{@file}.md")
if File.exist?(path)
@markdown = File.read(path)
@@ -22,7 +24,7 @@ class HelpController < ApplicationController
# Allow access to images in the doc folder
format.any(:png, :gif, :jpeg) do
- path = Rails.root.join('doc', category, "#{file}.#{params[:format]}")
+ path = Rails.root.join('doc', @category, "#{@file}.#{params[:format]}")
if File.exist?(path)
send_file(path, disposition: 'inline')