Project

General

Profile

Patch #11493 ยป 0006-Show-URL-to-attached-file-in-plain-text-issue-email.patch

Alex Shulgin, 2012-07-24 13:53

View differences:

app/helpers/application_helper.rb
100 100
    opt_only_path = {}
101 101
    opt_only_path[:only_path] = (options[:only_path] == false ? false : true)
102 102
    options.delete(:only_path)
103
    link_to(h(text),
104
           {:controller => 'attachments', :action => action,
105
            :id => attachment, :filename => attachment.filename}.merge(opt_only_path),
106
           options)
103
    link_to(h(text), route_to_attachment(attachment, action).merge(opt_only_path), options)
104
  end
105

  
106
  def route_to_attachment(attachment, action = 'show')
107
    { :controller => 'attachments', :action => action, :id => attachment, :filename => attachment.filename }
107 108
  end
108 109

  
109 110
  # Generates a link to a SCM revision
app/helpers/issues_helper.rb
285 285
          l(:text_journal_set_to, :label => label, :value => value).html_safe
286 286
        end
287 287
      when 'attachment'
288
        l(:text_journal_added, :label => label, :value => value).html_safe
288
        s = l(:text_journal_added, :label => label, :value => value)
289
        if no_html && !value.blank? && a = Attachment.find_by_id(detail.prop_key)
290
          s << ": " + url_for(route_to_attachment(a).merge(:only_path => false))
291
        end
292
        s.html_safe
289 293
      end
290 294
    else
291 295
      l(:text_journal_deleted, :label => label, :old => old_value).html_safe
    (1-1/1)