Edgewall Software
Modify

Ticket #5718 (closed enhancement: fixed)

Opened 5 years ago

Last modified 3 years ago

Add a direct "raw" download link to the attachments section of a ticket view.

Reported by: david@… Owned by: Marcin Wojdyr <wojdyr@…>
Priority: normal Milestone: 0.11.5
Component: attachment Version:
Severity: minor Keywords: attachment
Cc: wojdyr@…, vz-trac@…
Release Notes:
API Changes:

Description

When creating a bug ticket, our customers oftentimes attach project files that illustrate the problems. It would save our developers time to be able to download these attachments with one click (instead of a click, a scroll down, another click, and a back-button press).

Attachments

downloadUnrenderableAttachments.patch (632 bytes) - added by tedfordgif@… 4 years ago.
Implements enhancement described in this ticket.
downloadUnrenderableAttachments.2.patch (1.3 KB) - added by tedfordgif@… 4 years ago.
Added link to attachment lists to delete attachments (when permissions allow).
downloadUnrenderableAttachments.2.2.patch (1.3 KB) - added by Ivan 4 years ago.
d
raw-download-link.diff (760 bytes) - added by Marcin Wojdyr <wojdyr@…> 3 years ago.
one-line patch that adds a direct raw link
download.gif (92 bytes) - added by Marcin Wojdyr <wojdyr@…> 3 years ago.
tiny download icon
Screenshot.png (14.3 KB) - added by Marcin Wojdyr <wojdyr@…> 3 years ago.
screenshot - how attachment list with raw-download icons looks like
raw-download-link2.diff (2.1 KB) - added by Marcin Wojdyr <wojdyr@…> 3 years ago.
updated patch adding icon links in two places
download.2.gif (95 bytes) - added by Marcin Wojdyr <wojdyr@…> 3 years ago.
2px higher icon
Screenshot.2.png (21.3 KB) - added by Marcin Wojdyr <wojdyr@…> 3 years ago.
updated screenshot
raw-download-link2.2.diff (2.1 KB) - added by Marcin Wojdyr <wojdyr@…> 3 years ago.
the previous patch doesn't work, this should work
5718-download-link-all-r8173.patch (1.8 KB) - added by rblank 3 years ago.
Patch adding a download icon to all links to attachments.
attachment-trac-links.png (10.3 KB) - added by cboos 3 years ago.
sample of Wiki content with attachment: links, using latest patch

Download all attachments as: .zip

Change History

comment:1 Changed 4 years ago by cboos

  • Keywords attachment added
  • Milestone set to 0.12
  • Owner changed from jonas to cboos
  • Severity changed from normal to minor

#6132 was closed as duplicate.

comment:2 Changed 4 years ago by anonymous

related Ticket #6447 and #2883

Changed 4 years ago by tedfordgif@…

Implements enhancement described in this ticket.

comment:3 Changed 4 years ago by tedfordgif@…

Actually, my patch doesn't add a new link. It instead redirects unrenderable attachments (wiki, tickets) to the raw download facility.

Changed 4 years ago by tedfordgif@…

Added link to attachment lists to delete attachments (when permissions allow).

comment:4 Changed 4 years ago by anonymous

  • Owner changed from cboos to anonymous
  • Status changed from new to assigned

    

Changed 4 years ago by Ivan

d

comment:5 Changed 3 years ago by wojdyr@…

  • Cc wojdyr@… added
  • Owner changed from anonymous to cboos
  • Status changed from assigned to new

The attachments don't implement the feature requested in this ticket.
The two last attachments (.2.patch and .2.2.patch) are the same.

Download button would definitely improve usability, several users asked about it for wxTrac, some of them reportedly prefer to type directly URL (.../raw-attachment/...) instead of clicking and scrolling.

It seems to me that the change by anonymous user in comment 4: changed owner from cboos to anonymous was unintended, so I'm changing it back.

comment:6 Changed 3 years ago by cboos

  • Milestone changed from 0.13 to 0.12

comment:7 follow-up: Changed 3 years ago by anonymous

  • Resolution set to fixed
  • Status changed from new to closed

The patches are not required, this is a documentation bug in trac. So, this ticket should be closed:

  1. If you do not want "Content-Disposition: attachment" to be sent, make render_unsafe_content = true. You need to do this in the correct section, I put it in all these section: ![browser], ![wiki] and ![attachment]
  1. If you do not want trac to display "unknown/cannot render page, try to download" page for pdf/msword, then use attach.pdf instead of attach.pdf. You do not need to muck with the absolute URL!

It took me some time to figure these out and you don't need any plugins or patches IMHO.

comment:8 in reply to: ↑ 7 Changed 3 years ago by anonymous

Still new to trac, messed up formatting:
Use [raw-attachment:attach.pdf] instead of [attachment:attach.pdf].

