##// END OF EJS Templates
updated redirection to the help main index (recognition fails when redirecting to a directory)...
Jean-Philippe Lang -
r135:a9efe82117e2
parent child
Show More
@@ -1,47 +1,47
1 1 # redMine - project management software
2 2 # Copyright (C) 2006 Jean-Philippe Lang
3 3 #
4 4 # This program is free software; you can redistribute it and/or
5 5 # modify it under the terms of the GNU General Public License
6 6 # as published by the Free Software Foundation; either version 2
7 7 # of the License, or (at your option) any later version.
8 8 #
9 9 # This program is distributed in the hope that it will be useful,
10 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 12 # GNU General Public License for more details.
13 13 #
14 14 # You should have received a copy of the GNU General Public License
15 15 # along with this program; if not, write to the Free Software
16 16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 17
18 18 class HelpController < ApplicationController
19 19
20 20 skip_before_filter :check_if_login_required
21 21 before_filter :load_help_config
22 22
23 23 # displays help page for the requested controller/action
24 24 def index
25 25 # select help page to display
26 26 if params[:ctrl] and @help_config['pages'][params[:ctrl]]
27 27 if params[:page] and @help_config['pages'][params[:ctrl]][params[:page]]
28 28 template = @help_config['pages'][params[:ctrl]][params[:page]]
29 29 else
30 30 template = @help_config['pages'][params[:ctrl]]['index']
31 31 end
32 32 end
33 33 # choose language according to available help translations
34 34 lang = (@help_config['langs'].include? current_language.to_s) ? current_language.to_s : @help_config['langs'].first
35 35
36 36 if template
37 37 redirect_to "/manual/#{lang}/#{template}"
38 38 else
39 redirect_to "/manual/#{lang}/"
39 redirect_to "/manual/#{lang}/index.html"
40 40 end
41 41 end
42 42
43 43 private
44 44 def load_help_config
45 45 @help_config = YAML::load(File.open("#{RAILS_ROOT}/config/help.yml"))
46 46 end
47 47 end
General Comments 0
You need to be logged in to leave comments. Login now