Enabling settings management
In Chapter 1, Introduction to Redmine Plugins, we were introduced to the Redmine plugin's initialization file as well as some of the attributes, methods, and helpers available to plugin authors.
The settings
attribute was presented as a way for plugin settings to be initialized as well as a configuration partial view to be defined:
Redmine::Plugin.register :redmine_knowledgebase do # ... settings :default => { :sort_category_tree => 1, :show_category_totals => 1, :summary_limit => 5, :disable_article_summaries => 0 }, :partial => 'redmine_knowledgebase/knowledgebase_settings' # ... end
Our plugin's settings
field is initialized with a hash that expects two keys:
:default
: This key expects a hash, which will be used to initialize our plugin's settings values to defaults that will be presented on first use. Once a configuration value has been explicitly set, the default values are no longer used...