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
This commit is contained in:
Jean-Philippe Lang 2008-01-06 20:24:26 +00:00
parent 78d9ae9754
commit a80dbc49b1
32 changed files with 252 additions and 146 deletions

View File

@ -46,17 +46,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)
def default_configuration
@ -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

View 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

View File

@ -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

View File

@ -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>

View File

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

View File

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

View File

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

View File

@ -1,25 +1,20 @@
<div class="contextual">
<%= link_to l(:label_send_test_email), :action => 'test_email' %>
</div>
<% form_tag({:action => 'edit', :tab => 'notifications'}) do %>
<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>
<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)) -%>

View File

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

View File

@ -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 %>
&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)) -%>

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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)

View File

@ -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