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
This commit is contained in:
Jean-Philippe Lang 2011-07-03 12:28:54 +00:00
parent 5b648a7dae
commit 37aba18c8f
3 changed files with 7 additions and 1 deletions

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

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

View 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' %>