From a80dbc49b1670877aca09b11101d4a5b40ea58c2 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Sun, 6 Jan 2008 20:24:26 +0000 Subject: [PATCH] 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 --- app/controllers/admin_controller.rb | 13 +- app/controllers/settings_controller.rb | 13 +- app/helpers/settings_helper.rb | 8 ++ app/views/admin/index.rhtml | 8 -- app/views/settings/_authentication.rhtml | 27 +++++ app/views/settings/_general.rhtml | 46 ++++++++ app/views/settings/_issues.rhtml | 20 ++++ .../_notifications.rhtml} | 19 ++- app/views/settings/_repositories.rhtml | 26 ++++ app/views/settings/edit.rhtml | 111 ++---------------- lang/bg.yml | 2 + lang/cs.yml | 2 + lang/de.yml | 2 + lang/en.yml | 2 + lang/es.yml | 2 + lang/fr.yml | 2 + lang/he.yml | 2 + lang/it.yml | 2 + lang/ja.yml | 2 + lang/ko.yml | 2 + lang/nl.yml | 2 + lang/pl.yml | 2 + lang/pt-br.yml | 2 + lang/pt.yml | 2 + lang/ro.yml | 2 + lang/ru.yml | 2 + lang/sr.yml | 2 + lang/sv.yml | 2 + lang/zh-tw.yml | 2 + lang/zh.yml | 2 + test/functional/admin_controller_test.rb | 14 +-- test/functional/settings_controller_test.rb | 53 +++++++++ 32 files changed, 252 insertions(+), 146 deletions(-) create mode 100644 app/views/settings/_authentication.rhtml create mode 100644 app/views/settings/_general.rhtml create mode 100644 app/views/settings/_issues.rhtml rename app/views/{admin/mail_options.rhtml => settings/_notifications.rhtml} (72%) create mode 100644 app/views/settings/_repositories.rhtml create mode 100644 test/functional/settings_controller_test.rb 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' %>

-

-<%= link_to l(:field_mail_notification), :controller => 'admin', :action => 'mail_options' %> -

- -

-<%= link_to l(:label_authentication), :controller => 'auth_sources' %> -

-

<%= link_to l(:label_settings), :controller => 'settings' %>

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 %> + +
+

+<%= check_box_tag 'settings[login_required]', 1, Setting.login_required? %><%= hidden_field_tag 'settings[login_required]', 0 %>

+ +

+<%= 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) %>

+ +

+<%= 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 ) %>

+ +

+<%= check_box_tag 'settings[lost_password]', 1, Setting.lost_password? %><%= hidden_field_tag 'settings[lost_password]', 0 %>

+
+ +
+ <%= link_to 'Manage LDAP authentication...', :controller => 'auth_sources', :action => 'list' %> +
+ +<%= 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 %> + +
+

+<%= text_field_tag 'settings[app_title]', Setting.app_title, :size => 30 %>

+ +

+<%= text_area_tag 'settings[welcome_text]', Setting.welcome_text, :cols => 60, :rows => 5, :class => 'wiki-edit' %>

+<%= wikitoolbar_for 'settings[welcome_text]' %> + +

+<%= select_tag 'settings[ui_theme]', options_for_select( ([[l(:label_default), '']] + Redmine::Themes.themes.collect {|t| [t.name, t.id]}), Setting.ui_theme) %>

+ +

+<%= select_tag 'settings[default_language]', options_for_select( lang_options_for_select(false), Setting.default_language) %>

+ +

+<%= 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) %>

+ +

+<%= 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) %>

+ +

+<%= text_field_tag 'settings[attachment_max_size]', Setting.attachment_max_size, :size => 6 %> KB

+ +

+<%= text_field_tag 'settings[per_page_options]', Setting.per_page_options_array.join(', '), :size => 20 %>
<%= l(:text_comma_separated) %>

+ +

+<%= text_field_tag 'settings[host_name]', Setting.host_name, :size => 60 %>

