diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2008-11-16 15:38:37 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2008-11-16 15:38:37 +0000 |
commit | fefc6e6bec617fe4e6b438beedf1ca78f722ce45 (patch) | |
tree | 1af057922516131d69c388775703fa6b93fdf3f7 /app | |
parent | 97252c26eefe3dfa5e0c3cb059fe66cb21b2e34d (diff) | |
download | redmine-fefc6e6bec617fe4e6b438beedf1ca78f722ce45.tar.gz redmine-fefc6e6bec617fe4e6b438beedf1ca78f722ce45.zip |
Adds .find and .all Plugin class methods.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2039 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/admin_controller.rb | 2 | ||||
-rw-r--r-- | app/controllers/settings_controller.rb | 11 | ||||
-rw-r--r-- | app/models/setting.rb | 4 |
3 files changed, 9 insertions, 8 deletions
diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb index 119e2b922..d3afeeea1 100644 --- a/app/controllers/admin_controller.rb +++ b/app/controllers/admin_controller.rb @@ -50,7 +50,7 @@ class AdminController < ApplicationController end def plugins - @plugins = Redmine::Plugin.registered_plugins.values.sort + @plugins = Redmine::Plugin.all end # Loads the default configuration diff --git a/app/controllers/settings_controller.rb b/app/controllers/settings_controller.rb index 7f9c9d5cc..99f7bcf08 100644 --- a/app/controllers/settings_controller.rb +++ b/app/controllers/settings_controller.rb @@ -45,14 +45,15 @@ class SettingsController < ApplicationController end def plugin - plugin_id = params[:id].to_sym - @plugin = Redmine::Plugin.registered_plugins[plugin_id] + @plugin = Redmine::Plugin.find(params[:id]) if request.post? - Setting["plugin_#{plugin_id}"] = params[:settings] + Setting["plugin_#{@plugin.id}"] = params[:settings] flash[:notice] = l(:notice_successful_update) - redirect_to :action => 'plugin', :id => params[:id] + redirect_to :action => 'plugin', :id => @plugin.id end @partial = @plugin.settings[:partial] - @settings = Setting["plugin_#{plugin_id}"] + @settings = Setting["plugin_#{@plugin.id}"] + rescue Redmine::PluginNotFound + render_404 end end diff --git a/app/models/setting.rb b/app/models/setting.rb index 072afa0db..187347d64 100644 --- a/app/models/setting.rb +++ b/app/models/setting.rb @@ -75,9 +75,9 @@ class Setting < ActiveRecord::Base cattr_accessor :available_settings @@available_settings = YAML::load(File.open("#{RAILS_ROOT}/config/settings.yml")) - Redmine::Plugin.registered_plugins.each do |id, plugin| + Redmine::Plugin.all.each do |plugin| next unless plugin.settings - @@available_settings["plugin_#{id}"] = {'default' => plugin.settings[:default], 'serialized' => true} + @@available_settings["plugin_#{plugin.id}"] = {'default' => plugin.settings[:default], 'serialized' => true} end validates_uniqueness_of :name |