summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2011-07-03 12:28:54 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2011-07-03 12:28:54 +0000
commit37aba18c8f1e7af58aaaf0a95a61e55bb9f2bbb5 (patch)
tree1971fffad9aa5aa283e0b0896ab58714fe98c324
parent5b648a7daed924f59a119d90e42867b01ca2a10e (diff)
downloadredmine-37aba18c8f1e7af58aaaf0a95a61e55bb9f2bbb5.tar.gz
redmine-37aba18c8f1e7af58aaaf0a95a61e55bb9f2bbb5.zip
Do not show 'Send information' checkbox if email delivery is not configured.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@6167 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r--app/helpers/application_helper.rb4
-rw-r--r--app/views/users/_general.rhtml2
-rw-r--r--app/views/users/new.html.erb2
3 files changed, 7 insertions, 1 deletions
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index f6b1b2bf7..a1832882e 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -871,6 +871,10 @@ module ApplicationHelper
def has_content?(name)
(@has_content && @has_content[name]) || false
end
+
+ def email_delivery_enabled?
+ !!ActionMailer::Base.perform_deliveries
+ end
# Returns the avatar image tag for the given +user+ if avatars are enabled
# +user+ can be a User or a string that will be scanned for an email address (eg. 'joe <joe@foo.bar>')
diff --git a/app/views/users/_general.rhtml b/app/views/users/_general.rhtml
index 7e90ab2c2..193fcdde5 100644
--- a/app/views/users/_general.rhtml
+++ b/app/views/users/_general.rhtml
@@ -1,6 +1,6 @@
<% labelled_tabular_form_for :user, @user, :url => { :controller => 'users', :action => "update", :tab => nil }, :html => { :method => :put, :class => nil } do |f| %>
<%= render :partial => 'form', :locals => { :f => f } %>
- <% if @user.active? -%>
+ <% if @user.active? && email_delivery_enabled? -%>
<p><label><%= check_box_tag 'send_information', 1, true %> <%= l(:label_send_information) %></label></p>
<% end -%>
<p><%= submit_tag l(:button_save) %></p>
diff --git a/app/views/users/new.html.erb b/app/views/users/new.html.erb
index 0e7a33319..47cfd8a09 100644
--- a/app/views/users/new.html.erb
+++ b/app/views/users/new.html.erb
@@ -2,7 +2,9 @@
<% labelled_tabular_form_for :user, @user, :url => { :action => "create" }, :html => { :class => nil } do |f| %>
<%= render :partial => 'form', :locals => { :f => f } %>
+ <% if email_delivery_enabled? %>
<p><label><%= check_box_tag 'send_information', 1, true %> <%= l(:label_send_information) %></label></p>
+ <% end %>
<p>
<%= submit_tag l(:button_create) %>
<%= submit_tag l(:button_create_and_continue), :name => 'continue' %>