+ +

+<%= select_tag 'settings[protocol]', options_for_select(['http', 'https'], Setting.protocol) %>

+ +

+<%= select_tag 'settings[text_formatting]', options_for_select([[l(:label_none), "0"], ["textile", "textile"]], Setting.text_formatting) %>

+ +

+<%= select_tag 'settings[wiki_compression]', options_for_select( [[l(:label_none), 0], ["gzip", "gzip"]], Setting.wiki_compression) %>

+ +

+<%= text_field_tag 'settings[feeds_limit]', Setting.feeds_limit, :size => 6 %>

+
+ +<%= 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 %> + +
+

+<%= check_box_tag 'settings[cross_project_issue_relations]', 1, Setting.cross_project_issue_relations? %><%= hidden_field_tag 'settings[cross_project_issue_relations]', 0 %>

+ +

+<%= text_field_tag 'settings[issues_export_limit]', Setting.issues_export_limit, :size => 6 %>

+
+ +
<%= l(:setting_issue_list_default_columns) %> +<%= hidden_field_tag 'settings[issue_list_default_columns][]', '' %> +

<% Query.new.available_columns.each do |column| %> + +<% end %>

+
+ +<%= submit_tag l(:button_save) %> +<% end %> diff --git a/app/views/admin/mail_options.rhtml b/app/views/settings/_notifications.rhtml similarity index 72% rename from app/views/admin/mail_options.rhtml rename to 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 @@ -
-<%= link_to l(:label_send_test_email), :action => 'test_email' %> -
- -

<%=l(:field_mail_notification)%>

+<% form_tag({:action => 'edit', :tab => 'notifications'}) do %> -<% form_tag({:action => 'mail_options'}, :id => 'mail-options-form') do %> - -
<%=l(:label_settings)%> +

<%= text_field_tag 'settings[mail_from]', Setting.mail_from, :size => 60 %>

<%= check_box_tag 'settings[bcc_recipients]', 1, Setting.bcc_recipients? %> <%= hidden_field_tag 'settings[bcc_recipients]', 0 %>

-
+
<%=l(:text_select_mail_notifications)%> <% @notifiables.each do |notifiable| %>
<% end %> +<%= hidden_field_tag 'settings[notified_events][]', '' %>

<%= check_all_links('mail-options-form') %>

@@ -27,7 +22,9 @@ <%= text_area_tag 'settings[emails_footer]', Setting.emails_footer, :class => 'wiki-edit', :rows => 5 %> +
+<%= link_to l(:label_send_test_email), :controller => 'admin', :action => 'test_email' %> +
+ <%= 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 %> + +
+

+<%= check_box_tag 'settings[autofetch_changesets]', 1, Setting.autofetch_changesets? %><%= hidden_field_tag 'settings[autofetch_changesets]', 0 %>

+ +

+<%= check_box_tag 'settings[sys_api_enabled]', 1, Setting.sys_api_enabled? %><%= hidden_field_tag 'settings[sys_api_enabled]', 0 %>

+ +

+<%= text_field_tag 'settings[repositories_encodings]', Setting.repositories_encodings, :size => 60 %>
<%= l(:text_comma_separated) %>

+
+ +
<%= l(:text_issues_ref_in_commit_messages) %> +

+<%= text_field_tag 'settings[commit_ref_keywords]', Setting.commit_ref_keywords, :size => 30 %>
<%= l(:text_comma_separated) %>

+ +

+<%= 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) %> +
<%= l(:text_comma_separated) %>

+
+ +<%= 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 @@

<%= l(:label_settings) %>

-<% form_tag({:action => 'edit'}) do %> -
-

-<%= text_field_tag 'settings[app_title]', Setting.app_title, :size => 30 %>

- -

-<%= text_field_tag 'settings[app_subtitle]', Setting.app_subtitle, :size => 60 %>

- -

