]> source.dussan.org Git - redmine.git/commitdiff
Admin settings screen split to tabs.
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Sun, 6 Jan 2008 20:24:26 +0000 (20:24 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Sun, 6 Jan 2008 20:24:26 +0000 (20:24 +0000)
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

33 files changed:
app/controllers/admin_controller.rb
app/controllers/settings_controller.rb
app/helpers/settings_helper.rb
app/views/admin/index.rhtml
app/views/admin/mail_options.rhtml [deleted file]
app/views/settings/_authentication.rhtml [new file with mode: 0644]
app/views/settings/_general.rhtml [new file with mode: 0644]
app/views/settings/_issues.rhtml [new file with mode: 0644]
app/views/settings/_notifications.rhtml [new file with mode: 0644]
app/views/settings/_repositories.rhtml [new file with mode: 0644]
app/views/settings/edit.rhtml
lang/bg.yml
lang/cs.yml
lang/de.yml
lang/en.yml
lang/es.yml
lang/fr.yml
lang/he.yml
lang/it.yml
lang/ja.yml
lang/ko.yml
lang/nl.yml
lang/pl.yml
lang/pt-br.yml
lang/pt.yml
lang/ro.yml
lang/ru.yml
lang/sr.yml
lang/sv.yml
lang/zh-tw.yml
lang/zh.yml
test/functional/admin_controller_test.rb
test/functional/settings_controller_test.rb [new file with mode: 0644]

index 9e6a228225b740ee891c430b6e63b36728a28e81..e002f3a27fd3da8d16559ad815724c4b0c9cc63a 100644 (file)
@@ -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
index 09af63176e8c05a19e58a899329b5a31cdfe060c..c5fae2a1699d1ea426fd61548bb7c3d372f25c74 100644 (file)
@@ -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
   
index f53314c40b771e198f974d47110134ead520805b..f4ec5a7a74c7b69b857397ac9ad33892a499eb1f 100644 (file)
 # 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
index 2291c5415b755ff75b1b87e7295719eb781966d3..18bee34cb3fce0829068ac4e5beb58d4cde18f78 100644 (file)
 <%= 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/admin/mail_options.rhtml b/app/views/admin/mail_options.rhtml
deleted file mode 100644 (file)
index 698933b..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-<div class="contextual">
-<%= link_to l(:label_send_test_email), :action => 'test_email' %>
-</div>
-
-<h2><%=l(:field_mail_notification)%></h2>
-
-<% form_tag({:action => 'mail_options'}, :id => 'mail-options-form') do %>
-
-<fieldset class="box tabular settings"><legend><%=l(:label_settings)%></legend>
-<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>
-
-<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 %>
-<p><%= check_all_links('mail-options-form') %></p>
-</fieldset>
-
-<fieldset class="box"><legend><%= l(:setting_emails_footer) %></legend>
-<%= text_area_tag 'settings[emails_footer]', Setting.emails_footer, :class => 'wiki-edit', :rows => 5 %>
-</fieldset>
-
-<%= submit_tag l(:button_save) %>
-<% end %>
-
-<% html_title(l(:field_mail_notification)) -%>
diff --git a/app/views/settings/_authentication.rhtml b/app/views/settings/_authentication.rhtml
new file mode 100644 (file)
index 0000000..a8fa63f
--- /dev/null
@@ -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 (file)
index 0000000..514e62b
--- /dev/null
@@ -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 (file)
index 0000000..36c604f
--- /dev/null
@@ -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/settings/_notifications.rhtml b/app/views/settings/_notifications.rhtml
new file mode 100644 (file)
index 0000000..ca04352
--- /dev/null
@@ -0,0 +1,30 @@
+<% form_tag({:action => 'edit', :tab => 'notifications'}) do %>
+
+<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>
+</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>
+
+<fieldset class="box"><legend><%= l(:setting_emails_footer) %></legend>
+<%= 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 %>
diff --git a/app/views/settings/_repositories.rhtml b/app/views/settings/_repositories.rhtml
new file mode 100644 (file)
index 0000000..59b3b51
--- /dev/null
@@ -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 %>
+&nbsp;<%= 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) %>
+&nbsp;<%= 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 %>
index b1762a0e325852447e66c0103e957943f878c204..c7b47b6d0c5bc92e0e7798ab6617c974ff2f24df 100644 (file)
 <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 %>
