Mailer#url_for not called in views with Rails 3.1.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9023 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2012-02-27 20:43:25 +00:00
parent 7056649a4b
commit e6b9ddad18
10 changed files with 17 additions and 21 deletions

View File

@ -99,7 +99,7 @@ module ApplicationHelper
action = options.delete(:download) ? 'download' : 'show' action = options.delete(:download) ? 'download' : 'show'
link_to(h(text), link_to(h(text),
{:controller => 'attachments', :action => action, {:controller => 'attachments', :action => action,
:id => attachment, :filename => attachment.filename }, :id => attachment, :filename => attachment.filename }.merge(options),
options) options)
end end

View File

@ -163,7 +163,8 @@ module IssuesHelper
# Returns the textual representation of a journal details # Returns the textual representation of a journal details
# as an array of strings # as an array of strings
def details_to_strings(details, no_html=false) def details_to_strings(details, no_html=false, options={})
options[:only_path] = (options[:only_path] == false ? false : true)
strings = [] strings = []
values_by_field = {} values_by_field = {}
details.each do |detail| details.each do |detail|
@ -181,23 +182,23 @@ module IssuesHelper
next next
end end
end end
strings << show_detail(detail, no_html) strings << show_detail(detail, no_html, options)
end end
values_by_field.each do |field_id, changes| values_by_field.each do |field_id, changes|
detail = JournalDetail.new(:property => 'cf', :prop_key => field_id) detail = JournalDetail.new(:property => 'cf', :prop_key => field_id)
if changes[:added].any? if changes[:added].any?
detail.value = changes[:added] detail.value = changes[:added]
strings << show_detail(detail, no_html) strings << show_detail(detail, no_html, options)
elsif changes[:deleted].any? elsif changes[:deleted].any?
detail.old_value = changes[:deleted] detail.old_value = changes[:deleted]
strings << show_detail(detail, no_html) strings << show_detail(detail, no_html, options)
end end
end end
strings strings
end end
# Returns the textual representation of a single journal detail # Returns the textual representation of a single journal detail
def show_detail(detail, no_html=false) def show_detail(detail, no_html=false, options={})
multiple = false multiple = false
case detail.property case detail.property
when 'attr' when 'attr'
@ -250,7 +251,7 @@ module IssuesHelper
old_value = content_tag("strike", old_value) if detail.old_value and detail.value.blank? old_value = content_tag("strike", old_value) if detail.old_value and detail.value.blank?
if detail.property == 'attachment' && !value.blank? && a = Attachment.find_by_id(detail.prop_key) if detail.property == 'attachment' && !value.blank? && a = Attachment.find_by_id(detail.prop_key)
# Link to the attachment if it has not been removed # Link to the attachment if it has not been removed
value = link_to_attachment(a, :download => true) value = link_to_attachment(a, :download => true, :only_path => options[:only_path])
else else
value = content_tag("i", h(value)) if value value = content_tag("i", h(value)) if value
end end
@ -260,7 +261,7 @@ module IssuesHelper
s = l(:text_journal_changed_no_detail, :label => label) s = l(:text_journal_changed_no_detail, :label => label)
unless no_html unless no_html
diff_link = link_to 'diff', diff_link = link_to 'diff',
{:controller => 'journals', :action => 'diff', :id => detail.journal_id, :detail_id => detail.id}, {:controller => 'journals', :action => 'diff', :id => detail.journal_id, :detail_id => detail.id, :only_path => options[:only_path]},
:title => l(:label_view_diff) :title => l(:label_view_diff)
s << " (#{ diff_link })" s << " (#{ diff_link })"
end end

View File

@ -30,11 +30,6 @@ class Mailer < ActionMailer::Base
{ :host => h, :protocol => Setting.protocol } { :host => h, :protocol => Setting.protocol }
end end
def url_for(options)
options[:only_path] = false if options.is_a?(Hash)
super options
end
# Builds a tmail object used to email recipients of the added issue. # Builds a tmail object used to email recipients of the added issue.
# #
# Example: # Example:

View File

@ -12,4 +12,4 @@
<% end %> <% end %>
</ul> </ul>
<%= textilizable(issue, :description) %> <%= textilizable(issue, :description, :only_path => false) %>

View File

@ -1,3 +1,3 @@
<%= link_to(h(@document.title), @document_url) %> (<%=h @document.category.name %>)<br /> <%= link_to(h(@document.title), @document_url) %> (<%=h @document.category.name %>)<br />
<br /> <br />
<%= textilizable(@document, :description) %> <%= textilizable(@document, :description, :only_path => false) %>

View File

@ -1,11 +1,11 @@
<%= l(:text_issue_updated, :id => "##{@issue.id}", :author => h(@journal.user)) %> <%= l(:text_issue_updated, :id => "##{@issue.id}", :author => h(@journal.user)) %>
<ul> <ul>
<% details_to_strings(@journal.details).each do |string| %> <% details_to_strings(@journal.details, false, :only_path => false).each do |string| %>
<li><%= string %></li> <li><%= string %></li>
<% end %> <% end %>
</ul> </ul>
<%= textilizable(@journal, :notes) %> <%= textilizable(@journal, :notes, :only_path => false) %>
<hr /> <hr />
<%= render :partial => "issue.html.erb", :locals => { :issue => @issue, :issue_url => @issue_url } %> <%= render :partial => "issue.html.erb", :locals => { :issue => @issue, :issue_url => @issue_url } %>

View File

@ -1,4 +1,4 @@
<h1><%=h @message.board.project.name %> - <%=h @message.board.name %>: <%= link_to(h(@message.subject), @message_url) %></h1> <h1><%=h @message.board.project.name %> - <%=h @message.board.name %>: <%= link_to(h(@message.subject), @message_url) %></h1>
<em><%=h @message.author %></em> <em><%=h @message.author %></em>
<%= textilizable(@message, :content) %> <%= textilizable(@message, :content, :only_path => false) %>

View File

@ -1,4 +1,4 @@
<h1><%= link_to(h(@news.title), @news_url) %></h1> <h1><%= link_to(h(@news.title), @news_url) %></h1>
<em><%=h @news.author.name %></em> <em><%=h @news.author.name %></em>
<%= textilizable(@news, :description) %> <%= textilizable(@news, :description, :only_path => false) %>

View File

@ -2,4 +2,4 @@
<p><%= l(:text_user_wrote, :value => h(@comment.author)) %></p> <p><%= l(:text_user_wrote, :value => h(@comment.author)) %></p>
<%= textilizable @comment, :comments %> <%= textilizable @comment, :comments, :only_path => false %>

View File

@ -2,7 +2,7 @@
<ul> <ul>
<% @issues.each do |issue| -%> <% @issues.each do |issue| -%>
<li><%=h issue.project %> - <%=link_to(h("#{issue.tracker} ##{issue.id}"), :controller => 'issues', :action => 'show', :id => issue)%>: <%=h issue.subject %></li> <li><%=h issue.project %> - <%=link_to(h("#{issue.tracker} ##{issue.id}"), :controller => 'issues', :action => 'show', :id => issue, :only_path => false)%>: <%=h issue.subject %></li>
<% end -%> <% end -%>
</ul> </ul>