]> source.dussan.org Git - redmine.git/commitdiff
Do not show 'Send information' checkbox if email delivery is not configured.
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Sun, 3 Jul 2011 12:28:54 +0000 (12:28 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Sun, 3 Jul 2011 12:28:54 +0000 (12:28 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@6167 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/helpers/application_helper.rb
app/views/users/_general.rhtml
app/views/users/new.html.erb

index f6b1b2bf7043134008776b738e85eefea35beb9c..a1832882e40be4db1ba25538428c9c0a5b4643e8 100644 (file)
@@ -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>')
index 7e90ab2c24837cfe5477140a2d72626d031d9cef..193fcdde57c104662f4e488cd3e69ee756783ec6 100644 (file)
@@ -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>
index 0e7a33319eba7e325b565a6b55f4b3e51acc9fad..47cfd8a09d454ec63262ea71dedf8d75afc999e9 100644 (file)
@@ -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' %>