##// END OF EJS Templates
Fixed: TypeError (can't modify frozen string) on settings view (#2700)....
Jean-Philippe Lang -
r2362:27e3b31c1ef5
parent child
Show More
@@ -1,59 +1,59
1 # redMine - project management software
1 # redMine - project management software
2 # Copyright (C) 2006-2007 Jean-Philippe Lang
2 # Copyright (C) 2006-2007 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 SettingsController < ApplicationController
18 class SettingsController < ApplicationController
19 before_filter :require_admin
19 before_filter :require_admin
20
20
21 def index
21 def index
22 edit
22 edit
23 render :action => 'edit'
23 render :action => 'edit'
24 end
24 end
25
25
26 def edit
26 def edit
27 @notifiables = %w(issue_added issue_updated news_added document_added file_added message_posted)
27 @notifiables = %w(issue_added issue_updated news_added document_added file_added message_posted)
28 if request.post? && params[:settings] && params[:settings].is_a?(Hash)
28 if request.post? && params[:settings] && params[:settings].is_a?(Hash)
29 settings = (params[:settings] || {}).dup.symbolize_keys
29 settings = (params[:settings] || {}).dup.symbolize_keys
30 settings.each do |name, value|
30 settings.each do |name, value|
31 # remove blank values in array settings
31 # remove blank values in array settings
32 value.delete_if {|v| v.blank? } if value.is_a?(Array)
32 value.delete_if {|v| v.blank? } if value.is_a?(Array)
33 Setting[name] = value
33 Setting[name] = value
34 end
34 end
35 flash[:notice] = l(:notice_successful_update)
35 flash[:notice] = l(:notice_successful_update)
36 redirect_to :action => 'edit', :tab => params[:tab]
36 redirect_to :action => 'edit', :tab => params[:tab]
37 return
37 return
38 end
38 end
39 @options = {}
39 @options = {}
40 @options[:user_format] = User::USER_FORMATS.keys.collect {|f| [User.current.name(f), f.to_s] }
40 @options[:user_format] = User::USER_FORMATS.keys.collect {|f| [User.current.name(f), f.to_s] }
41 @deliveries = ActionMailer::Base.perform_deliveries
41 @deliveries = ActionMailer::Base.perform_deliveries
42
42
43 @guessed_host_and_path = request.host_with_port
43 @guessed_host_and_path = request.host_with_port.dup
44 @guessed_host_and_path << ('/'+ Redmine::Utils.relative_url_root.gsub(%r{^\/}, '')) unless Redmine::Utils.relative_url_root.blank?
44 @guessed_host_and_path << ('/'+ Redmine::Utils.relative_url_root.gsub(%r{^\/}, '')) unless Redmine::Utils.relative_url_root.blank?
45 end
45 end
46
46
47 def plugin
47 def plugin
48 @plugin = Redmine::Plugin.find(params[:id])
48 @plugin = Redmine::Plugin.find(params[:id])
49 if request.post?
49 if request.post?
50 Setting["plugin_#{@plugin.id}"] = params[:settings]
50 Setting["plugin_#{@plugin.id}"] = params[:settings]
51 flash[:notice] = l(:notice_successful_update)
51 flash[:notice] = l(:notice_successful_update)
52 redirect_to :action => 'plugin', :id => @plugin.id
52 redirect_to :action => 'plugin', :id => @plugin.id
53 end
53 end
54 @partial = @plugin.settings[:partial]
54 @partial = @plugin.settings[:partial]
55 @settings = Setting["plugin_#{@plugin.id}"]
55 @settings = Setting["plugin_#{@plugin.id}"]
56 rescue Redmine::PluginNotFound
56 rescue Redmine::PluginNotFound
57 render_404
57 render_404
58 end
58 end
59 end
59 end
General Comments 0
You need to be logged in to leave comments. Login now