-<%= text_area_tag 'settings[welcome_text]', Setting.welcome_text, :cols => 60, :rows => 5, :class => 'wiki-edit' %>

-<%= wikitoolbar_for 'settings[welcome_text]' %> - -

-<%= select_tag 'settings[ui_theme]', options_for_select( ([[l(:label_default), '']] + Redmine::Themes.themes.collect {|t| [t.name, t.id]}), Setting.ui_theme) %>

- -

-<%= select_tag 'settings[default_language]', options_for_select( lang_options_for_select(false), Setting.default_language) %>

- -

-<%= 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) %>

- -

-<%= 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) %>

- -

-<%= text_field_tag 'settings[attachment_max_size]', Setting.attachment_max_size, :size => 6 %> KB

- -

-<%= text_field_tag 'settings[per_page_options]', Setting.per_page_options_array.join(', '), :size => 20 %>
<%= l(:text_comma_separated) %>

- -

-<%= text_field_tag 'settings[issues_export_limit]', Setting.issues_export_limit, :size => 6 %>

- -

-<%= check_box_tag 'settings[cross_project_issue_relations]', 1, Setting.cross_project_issue_relations? %><%= hidden_field_tag 'settings[cross_project_issue_relations]', 0 %>

- -

-<%= text_field_tag 'settings[host_name]', Setting.host_name, :size => 60 %>

- -

-<%= select_tag 'settings[protocol]', options_for_select(['http', 'https'], Setting.protocol) %>

- -

-<%= select_tag 'settings[text_formatting]', options_for_select([[l(:label_none), "0"], ["textile", "textile"]], Setting.text_formatting) %>

- -

-<%= select_tag 'settings[wiki_compression]', options_for_select( [[l(:label_none), 0], ["gzip", "gzip"]], Setting.wiki_compression) %>

- -

-<%= text_field_tag 'settings[feeds_limit]', Setting.feeds_limit, :size => 6 %>

- -

-<%= check_box_tag 'settings[autofetch_changesets]', 1, Setting.autofetch_changesets? %><%= hidden_field_tag 'settings[autofetch_changesets]', 0 %>

- -

-<%= check_box_tag 'settings[sys_api_enabled]', 1, Setting.sys_api_enabled? %><%= hidden_field_tag 'settings[sys_api_enabled]', 0 %>

- -

-<%= text_field_tag 'settings[repositories_encodings]', Setting.repositories_encodings, :size => 60 %>
<%= l(:text_comma_separated) %>

+
+
    + <% administration_settings_tabs.each do |tab| -%> +
  • <%= link_to l(tab[:label]), {}, :id => "tab-#{tab[:name]}", :onclick => "showTab('#{tab[:name]}'); this.blur(); return false;" %>
  • + <% end -%> +
-
<%= l(:setting_issue_list_default_columns) %> -<%= hidden_field_tag 'settings[issue_list_default_columns][]', '' %> -

<% Query.new.available_columns.each do |column| %> - -<% end %>

-
- -
<%= l(:label_authentication) %> -

-<%= check_box_tag 'settings[login_required]', 1, Setting.login_required? %><%= hidden_field_tag 'settings[login_required]', 0 %>

- -

-<%= 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) %>

- -

-<%= 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 ) %>

- -

-<%= check_box_tag 'settings[lost_password]', 1, Setting.lost_password? %><%= hidden_field_tag 'settings[lost_password]', 0 %>

-
- -
<%= l(:text_issues_ref_in_commit_messages) %> -

-<%= text_field_tag 'settings[commit_ref_keywords]', Setting.commit_ref_keywords, :size => 30 %>
<%= l(:text_comma_separated) %>

- -

-<%= 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) %> -
<%= l(:text_comma_separated) %>

