diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2008-01-06 20:24:26 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2008-01-06 20:24:26 +0000 |
commit | a80dbc49b1670877aca09b11101d4a5b40ea58c2 (patch) | |
tree | ad81a0601a377471558b561c08be9956cd1b008a /app | |
parent | 78d9ae9754578cda4b72d7b28a4f707534c15c49 (diff) | |
download | redmine-a80dbc49b1670877aca09b11101d4a5b40ea58c2.tar.gz redmine-a80dbc49b1670877aca09b11101d4a5b40ea58c2.zip |
Admin settings screen split to tabs.
Email notification options moved to this view as a tab and LDAP list is accessible from the 'Authentication' tab.
git-svn-id: http://redmine.rubyforge.org/svn/trunk@1046 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/admin_controller.rb | 13 | ||||
-rw-r--r-- | app/controllers/settings_controller.rb | 13 | ||||
-rw-r--r-- | app/helpers/settings_helper.rb | 8 | ||||
-rw-r--r-- | app/views/admin/index.rhtml | 8 | ||||
-rw-r--r-- | app/views/settings/_authentication.rhtml | 27 | ||||
-rw-r--r-- | app/views/settings/_general.rhtml | 46 | ||||
-rw-r--r-- | app/views/settings/_issues.rhtml | 20 | ||||
-rw-r--r-- | app/views/settings/_notifications.rhtml (renamed from app/views/admin/mail_options.rhtml) | 19 | ||||
-rw-r--r-- | app/views/settings/_repositories.rhtml | 26 | ||||
-rw-r--r-- | app/views/settings/edit.rhtml | 111 |
10 files changed, 158 insertions, 133 deletions
diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb index 9e6a22822..e002f3a27 100644 --- a/app/controllers/admin_controller.rb +++ b/app/controllers/admin_controller.rb @@ -45,17 +45,6 @@ class AdminController < ApplicationController render :action => "projects", :layout => false if request.xhr? end - - def mail_options - @notifiables = %w(issue_added issue_updated news_added document_added file_added message_posted) - if request.post? - settings = (params[:settings] || {}).dup.symbolize_keys - settings[:notified_events] ||= [] - settings.each { |name, value| Setting[name] = value } - flash[:notice] = l(:notice_successful_update) - redirect_to :controller => 'admin', :action => 'mail_options' - end - end # Loads the default configuration # (roles, trackers, statuses, workflow, enumerations) @@ -82,7 +71,7 @@ class AdminController < ApplicationController flash[:error] = l(:notice_email_error, e.message) end ActionMailer::Base.raise_delivery_errors = raise_delivery_errors - redirect_to :action => 'mail_options' + redirect_to :controller => 'settings', :action => 'edit', :tab => 'notifications' end def info diff --git a/app/controllers/settings_controller.rb b/app/controllers/settings_controller.rb index 09af63176..c5fae2a16 100644 --- a/app/controllers/settings_controller.rb +++ b/app/controllers/settings_controller.rb @@ -25,9 +25,16 @@ class SettingsController < ApplicationController end def edit - if request.post? and params[:settings] and params[:settings].is_a? Hash - params[:settings].each { |name, value| Setting[name] = value } - redirect_to :action => 'edit' and return + @notifiables = %w(issue_added issue_updated news_added document_added file_added message_posted) + if request.post? && params[:settings] && params[:settings].is_a?(Hash) + settings = (params[:settings] || {}).dup.symbolize_keys + settings.each do |name, value| + # remove blank values in array settings + value.delete_if {|v| v.blank? } if value.is_a?(Array) + Setting[name] = value + end + flash[:notice] = l(:notice_successful_update) + redirect_to :action => 'edit', :tab => params[:tab] end end diff --git a/app/helpers/settings_helper.rb b/app/helpers/settings_helper.rb index f53314c40..f4ec5a7a7 100644 --- a/app/helpers/settings_helper.rb +++ b/app/helpers/settings_helper.rb @@ -16,4 +16,12 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. module SettingsHelper + def administration_settings_tabs + tabs = [{:name => 'general', :partial => 'settings/general', :label => :label_general}, + {:name => 'authentication', :partial => 'settings/authentication', :label => :label_authentication}, + {:name => 'issues', :partial => 'settings/issues', :label => :label_issue_tracking}, + {:name => 'notifications', :partial => 'settings/notifications', :label => l(:field_mail_notification)}, + {:name => 'repositories', :partial => 'settings/repositories', :label => :label_repository_plural} + ] + end end diff --git a/app/views/admin/index.rhtml b/app/views/admin/index.rhtml index 2291c5415..18bee34cb 100644 --- a/app/views/admin/index.rhtml +++ b/app/views/admin/index.rhtml @@ -30,14 +30,6 @@ <%= link_to l(:label_enumerations), :controller => 'enumerations' %> </p> -<p class="icon22 icon22-notifications"> -<%= link_to l(:field_mail_notification), :controller => 'admin', :action => 'mail_options' %> -</p> - -<p class="icon22 icon22-authent"> -<%= link_to l(:label_authentication), :controller => 'auth_sources' %> -</p> - <p class="icon22 icon22-settings"> <%= link_to l(:label_settings), :controller => 'settings' %> </p> diff --git a/app/views/settings/_authentication.rhtml b/app/views/settings/_authentication.rhtml new file mode 100644 index 000000000..a8fa63f0d --- /dev/null +++ b/app/views/settings/_authentication.rhtml @@ -0,0 +1,27 @@ +<% form_tag({:action => 'edit', :tab => 'authentication'}) do %> + +<div class="box tabular settings"> +<p><label><%= l(:setting_login_required) %></label> +<%= check_box_tag 'settings[login_required]', 1, Setting.login_required? %><%= hidden_field_tag 'settings[login_required]', 0 %></p> + +<p><label><%= l(:setting_autologin) %></label> +<%= select_tag 'settings[autologin]', options_for_select( [[l(:label_disabled), "0"]] + [1, 7, 30, 365].collect{|days| [lwr(:actionview_datehelper_time_in_words_day, days), days.to_s]}, Setting.autologin) %></p> + +<p><label><%= l(:setting_self_registration) %></label> +<%= select_tag 'settings[self_registration]', + options_for_select( [[l(:label_disabled), "0"], + [l(:label_registration_activation_by_email), "1"], + [l(:label_registration_manual_activation), "2"], + [l(:label_registration_automatic_activation), "3"] + ], Setting.self_registration ) %></p> + +<p><label><%= l(:label_password_lost) %></label> +<%= check_box_tag 'settings[lost_password]', 1, Setting.lost_password? %><%= hidden_field_tag 'settings[lost_password]', 0 %></p> +</div> + +<div style="float:right;"> + <%= link_to 'Manage LDAP authentication...', :controller => 'auth_sources', :action => 'list' %> +</div> + +<%= submit_tag l(:button_save) %> +<% end %> diff --git a/app/views/settings/_general.rhtml b/app/views/settings/_general.rhtml new file mode 100644 index 000000000..514e62b59 --- /dev/null +++ b/app/views/settings/_general.rhtml @@ -0,0 +1,46 @@ +<% form_tag({:action => 'edit'}) do %> + +<div class="box tabular settings"> +<p><label><%= l(:setting_app_title) %></label> +<%= text_field_tag 'settings[app_title]', Setting.app_title, :size => 30 %></p> + +<p><label><%= l(:setting_welcome_text) %></label> +<%= text_area_tag 'settings[welcome_text]', Setting.welcome_text, :cols => 60, :rows => 5, :class => 'wiki-edit' %></p> +<%= wikitoolbar_for 'settings[welcome_text]' %> + +<p><label><%= l(:label_theme) %></label> +<%= select_tag 'settings[ui_theme]', options_for_select( ([[l(:label_default), '']] + Redmine::Themes.themes.collect {|t| [t.name, t.id]}), Setting.ui_theme) %></p> + +<p><label><%= l(:setting_default_language) %></label> +<%= select_tag 'settings[default_language]', options_for_select( lang_options_for_select(false), Setting.default_language) %></p> + +<p><label><%= l(:setting_date_format) %></label> +<%= select_tag 'settings[date_format]', options_for_select( [[l(:label_language_based), '']] + Setting::DATE_FORMATS.collect {|f| [Date.today.strftime(f), f]}, Setting.date_format) %></p> + +<p><label><%= l(:setting_time_format) %></label> +<%= select_tag 'settings[time_format]', options_for_select( [[l(:label_language_based), '']] + Setting::TIME_FORMATS.collect {|f| [Time.now.strftime(f), f]}, Setting.time_format) %></p> + +<p><label><%= l(:setting_attachment_max_size) %></label> +<%= text_field_tag 'settings[attachment_max_size]', Setting.attachment_max_size, :size => 6 %> KB</p> + +<p><label><%= l(:setting_per_page_options) %></label> +<%= text_field_tag 'settings[per_page_options]', Setting.per_page_options_array.join(', '), :size => 20 %><br /><em><%= l(:text_comma_separated) %></em></p> + +<p><label><%= l(:setting_host_name) %></label> +<%= text_field_tag 'settings[host_name]', Setting.host_name, :size => 60 %></p> + +<p><label><%= l(:setting_protocol) %></label> +<%= select_tag 'settings[protocol]', options_for_select(['http', 'https'], Setting.protocol) %></p> + +<p><label><%= l(:setting_text_formatting) %></label> +<%= select_tag 'settings[text_formatting]', options_for_select([[l(:label_none), "0"], ["textile", "textile"]], Setting.text_formatting) %></p> + +<p><label><%= l(:setting_wiki_compression) %></label> +<%= select_tag 'settings[wiki_compression]', options_for_select( [[l(:label_none), 0], ["gzip", "gzip"]], Setting.wiki_compression) %></p> + +<p><label><%= l(:setting_feeds_limit) %></label> +<%= text_field_tag 'settings[feeds_limit]', Setting.feeds_limit, :size => 6 %></p> +</div> + +<%= submit_tag l(:button_save) %> +<% end %> diff --git a/app/views/settings/_issues.rhtml b/app/views/settings/_issues.rhtml new file mode 100644 index 000000000..36c604fd9 --- /dev/null +++ b/app/views/settings/_issues.rhtml @@ -0,0 +1,20 @@ +<% form_tag({:action => 'edit', :tab => 'issues'}) do %> + +<div class="box tabular settings"> +<p><label><%= l(:setting_cross_project_issue_relations) %></label> +<%= check_box_tag 'settings[cross_project_issue_relations]', 1, Setting.cross_project_issue_relations? %><%= hidden_field_tag 'settings[cross_project_issue_relations]', 0 %></p> + +<p><label><%= l(:setting_issues_export_limit) %></label> +<%= text_field_tag 'settings[issues_export_limit]', Setting.issues_export_limit, :size => 6 %></p> +</div> + +<fieldset class="box"><legend><%= l(:setting_issue_list_default_columns) %></legend> +<%= hidden_field_tag 'settings[issue_list_default_columns][]', '' %> +<p><% Query.new.available_columns.each do |column| %> + <label><%= check_box_tag 'settings[issue_list_default_columns][]', column.name, Setting.issue_list_default_columns.include?(column.name.to_s) %> + <%= column.caption %></label> +<% end %></p> +</fieldset> + +<%= submit_tag l(:button_save) %> +<% end %> diff --git a/app/views/admin/mail_options.rhtml b/app/views/settings/_notifications.rhtml index 698933b9b..ca04352f4 100644 --- a/app/views/admin/mail_options.rhtml +++ b/app/views/settings/_notifications.rhtml @@ -1,25 +1,20 @@ -<div class="contextual"> -<%= link_to l(:label_send_test_email), :action => 'test_email' %> -</div> - -<h2><%=l(:field_mail_notification)%></h2> +<% form_tag({:action => 'edit', :tab => 'notifications'}) do %> -<% form_tag({:action => 'mail_options'}, :id => 'mail-options-form') do %> - -<fieldset class="box tabular settings"><legend><%=l(:label_settings)%></legend> +<div class="box tabular settings"> <p><label><%= l(:setting_mail_from) %></label> <%= text_field_tag 'settings[mail_from]', Setting.mail_from, :size => 60 %></p> <p><label><%= l(:setting_bcc_recipients) %></label> <%= check_box_tag 'settings[bcc_recipients]', 1, Setting.bcc_recipients? %> <%= hidden_field_tag 'settings[bcc_recipients]', 0 %></p> -</fieldset> +</div> <fieldset class="box"><legend><%=l(:text_select_mail_notifications)%></legend> <% @notifiables.each do |notifiable| %> <label><%= check_box_tag 'settings[notified_events][]', notifiable, Setting.notified_events.include?(notifiable) %> <%= notifiable.humanize %></label><br /> <% end %> +<%= hidden_field_tag 'settings[notified_events][]', '' %> <p><%= check_all_links('mail-options-form') %></p> </fieldset> @@ -27,7 +22,9 @@ <%= text_area_tag 'settings[emails_footer]', Setting.emails_footer, :class => 'wiki-edit', :rows => 5 %> </fieldset> +<div style="float:right;"> +<%= link_to l(:label_send_test_email), :controller => 'admin', :action => 'test_email' %> +</div> + <%= submit_tag l(:button_save) %> <% end %> - -<% html_title(l(:field_mail_notification)) -%> diff --git a/app/views/settings/_repositories.rhtml b/app/views/settings/_repositories.rhtml new file mode 100644 index 000000000..59b3b51de --- /dev/null +++ b/app/views/settings/_repositories.rhtml @@ -0,0 +1,26 @@ +<% form_tag({:action => 'edit', :tab => 'repositories'}) do %> + +<div class="box tabular settings"> +<p><label><%= l(:setting_autofetch_changesets) %></label> +<%= check_box_tag 'settings[autofetch_changesets]', 1, Setting.autofetch_changesets? %><%= hidden_field_tag 'settings[autofetch_changesets]', 0 %></p> + +<p><label><%= l(:setting_sys_api_enabled) %></label> +<%= check_box_tag 'settings[sys_api_enabled]', 1, Setting.sys_api_enabled? %><%= hidden_field_tag 'settings[sys_api_enabled]', 0 %></p> + +<p><label><%= l(:setting_repositories_encodings) %></label> +<%= text_field_tag 'settings[repositories_encodings]', Setting.repositories_encodings, :size => 60 %><br /><em><%= l(:text_comma_separated) %></em></p> +</div> + +<fieldset class="box tabular settings"><legend><%= l(:text_issues_ref_in_commit_messages) %></legend> +<p><label><%= l(:setting_commit_ref_keywords) %></label> +<%= text_field_tag 'settings[commit_ref_keywords]', Setting.commit_ref_keywords, :size => 30 %><br /><em><%= l(:text_comma_separated) %></em></p> + +<p><label><%= l(:setting_commit_fix_keywords) %></label> +<%= text_field_tag 'settings[commit_fix_keywords]', Setting.commit_fix_keywords, :size => 30 %> + <%= l(:label_applied_status) %>: <%= select_tag 'settings[commit_fix_status_id]', options_for_select( [["", 0]] + IssueStatus.find(:all).collect{|status| [status.name, status.id.to_s]}, Setting.commit_fix_status_id) %> + <%= l(:field_done_ratio) %>: <%= select_tag 'settings[commit_fix_done_ratio]', options_for_select( [[l(:label_no_change_option), '']] + ((0..10).to_a.collect {|r| ["#{r*10} %", "#{r*10}"] }), Setting.commit_fix_done_ratio) %> +<br /><em><%= l(:text_comma_separated) %></em></p> +</fieldset> + +<%= submit_tag l(:button_save) %> +<% end %> diff --git a/app/views/settings/edit.rhtml b/app/views/settings/edit.rhtml index b1762a0e3..c7b47b6d0 100644 --- a/app/views/settings/edit.rhtml +++ b/app/views/settings/edit.rhtml @@ -1,105 +1,18 @@ <h2><%= l(:label_settings) %></h2> -<% form_tag({:action => 'edit'}) do %> -<div class="box tabular settings"> -<p><label><%= l(:setting_app_title) %></label> -<%= text_field_tag 'settings[app_title]', Setting.app_title, :size => 30 %></p> - -<p><label><%= l(:setting_app_subtitle) %></label> -<%= text_field_tag 'settings[app_subtitle]', Setting.app_subtitle, :size => 60 %></p> - -<p><label><%= l(:setting_welcome_text) %></label> -<%= text_area_tag 'settings[welcome_text]', Setting.welcome_text, :cols => 60, :rows => 5, :class => 'wiki-edit' %></p> -<%= wikitoolbar_for 'settings[welcome_text]' %> - -<p><label><%= l(:label_theme) %></label> -<%= select_tag 'settings[ui_theme]', options_for_select( ([[l(:label_default), '']] + Redmine::Themes.themes.collect {|t| [t.name, t.id]}), Setting.ui_theme) %></p> - -<p><label><%= l(:setting_default_language) %></label> -<%= select_tag 'settings[default_language]', options_for_select( lang_options_for_select(false), Setting.default_language) %></p> - -<p><label><%= l(:setting_date_format) %></label> -<%= select_tag 'settings[date_format]', options_for_select( [[l(:label_language_based), '']] + Setting::DATE_FORMATS.collect {|f| [Date.today.strftime(f), f]}, Setting.date_format) %></p> - -<p><label><%= l(:setting_time_format) %></label> -<%= select_tag 'settings[time_format]', options_for_select( [[l(:label_language_based), '']] + Setting::TIME_FORMATS.collect {|f| [Time.now.strftime(f), f]}, Setting.time_format) %></p> - -<p><label><%= l(:setting_attachment_max_size) %></label> -<%= text_field_tag 'settings[attachment_max_size]', Setting.attachment_max_size, :size => 6 %> KB</p> - -<p><label><%= l(:setting_per_page_options) %></label> -<%= text_field_tag 'settings[per_page_options]', Setting.per_page_options_array.join(', '), :size => 20 %><br /><em><%= l(:text_comma_separated) %></em></p> - -<p><label><%= l(:setting_issues_export_limit) %></label> -<%= text_field_tag 'settings[issues_export_limit]', Setting.issues_export_limit, :size => 6 %></p> - -<p><label><%= l(:setting_cross_project_issue_relations) %></label> -<%= check_box_tag 'settings[cross_project_issue_relations]', 1, Setting.cross_project_issue_relations? %><%= hidden_field_tag 'settings[cross_project_issue_relations]', 0 %></p> - -<p><label><%= l(:setting_host_name) %></label> -<%= text_field_tag 'settings[host_name]', Setting.host_name, :size => 60 %></p> - -<p><label><%= l(:setting_protocol) %></label> -<%= select_tag 'settings[protocol]', options_for_select(['http', 'https'], Setting.protocol) %></p> - -<p><label><%= l(:setting_text_formatting) %></label> -<%= select_tag 'settings[text_formatting]', options_for_select([[l(:label_none), "0"], ["textile", "textile"]], Setting.text_formatting) %></p> - -<p><label><%= l(:setting_wiki_compression) %></label> -<%= select_tag 'settings[wiki_compression]', options_for_select( [[l(:label_none), 0], ["gzip", "gzip"]], Setting.wiki_compression) %></p> - -<p><label><%= l(:setting_feeds_limit) %></label> -<%= text_field_tag 'settings[feeds_limit]', Setting.feeds_limit, :size => 6 %></p> - -<p><label><%= l(:setting_autofetch_changesets) %></label> -<%= check_box_tag 'settings[autofetch_changesets]', 1, Setting.autofetch_changesets? %><%= hidden_field_tag 'settings[autofetch_changesets]', 0 %></p> - -<p><label><%= l(:setting_sys_api_enabled) %></label> -<%= check_box_tag 'settings[sys_api_enabled]', 1, Setting.sys_api_enabled? %><%= hidden_field_tag 'settings[sys_api_enabled]', 0 %></p> - -<p><label><%= l(:setting_repositories_encodings) %></label> -<%= text_field_tag 'settings[repositories_encodings]', Setting.repositories_encodings, :size => 60 %><br /><em><%= l(:text_comma_separated) %></em></p> +<div class="tabs"> + <ul> + <% administration_settings_tabs.each do |tab| -%> + <li><%= link_to l(tab[:label]), {}, :id => "tab-#{tab[:name]}", :onclick => "showTab('#{tab[:name]}'); this.blur(); return false;" %></li> + <% end -%> + </ul> </div> -<fieldset class="box"><legend><%= l(:setting_issue_list_default_columns) %></legend> -<%= hidden_field_tag 'settings[issue_list_default_columns][]', '' %> -<p><% Query.new.available_columns.each do |column| %> - <label><%= check_box_tag 'settings[issue_list_default_columns][]', column.name, Setting.issue_list_default_columns.include?(column.name.to_s) %> - <%= column.caption %></label> -<% end %></p> -</fieldset> - -<fieldset class="box tabular"><legend><%= l(:label_authentication) %></legend> -<p><label><%= l(:setting_login_required) %></label> -<%= check_box_tag 'settings[login_required]', 1, Setting.login_required? %><%= hidden_field_tag 'settings[login_required]', 0 %></p> - -<p><label><%= l(:setting_autologin) %></label> -<%= select_tag 'settings[autologin]', options_for_select( [[l(:label_disabled), "0"]] + [1, 7, 30, 365].collect{|days| [lwr(:actionview_datehelper_time_in_words_day, days), days.to_s]}, Setting.autologin) %></p> - -<p><label><%= l(:setting_self_registration) %></label> -<%= select_tag 'settings[self_registration]', - options_for_select( [[l(:label_disabled), "0"], - [l(:label_registration_activation_by_email), "1"], - [l(:label_registration_manual_activation), "2"], - [l(:label_registration_automatic_activation), "3"] - ], Setting.self_registration ) %></p> - -<p><label><%= l(:label_password_lost) %></label> -<%= check_box_tag 'settings[lost_password]', 1, Setting.lost_password? %><%= hidden_field_tag 'settings[lost_password]', 0 %></p> -</fieldset> - -<fieldset class="box tabular"><legend><%= l(:text_issues_ref_in_commit_messages) %></legend> -<p><label><%= l(:setting_commit_ref_keywords) %></label> -<%= text_field_tag 'settings[commit_ref_keywords]', Setting.commit_ref_keywords, :size => 30 %><br /><em><%= l(:text_comma_separated) %></em></p> - -<p><label><%= l(:setting_commit_fix_keywords) %></label> -<%= text_field_tag 'settings[commit_fix_keywords]', Setting.commit_fix_keywords, :size => 30 %> - <%= l(:label_applied_status) %>: <%= select_tag 'settings[commit_fix_status_id]', options_for_select( [["", 0]] + IssueStatus.find(:all).collect{|status| [status.name, status.id.to_s]}, Setting.commit_fix_status_id) %> - <%= l(:field_done_ratio) %>: <%= select_tag 'settings[commit_fix_done_ratio]', options_for_select( [[l(:label_no_change_option), '']] + ((0..10).to_a.collect {|r| ["#{r*10} %", "#{r*10}"] }), Setting.commit_fix_done_ratio) %> -<br /><em><%= l(:text_comma_separated) %></em></p> -</fieldset> - -<%= submit_tag l(:button_save) %> +<% administration_settings_tabs.each do |tab| %> + <%= content_tag('div', render(:partial => tab[:partial]), :id => "tab-content-#{tab[:name]}", :class => 'tab-content') %> <% end %> -<% html_title(l(:label_settings)) -%> +<%= tab = params[:tab] ? h(params[:tab]) : administration_settings_tabs.first[:name] +javascript_tag "showTab('#{tab}');" %> + +<% html_title(l(:label_settings), l(:label_administration)) -%> |