-&nbsp;<%= 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) %>
-&nbsp;<%= 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)) -%>
index 57e7fd22dfa87844e4a67fc6b30e5dc97ee08551..ae5630ecfa03c8a6759ad8f9a62eb84afea504aa 100644 (file)
@@ -559,3 +559,5 @@ text_no_configuration_data: "Roles, trackers, issue statuses and workflow have n
 error_can_t_load_default_data: "Default configuration could not be loaded: %s"
 button_update: Update
 label_change_properties: Change properties
+label_general: General
+label_repository_plural: Repositories
index 5cbf1133d4c13a19d0be91460ca449f3620c04ab..813dade3f1d8c7e7a19f3de847bc5bd8c18e445b 100644 (file)
@@ -559,3 +559,5 @@ text_no_configuration_data: "Roles, trackers, issue statuses and workflow have n
 error_can_t_load_default_data: "Default configuration could not be loaded: %s"
 button_update: Update
 label_change_properties: Change properties
+label_general: General
+label_repository_plural: Repositories
index ba3dcda5bed75fd306ff5cda2ea7dc933ee0e0d6..66028976837a73fcca2f5a400fbf5b83ed949c34 100644 (file)
@@ -559,3 +559,5 @@ text_no_configuration_data: "Roles, trackers, issue statuses and workflow have n
 error_can_t_load_default_data: "Default configuration could not be loaded: %s"
 button_update: Update
 label_change_properties: Change properties
+label_general: General
+label_repository_plural: Repositories
index eae61d7bff0c2f31ee66f30f152b824991cef130..eec7702b7968917a53d001c258cfb7450066d9ee 100644 (file)
@@ -353,6 +353,7 @@ label_contains: contains
 label_not_contains: doesn't contain
 label_day_plural: days
 label_repository: Repository
+label_repository_plural: Repositories
 label_browse: Browse
 label_modification: %d change
 label_modification_plural: %d changes
@@ -463,6 +464,7 @@ label_registration_automatic_activation: automatic account activation
 label_display_per_page: 'Per page: %s'
 label_age: Age
 label_change_properties: Change properties
+label_general: General
 
 button_login: Login
 button_submit: Submit
index 1a3af0f5cea2d5575ea82850d7c73afb0a75f811..37821e1295f09a9163ac7f10059bd7a92162bb6f 100644 (file)
@@ -562,3 +562,5 @@ text_no_configuration_data: "Roles, trackers, issue statuses and workflow have n
 error_can_t_load_default_data: "Default configuration could not be loaded: %s"
 button_update: Update
 label_change_properties: Change properties
+label_general: General
+label_repository_plural: Repositories
index ff2bf792f08afa327a5423f9e7a9a322f95fab21..841f132d406ac414f62f6d1ffba0bdc72386e15a 100644 (file)
@@ -353,6 +353,7 @@ label_contains: contient
 label_not_contains: ne contient pas
 label_day_plural: jours
 label_repository: Dépôt
+label_repository_plural: Dépôts
 label_browse: Parcourir
 label_modification: %d modification
 label_modification_plural: %d modifications
@@ -463,6 +464,7 @@ label_registration_automatic_activation: activation automatique du compte
 label_display_per_page: 'Par page: %s'
 label_age: Age
 label_change_properties: Changer les propriétés
+label_general: Général
 
 button_login: Connexion
 button_submit: Soumettre
index d110ee8bfa7bdf4c7d0e556ff762b652182b2ab2..666675e753cd224ad1177bb3d165675a8aa189fa 100644 (file)
@@ -559,3 +559,5 @@ text_no_configuration_data: "Roles, trackers, issue statuses and workflow have n
 error_can_t_load_default_data: "Default configuration could not be loaded: %s"
 button_update: Update
 label_change_properties: Change properties
