Merge lp:~nigelbabu/launchpad/patch-edit-684548 into lp:launchpad

Proposed by Nigel Babu
Status: Merged
Approved by: Данило Шеган
Approved revision: no longer in the source branch.
Merged at revision: 13851
Proposed branch: lp:~nigelbabu/launchpad/patch-edit-684548
Merge into: lp:launchpad
Diff against target: 53 lines (+13/-4)
2 files modified
lib/lp/bugs/stories/bugattachments/xx-attachments-to-bug-report.txt (+11/-4)
lib/lp/bugs/templates/bugcomment-box.pt (+2/-0)
To merge this branch: bzr merge lp:~nigelbabu/launchpad/patch-edit-684548
Reviewer Review Type Date Requested Status
Данило Шеган (community) Approve
Review via email: mp+73514@code.launchpad.net

Commit message

[r=danilo][bug=684548] Adding an edit button in the inline comments for attachments

Description of the change

= Description =
The 'edit' URL for most attachments is hard to find since its only next to the patch link in the right portlet. This fix will ensure that URL shows up in the bug comment as well.

= Launchpad lint =

Checking for conflicts and issues in changed files.

Linting changed files:
  lib/lp/bugs/templates/bugcomment-box.pt

To post a comment you must log in.
Revision history for this message
Данило Шеган (danilo) wrote :

As discussed on IRC, the test lib/lp/bugs/stories/bugattachments/xx-attachments-to-bug-report.txt would need fixing, and you should at least extend it to provide a check for the contents of the link. (You already talked with a few people about starting a unit test, but came up empty: it'd still be desireable to do that, but I won't block on it for such a tiny change like this)

Also, I believe parentheses next to each other in eg. "attachment.tar (edit) (17 bytes...)" look very bad. You should use CSS classes "sprite edit" for the edit link (with most likely no text at all: but I suggest you try out a few different options and see how it works out).

review: Needs Fixing
Revision history for this message
Nigel Babu (nigelbabu) wrote :

Personally, I think its much nicer to use edit, since that's what is used on portlet s well. Another reason being, adding the "edit sprite" classes puts the sprite on the left side where there's the attachment/patch icon.

Revision history for this message
Данило Шеган (danilo) wrote :

The fact that the portlet uses something out of date is not a reason to introduce more out-of-dateness. If it appears all the way to the left, you are putting them on the wrong A tag (i.e. it looks nice if I do something like http://pastebin.ubuntu.com/679537/).

When you remove the link text though, you'll probably want to introduce a CSS class on the ID link so you can easily find it with find_tags_by_class or similar.

Also note that your reformatting of the doctest headers (lint probably complained) is slightly incorrect. "\n" is an actual new line indicator, and you should make the follow-up line be of the same length as the text above it. Also, since this is RST (http://en.wikipedia.org/wiki/ReStructuredText), you should use different characters for different levels of headings, eg.

File Attachments of the Bug Report
==================================
...
Patch attachments are shown before non-patch attachments
--------------------------------------------------------
...

Revision history for this message
Данило Шеган (danilo) wrote :

This now looks good, thanks for all the improvements!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/bugs/stories/bugattachments/xx-attachments-to-bug-report.txt'
2--- lib/lp/bugs/stories/bugattachments/xx-attachments-to-bug-report.txt 2011-06-28 15:04:29 +0000
3+++ lib/lp/bugs/stories/bugattachments/xx-attachments-to-bug-report.txt 2011-09-01 11:25:29 +0000
4@@ -1,4 +1,5 @@
5-= File Attachments of the Bug Report =
6+File Attachments of the Bug Report
7+==================================
8
9 File attachments of the bug report itself are displayed in the list of
10 comments. Since the text of this comment is already displayed as the
11@@ -52,8 +53,14 @@
12 >>> link = browser.getLink('sample data')
13 >>> print link.url
14 http://bugs.launchpad.dev/jokosher/+bug/11/+attachment/1/+files/test.txt
15-
16-== Patch attachments are shown before non-patch attachments ==
17+ >>> edit_link = find_tags_by_class(browser.contents, 'edit sprite')[1]
18+ >>> print edit_link
19+ <a alt="edit" class="sprite edit"...
20+ ...href="/jokosher/+bug/11/+attachment/1"></a>
21+
22+
23+Patch attachments are shown before non-patch attachments
24+--------------------------------------------------------
25
26 >>> login("test@canonical.com")
27 >>> launchbag.clear()
28@@ -70,4 +77,4 @@
29 ...a patch...
30 ...Bug attachments...
31 ...sample data...
32- ...
33+ ...
34
35=== modified file 'lib/lp/bugs/templates/bugcomment-box.pt'
36--- lib/lp/bugs/templates/bugcomment-box.pt 2011-05-31 14:44:29 +0000
37+++ lib/lp/bugs/templates/bugcomment-box.pt 2011-09-01 11:25:29 +0000
38@@ -61,6 +61,7 @@
39 <a tal:attributes="href python: view.proxiedUrlOfLibraryFileAlias(attachment)"
40 tal:content="attachment/title"
41 class="sprite download-icon">foo.txt</a>
42+ <a tal:attributes="href attachment/fmt:url" alt="edit" class="sprite edit"></a>
43 (<span
44 tal:replace="attachment/libraryfile/content/filesize/fmt:bytes" />,
45 <span tal:replace="attachment/libraryfile/mimetype" />)
46@@ -71,6 +72,7 @@
47 <li tal:repeat="attachment comment/patches" class="download-attachment">
48 <a tal:attributes="href python: view.proxiedUrlOfLibraryFileAlias(attachment)"
49 tal:content="attachment/title" class="sprite haspatch-icon">foo.txt</a>
50+ <a tal:attributes="href attachment/fmt:url" alt="edit" class="sprite edit"></a>
51 (<span
52 tal:replace="attachment/libraryfile/content/filesize/fmt:bytes" />,
53 <span tal:replace="attachment/libraryfile/mimetype" />)