2012-01-18 20:15:45 +00:00
|
|
|
class HelpController < ApplicationController
|
|
|
|
def index
|
|
|
|
end
|
2013-06-06 10:19:23 +00:00
|
|
|
|
2014-04-18 15:21:21 +00:00
|
|
|
def show
|
2014-10-07 12:06:05 +00:00
|
|
|
@filepath = params[:filepath]
|
|
|
|
@format = params[:format]
|
2014-04-18 15:21:21 +00:00
|
|
|
|
2014-10-07 12:06:05 +00:00
|
|
|
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'
|
2014-04-18 15:21:21 +00:00
|
|
|
else
|
|
|
|
not_found!
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2014-10-07 12:06:05 +00:00
|
|
|
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
|
2013-06-30 19:10:52 +00:00
|
|
|
end
|
2015-03-08 21:46:22 +00:00
|
|
|
|
|
|
|
def ui
|
|
|
|
end
|
2012-01-18 20:15:45 +00:00
|
|
|
end
|