+label_general: General
+label_repository_plural: Repositories
index bb9440ffd139e89ffe1ffb27be2b11d8761b61f0..24e39955aa4542cb5a9feb148f39e40f58fc71e9 100644 (file)
@@ -559,3 +559,5 @@ text_no_configuration_data: "Roles, trackers, issue statuses and workflow have n
 error_can_t_load_default_data: "Default configuration could not be loaded: %s"
 button_update: Update
 label_change_properties: Change properties
+label_general: General
+label_repository_plural: Repositories
index e4c13b34cbbd8990b248f30fea54675aad91711d..d68013296469651588f3167af6a7e2ec6ba545a1 100644 (file)
@@ -560,3 +560,5 @@ text_no_configuration_data: "Roles, trackers, issue statuses and workflow have n
 error_can_t_load_default_data: "Default configuration could not be loaded: %s"
 button_update: Update
 label_change_properties: Change properties
+label_general: General
+label_repository_plural: Repositories
index 790598b8d6331035eb4ae6ba2533c08668ecc670..aad58d188655c0fff093f747f9c8103b8181ea1a 100644 (file)
@@ -559,3 +559,5 @@ text_no_configuration_data: "Roles, trackers, issue statuses and workflow have n
 error_can_t_load_default_data: "Default configuration could not be loaded: %s"
 button_update: Update
 label_change_properties: Change properties
+label_general: General
+label_repository_plural: Repositories
index 2e18a6b7c4053e9ea6f7d4dd3326ff0a8132aae3..44633e4b40e3fe3ae44f1d2ffec3ea5c20e90b08 100644 (file)
@@ -560,3 +560,5 @@ text_no_configuration_data: "Roles, trackers, issue statuses and workflow have n
 error_can_t_load_default_data: "Default configuration could not be loaded: %s"
 button_update: Update
 label_change_properties: Change properties
+label_general: General
+label_repository_plural: Repositories
index 0ee0e37929eea64b0a647621894d28a25a0c629f..511bbe81a82d4dfb542a50978af7fe077d897a95 100644 (file)
@@ -559,3 +559,5 @@ text_no_configuration_data: "Roles, trackers, issue statuses and workflow have n
 error_can_t_load_default_data: "Default configuration could not be loaded: %s"
 button_update: Update
 label_change_properties: Change properties
+label_general: General
+label_repository_plural: Repositories
index 21d21b793653a4130c39dade658251a71d64a703..684b51daa3e5dadf9985744bb0f239bf5fd9747e 100644 (file)
@@ -559,3 +559,5 @@ text_no_configuration_data: "Roles, trackers, issue statuses and workflow have n
 error_can_t_load_default_data: "Default configuration could not be loaded: %s"\r
 button_update: Update\r
 label_change_properties: Change properties\r
+label_general: General\r
+label_repository_plural: Repositories\r
index c7f05f8c8e8f05bc3ef6729ea54b463421f0d0a0..0ce2d3471ef221b740c4bc8a506e06f01d8f6f2e 100644 (file)
@@ -559,3 +559,5 @@ text_no_configuration_data: "Roles, trackers, issue statuses and workflow have n
 error_can_t_load_default_data: "Default configuration could not be loaded: %s"
 button_update: Update
 label_change_properties: Change properties
+label_general: General
+label_repository_plural: Repositories
index 6ebc3b0e59836add5bc9c6715cd65ac89fb7761b..95e0ea318bc42ec4852c70f6a097cbaa0db89f78 100644 (file)
@@ -559,3 +559,5 @@ text_no_configuration_data: "Roles, trackers, issue statuses and workflow have n
 error_can_t_load_default_data: "Default configuration could not be loaded: %s"
 button_update: Update
 label_change_properties: Change properties
+label_general: General
+label_repository_plural: Repositories
index 569e96884c595b297e2aba223e9c50c35bfb7352..fba18462e99f3fbc7cd8269b43004827f8ff360f 100644 (file)
@@ -559,3 +559,5 @@ text_no_configuration_data: "Roles, trackers, issue statuses and workflow have n
 error_can_t_load_default_data: "Default configuration could not be loaded: %s"
 button_update: Update
 label_change_properties: Change properties
