summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorRobert Speicher <rspeicher@gmail.com>2015-04-15 12:24:44 -0400
committerRobert Speicher <rspeicher@gmail.com>2015-04-15 12:24:44 -0400
commitef47ea3d39d9235c2842d1f374d0f03e56da7eeb (patch)
treeb8d38727275e556bc79a76e899b40406e707d621 /app
parent5f78601c8a67028f246134d325cca99952ba78b6 (diff)
downloadgitlab-ce-ef47ea3d39d9235c2842d1f374d0f03e56da7eeb.tar.gz
Revert "Fix and improve help rendering"
This reverts commit d365004e684e98459061fcd5fbaf9bea880934a8.
Diffstat (limited to 'app')
-rw-r--r--app/controllers/help_controller.rb30
-rw-r--r--app/views/help/show.html.haml2
2 files changed, 8 insertions, 24 deletions
diff --git a/app/controllers/help_controller.rb b/app/controllers/help_controller.rb
index 0e5567c7734..964f624d6d7 100644
--- a/app/controllers/help_controller.rb
+++ b/app/controllers/help_controller.rb
@@ -3,40 +3,24 @@ class HelpController < ApplicationController
end
def show
- @filepath = clean_path_info(params[:filepath])
- @format = params[:format]
+ @category = clean_path_info(params[:category])
+ @file = clean_path_info(params[:file])
- respond_to do |format|
- format.md { render_doc }
- format.all { send_file_data }
- end
- end
-
- def shortcuts
- end
-
- private
-
- def render_doc
- if File.exists?(Rails.root.join('doc', @filepath + '.md'))
- render 'show.html.haml'
+ if File.exists?(Rails.root.join('doc', @category, @file + '.md'))
+ render 'show'
else
not_found!
end
end
- def send_file_data
- path = Rails.root.join('doc', "#{@filepath}.#{@format}")
- if File.exists?(path)
- send_file(path, disposition: 'inline')
- else
- head :not_found
- end
+ def shortcuts
end
def ui
end
+ private
+
PATH_SEPS = Regexp.union(*[::File::SEPARATOR, ::File::ALT_SEPARATOR].compact)
# Taken from ActionDispatch::FileHandler
diff --git a/app/views/help/show.html.haml b/app/views/help/show.html.haml
index f22aa92caf7..eca34dbff06 100644
--- a/app/views/help/show.html.haml
+++ b/app/views/help/show.html.haml
@@ -1,2 +1,2 @@
.documentation.wiki
- = markdown File.read(Rails.root.join('doc', @filepath + '.md')).gsub("$your_email", current_user.email)
+ = markdown File.read(Rails.root.join('doc', @category, @file + '.md')).gsub("$your_email", current_user.email)