From: Jean-Philippe Lang Date: Sun, 3 Jul 2011 12:28:54 +0000 (+0000) Subject: Do not show 'Send information' checkbox if email delivery is not configured. X-Git-Tag: 1.3.0~1747 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=37aba18c8f1e7af58aaaf0a95a61e55bb9f2bbb5;p=redmine.git 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 --- 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 ') 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? -%>

<% end -%>

<%= submit_tag l(:button_save) %>

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

+ <% end %>

<%= submit_tag l(:button_create) %> <%= submit_tag l(:button_create_and_continue), :name => 'continue' %>