+label_general: General
+label_repository_plural: Repositories
index 1d4f52539b18fe8bb2096d0771c67f0e9d46a073..ece6cf6e240266033f1a97b1d3059cca0630fb88 100644 (file)
@@ -560,3 +560,5 @@ text_no_configuration_data: "Roles, trackers, issue statuses and workflow have n
 error_can_t_load_default_data: "Default configuration could not be loaded: %s"
 button_update: Update
 label_change_properties: Change properties
+label_general: General
+label_repository_plural: Repositories
index 75f297c2046dfe8bf0b55105911fafb24d2c1b4b..cf1e760f96a6a40b3873e0eb34de8afb456db8db 100644 (file)
@@ -560,3 +560,5 @@ text_no_configuration_data: "Roles, trackers, issue statuses and workflow have n
 error_can_t_load_default_data: "Default configuration could not be loaded: %s"
 button_update: Update
 label_change_properties: Change properties
+label_general: General
+label_repository_plural: Repositories
index 5bf47d943a892ee3f11147465ff857b03e3852f1..97b31225b9d85424b0c4b98591165b73804972d8 100644 (file)
@@ -559,3 +559,5 @@ text_no_configuration_data: "Roles, trackers, issue statuses and workflow have n
 error_can_t_load_default_data: "Default configuration could not be loaded: %s"
 button_update: Update
 label_change_properties: Change properties
+label_general: General
+label_repository_plural: Repositories
index 16f4c71959d66b4ee89478ccb9d3d8ec46ff6a37..2d537b2506acb3a3d1ecf0bb8460eebba1320085 100644 (file)
@@ -562,3 +562,5 @@ text_no_configuration_data: "Roles, trackers, issue statuses and workflow have n
 error_can_t_load_default_data: "Default configuration could not be loaded: %s"
 button_update: Update
 label_change_properties: Change properties
+label_general: General
+label_repository_plural: Repositories
index 742c1f6bb3016a3ced34795409c25ec65df3402c..05205b39935071048a225f854606c0c825c95369 100644 (file)
@@ -51,21 +51,9 @@ class AdminControllerTest < Test::Unit::TestCase
     assert IssueStatus.find_by_name('Nouveau')
   end
   
-  def test_get_mail_options
-    get :mail_options
-    assert_response :success
-    assert_template 'mail_options'
-  end
-  
-  def test_post_mail_options
-    post :mail_options, :settings => {'mail_from' => 'functional@test.foo'}
-    assert_redirected_to 'admin/mail_options'
-    assert_equal 'functional@test.foo', Setting.mail_from
-  end
-  
   def test_test_email
     get :test_email
-    assert_redirected_to 'admin/mail_options'
+    assert_redirected_to 'settings/edit'
     mail = ActionMailer::Base.deliveries.last
     assert_kind_of TMail::Mail, mail
     user = User.find(1)
diff --git a/test/functional/settings_controller_test.rb b/test/functional/settings_controller_test.rb
new file mode 100644 (file)
index 0000000..0e919a7
--- /dev/null
@@ -0,0 +1,53 @@
+# redMine - project management software
+# Copyright (C) 2006-2007  Jean-Philippe Lang
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+
+require File.dirname(__FILE__) + '/../test_helper'
+require 'settings_controller'
+
+# Re-raise errors caught by the controller.
+class SettingsController; def rescue_action(e) raise e end; end
+
+class SettingsControllerTest < Test::Unit::TestCase
+  fixtures :users
+  
+  def setup
+    @controller = SettingsController.new
+    @request    = ActionController::TestRequest.new
+    @response   = ActionController::TestResponse.new
+    User.current = nil
+    @request.session[:user_id] = 1 # admin
+  end
+  
+  def test_get_edit
+    get :edit
+    assert_response :success
+    assert_template 'edit'
+  end
+  
+  def test_post_edit_notifications
+    post :edit, :settings => {:mail_from => 'functional@test.foo',
+                              :bcc_recipients  => '0',
+                              :notified_events => %w(issue_added issue_updated news_added),
+                              :emails_footer => 'Test footer'
+                              }
+    assert_redirected_to 'settings/edit'
+    assert_equal 'functional@test.foo', Setting.mail_from
+    assert !Setting.bcc_recipients?
+    assert_equal %w(issue_added issue_updated news_added), Setting.notified_events
+    assert_equal 'Test footer', Setting.emails_footer
+  end
+end