Project

General

Profile

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

Alex Shulgin, 2011-08-02 14:10

View differences:

app/helpers/application_helper.rb
96 96
    text = options.delete(:text) || attachment.filename
97 97
    action = options.delete(:download) ? 'download' : 'show'
98 98

  
99
    link_to(h(text), {:controller => 'attachments', :action => action, :id => attachment, :filename => attachment.filename }, options)
99
    link_to(h(text), route_to_attachment(attachment, action), options)
100
  end
101

  
102
  def route_to_attachment(attachment, action = 'show')
103
    { :controller => 'attachments', :action => action, :id => attachment, :filename => attachment.filename }
100 104
  end
101 105

  
102 106
  # Generates a link to a SCM revision
app/helpers/issues_helper.rb
233 233
          l(:text_journal_set_to, :label => label, :value => value)
234 234
        end
235 235
      when 'attachment'
236
        l(:text_journal_added, :label => label, :value => value)
236
        s = l(:text_journal_added, :label => label, :value => value)
237
        if no_html && !value.blank? && a = Attachment.find_by_id(detail.prop_key)
238
          s << ": " + url_for(route_to_attachment(a).merge(:only_path => false))
239
        end
240
        s
237 241
      end
238 242
    else
239 243
      l(:text_journal_deleted, :label => label, :old => old_value)
    (1-1/1)