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