-
- -<%= 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)) -%> diff --git a/lang/bg.yml b/lang/bg.yml index 57e7fd22d..ae5630ecf 100644 --- a/lang/bg.yml +++ b/lang/bg.yml @@ -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 diff --git a/lang/cs.yml b/lang/cs.yml index 5cbf1133d..813dade3f 100644 --- a/lang/cs.yml +++ b/lang/cs.yml @@ -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 diff --git a/lang/de.yml b/lang/de.yml index ba3dcda5b..660289768 100644 --- a/lang/de.yml +++ b/lang/de.yml @@ -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 diff --git a/lang/en.yml b/lang/en.yml index eae61d7bf..eec7702b7 100644 --- a/lang/en.yml +++ b/lang/en.yml @@ -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 diff --git a/lang/es.yml b/lang/es.yml index 1a3af0f5c..37821e129 100644 --- a/lang/es.yml +++ b/lang/es.yml @@ -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 diff --git a/lang/fr.yml b/lang/fr.yml index ff2bf792f..841f132d4 100644 --- a/lang/fr.yml +++ b/lang/fr.yml @@ -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 diff --git a/lang/he.yml b/lang/he.yml index d110ee8bf..666675e75 100644 --- a/lang/he.yml +++ b/lang/he.yml @@ -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 diff --git a/lang/it.yml b/lang/it.yml index bb9440ffd..24e39955a 100644 --- a/lang/it.yml +++ b/lang/it.yml @@ -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 diff --git a/lang/ja.yml b/lang/ja.yml index e4c13b34c..d68013296 100644 --- a/lang/ja.yml +++ b/lang/ja.yml @@ -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 diff --git a/lang/ko.yml b/lang/ko.yml index 790598b8d..aad58d188 100644 --- a/lang/ko.yml +++ b/lang/ko.yml @@ -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 diff --git a/lang/nl.yml b/lang/nl.yml index 2e18a6b7c..44633e4b4 100644 --- a/lang/nl.yml +++ b/lang/nl.yml @@ -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 diff --git a/lang/pl.yml b/lang/pl.yml index 0ee0e3792..511bbe81a 100644 --- a/lang/pl.yml +++ b/lang/pl.yml @@ -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 diff --git a/lang/pt-br.yml b/lang/pt-br.yml index 21d21b793..684b51daa 100644 --- a/lang/pt-br.yml +++ b/lang/pt-br.yml @@ -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 diff --git a/lang/pt.yml b/lang/pt.yml index c7f05f8c8..0ce2d3471 100644 --- a/lang/pt.yml +++ b/lang/pt.yml @@ -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 diff --git a/lang/ro.yml b/lang/ro.yml index 6ebc3b0e5..95e0ea318 100644 --- a/lang/ro.yml +++ b/lang/ro.yml @@ -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 diff --git a/lang/ru.yml b/lang/ru.yml index 569e96884..fba18462e 100644 --- a/lang/ru.yml +++ b/lang/ru.yml @@ -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 diff --git a/lang/sr.yml b/lang/sr.yml index 1d4f52539..ece6cf6e2 100644 --- a/lang/sr.yml +++ b/lang/sr.yml @@ -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 diff --git a/lang/sv.yml b/lang/sv.yml index 75f297c20..cf1e760f9 100644 --- a/lang/sv.yml +++ b/lang/sv.yml @@ -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 diff --git a/lang/zh-tw.yml b/lang/zh-tw.yml index 5bf47d943..97b31225b 100644 --- a/lang/zh-tw.yml +++ b/lang/zh-tw.yml @@ -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 diff --git a/lang/zh.yml b/lang/zh.yml index 16f4c7195..2d537b250 100644 --- a/lang/zh.yml +++ b/lang/zh.yml @@ -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 diff --git a/test/functional/admin_controller_test.rb b/test/functional/admin_controller_test.rb index 742c1f6bb..05205b399 100644 --- a/test/functional/admin_controller_test.rb +++ b/test/functional/admin_controller_test.rb @@ -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 index 000000000..0e919a741 --- /dev/null +++ b/test/functional/settings_controller_test.rb @@ -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 -- 2.39.5