comment:9 Changed 3 years ago by rblank

  • Resolution fixed deleted
  • Status changed from closed to reopened

Please don't close tickets as "fixed" unless you have actually committed a fix for the issue.

Changed 3 years ago by Marcin Wojdyr <wojdyr@…>

one-line patch that adds a direct raw link

Changed 3 years ago by Marcin Wojdyr <wojdyr@…>

tiny download icon

Changed 3 years ago by Marcin Wojdyr <wojdyr@…>

screenshot - how attachment list with raw-download icons looks like

comment:10 Changed 3 years ago by Marcin Wojdyr <wojdyr@…>

Hello,
I'm not familiar with Trac code, so I may have overlooked something, but it seems to me that it's enough to add one line to templates/macros.html to implement this feature.
IMO download icon looks better than textual description for this, so I made a simple icon tiny download icon based on extlink.gif.

That's how attachment list looks like with additional icon:
screenshot - how attachment list with raw-download icons looks like

comment:11 Changed 3 years ago by rblank

This looks very good IMO. Maybe the icon should be made a bit taller, and the CSS trimmed so that there is no dotted line underneath, but that's a matter of taste.

comment:12 Changed 3 years ago by VZ

  • Cc vz-trac@… added

Marcin's patch is already very useful but it would be even more convenient to also have the download icon near the "attachment foo.bar added" sentence in the comments themselves and not only in the attachments frame in the top.

TIA!

Changed 3 years ago by Marcin Wojdyr <wojdyr@…>

updated patch adding icon links in two places

Changed 3 years ago by Marcin Wojdyr <wojdyr@…>

2px higher icon

Changed 3 years ago by Marcin Wojdyr <wojdyr@…>

updated screenshot

Changed 3 years ago by Marcin Wojdyr <wojdyr@…>

the previous patch doesn't work, this should work

comment:13 Changed 3 years ago by Marcin Wojdyr <wojdyr@…>

rblank: I think you are right about removing underline and making the icon higher. The updated proposal, with raw attachment icons also in Change History, looks like this:
updated screenshot

BTW this change is tested in wxTrac.

comment:14 Changed 3 years ago by rblank

Looks great!

Christian, if you don't mind, I'll integrate this shortly into 0.11-stable.

comment:15 Changed 3 years ago by cboos

  • Component changed from general to attachment
  • Milestone changed from 0.12 to 0.11.5
  • Owner changed from cboos to Marcin Wojdyr <wojdyr@…>
  • Status changed from reopened to new

I don't mind at all, I like this as well.

The only thing I'm left wondering is if we couldn't push this further and add the icon to the attachment:... TracLinks as well. I think that will be quite useful on Wiki page describing installation procedures, for example. The advantage of this upon raw-attachment:... links is that you can also easily access the attachment meta-data page (not to mention that raw-attachment: is probably lesser known that attachment:).

comment:16 Changed 3 years ago by rblank

Patch applied in [8173] with a few minor changes:

  • Used a trac- prefix for the new CSS class (#5997).
  • Put the CSS into trac.css, as wiki pages can also have attachments.
  • Hide the icon when printing.
  • Changed the alt= of the image to the same text as the link title, as IE displays the alt text.
  • Converted the image to .png as most of our images are in that format.

Thanks for the excellent patch!

Next, I'll test the idea in comment:15 to add the icon to attachment: links as well.

Changed 3 years ago by rblank

Patch adding a download icon to all links to attachments.

comment:17 follow-up: Changed 3 years ago by rblank

The patch above adds a download icon to all attachment: links. I think it's a nice addition. I'm not quite sure about the link title, "Original format" (the same as in the list of attachments) is not quite descriptive. Maybe I should change it to "Download".

Opinions?

comment:18 in reply to: ↑ 17 Changed 3 years ago by Marcin Wojdyr <wojdyr@…>

Replying to rblank:

The patch above adds a download icon to all attachment: links. I think it's a nice addition. I'm not quite sure about the link title, "Original format" (the same as in the list of attachments) is not quite descriptive. Maybe I should change it to "Download".

FWIW I agree, "Download" seems to be a better name (also in the list of attachments)

Changed 3 years ago by cboos

sample of Wiki content with attachment: links, using latest patch

comment:19 Changed 3 years ago by cboos

Looks good! Example:

sample of Wiki content with attachment: links, using latest patch

Download would be better, yes.

comment:20 Changed 3 years ago by rblank

  • Resolution set to fixed
  • Status changed from new to closed

Added the download icon to all attachment: links in [8174].

comment:21 Changed 3 years ago by cboos

Cool, thanks!

View

Add a comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
The resolution will be deleted. Next status will be 'reopened'
to The owner will be changed from Marcin Wojdyr <wojdyr@…>. Next status will be 'closed'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.