Merge lp://staging/~intellectronica/launchpad/bugtask-ajax-assignee into lp://staging/launchpad

Proposed by Eleanor Berger
Status: Merged
Merged at revision: not available
Proposed branch: lp://staging/~intellectronica/launchpad/bugtask-ajax-assignee
Merge into: lp://staging/launchpad
Diff against target: None lines
To merge this branch: bzr merge lp://staging/~intellectronica/launchpad/bugtask-ajax-assignee
Reviewer Review Type Date Requested Status
Michael Nelson (community) code Approve
Review via email: mp+11095@code.staging.launchpad.net
To post a comment you must log in.
Revision history for this message
Eleanor Berger (intellectronica) wrote :

This branch makes it possible to edit a bugtask's assignee inline, using the AJAX picker. Other than the normal instatiation of the widget, the only other things to watch for are some test adjustments and a change to the xhtml formatter of an assignee, to make the structure it outputs fit with the updated picker code (which was changed to require nesting the content within another top-level span to allow easily picking all nodes using the DOM).

Revision history for this message
Michael Nelson (michael.nelson) wrote :

r=noodles

* jtv has quit ("Leaving.")
<noodles775> intellectronica: yep, on it.
<intellectronica> awesome
<noodles775> wow... MP 3-0 :)
<noodles775> intellectronica: nice :) That works really well.
<noodles775> I'm a bit confused by the diff - there already was an InlineEditPickerWidget that you've removed... what's going on there?
* noodles775 looks to see how the editor widget is created now.
<noodles775> so the assignee_picker_widget property was never used?
<intellectronica> noodles775: there was some previous work done in this area by edwin, which worked in a completely different way from how the rest of the tasks table works. it was never used, and i changed or removed so as to make this work in a consistent way
<noodles775> Great.
<noodles775> intellectronica: not part of this code review, but looking at the page, there are a *lot* of edit icons staring back at me...
<noodles775> I wonder whether having so many edit icons in a small area is starting to make it hard to focus on the content... (12 are staring me down above the fold).
<intellectronica> noodles775: yes. in a future branch these will change to a slightly less offensive version martin has prepared. we're still not sure what the best solution is (if you remember for a while the icons were only shown on hover, but that was found to be not sufficiently discoverable)
<noodles775> Great!
<noodles775> intellectronica: while you're here, a quick question about the inline description editor... or should I wait for deryck?
<noodles775> Basically, I'm unsure why (1) the click/tab is a fixed width (ie try making the window smaller), and (2) why it needs a negative margin at the top.
<intellectronica> noodles775: try me (though chances i won't know the answer)
<intellectronica> noodles775: right, no idea. deryck might remember what's going on there since he last worked on this
<noodles775> (I was having to add special css exceptions on a page last night, but then stopped in case we can fix it generally with the inline editor).
<noodles775> OK.
<noodles775> adeuring: of course :)
<noodles775> intellectronica: great work! r=me

review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/canonical/launchpad/javascript/bugs/bugtask-index.js'
2--- lib/canonical/launchpad/javascript/bugs/bugtask-index.js 2009-08-26 20:50:26 +0000
3+++ lib/canonical/launchpad/javascript/bugs/bugtask-index.js 2009-09-02 22:13:06 +0000
4@@ -1211,6 +1211,7 @@
5 var bugtarget_content = Y.get('#bugtarget-picker-' + conf.row_id);
6 var status_content = tr.query('.status-content');
7 var importance_content = tr.query('.importance-content');
8+ var assignee_content = Y.get('#assignee-picker-' + conf.row_id);
9 var milestone_content = tr.query('.milestone-content');
10
11 if (Y.Lang.isValue(LP.client.cache.bug) &&
12@@ -1357,6 +1358,20 @@
13 milestone_choice_edit);
14 milestone_choice_edit.render();
15 }
16+ if (Y.Lang.isValue(assignee_content)) {
17+ var assignee_picker = Y.lp.picker.addPickerPatcher(
18+ 'ValidAssignee',
19+ conf.bugtask_path,
20+ "assignee_link",
21+ assignee_content.get('id'),
22+ true,
23+ true,
24+ {"step_title": "Search for people or teams",
25+ "header": "Change assignee",
26+ "remove_button_text": "Remove asignee",
27+ "null_display_value": "Unassigned"});
28+ assignee_picker.render()
29+ }
30 };
31
32 /**
33
34=== modified file 'lib/lp/bugs/browser/bugtask.py'
35--- lib/lp/bugs/browser/bugtask.py 2009-09-02 09:41:01 +0000
36+++ lib/lp/bugs/browser/bugtask.py 2009-09-02 22:13:06 +0000
37@@ -167,7 +167,9 @@
38 if context.assignee is None:
39 return ''
40 else:
41- return PersonFormatterAPI(context.assignee).link(None)
42+ return (
43+ '<span>%s</span>' %
44+ PersonFormatterAPI(context.assignee).link(None))
45 return render
46
47 @component.adapter(IBugTask, IReference, IWebServiceClientRequest)
48@@ -3129,27 +3131,6 @@
49 return canonical_url(self.context)
50
51 @property
52- def assignee_picker_widget(self):
53- assignee_content_id = 'assignee-content-box-%s' % self.context.id
54- null_display_value = 'Nobody'
55- if self.context.assignee is None:
56- assignee_html = null_display_value
57- else:
58- assignee_html = PersonFormatterAPI(self.context.assignee).link(
59- '+assignedbugs')
60-
61- return InlineEditPickerWidget(
62- context=self.context,
63- request=self.request,
64- interface_attribute=IBugTask['assignee'],
65- default_html=assignee_html,
66- id=assignee_content_id,
67- header='Change assignee',
68- step_title='Search for people or teams',
69- remove_button_text='Remove Assignee',
70- null_display_value=null_display_value)
71-
72- @property
73 def user_can_edit_importance(self):
74 """Can the user edit the Importance field?
75
76
77=== modified file 'lib/lp/bugs/stories/bug-also-affects/30-also-affects-upstream-bug-urls.txt'
78--- lib/lp/bugs/stories/bug-also-affects/30-also-affects-upstream-bug-urls.txt 2009-08-27 18:18:29 +0000
79+++ lib/lp/bugs/stories/bug-also-affects/30-also-affects-upstream-bug-urls.txt 2009-09-02 22:13:06 +0000
80@@ -198,11 +198,11 @@
81 ... 'tr', id=re.compile('^tasksummary[0-9]+$'))
82 ... for bugtask in bugtasks:
83 ... cells = bugtask('td', recursive=False)
84- ... if len(cells) != 7:
85+ ... if len(cells) != 6:
86 ... continue
87 ... affects = extract_text(cells[1])
88 ... assignee = extract_text(cells[-2])
89- ... if assignee:
90+ ... if assignee and not 'Unassigned' in assignee:
91 ... assignee_link = cells[-2].a
92 ... if assignee_link is None:
93 ... print '%s -->\n %s' % (affects, assignee)
94
95=== modified file 'lib/lp/bugs/stories/bug-also-affects/xx-also-affects-distribution-default-values.txt'
96--- lib/lp/bugs/stories/bug-also-affects/xx-also-affects-distribution-default-values.txt 2009-08-27 13:45:25 +0000
97+++ lib/lp/bugs/stories/bug-also-affects/xx-also-affects-distribution-default-values.txt 2009-09-02 22:13:06 +0000
98@@ -10,11 +10,11 @@
99
100 >>> from lp.bugs.tests.bug import print_bug_affects_table
101 >>> print_bug_affects_table(user_browser.contents)
102- Tomcat ... New Low
103+ Tomcat ... New Low Unassigned ...
104 Ubuntu ... Status tracked in Hoary
105- Hoary New Undecided
106- mozilla-firefox (Debian) ... Confirmed Low Sample Person
107- Woody New Medium
108+ Hoary New Undecided Unassigned ...
109+ mozilla-firefox (Debian) ... Confirmed Low Sample Person ...
110+ Woody New Medium Unassigned ...
111
112 >>> user_browser.getLink(url='+distrotask').click()
113 >>> user_browser.url
114
115=== modified file 'lib/lp/bugs/stories/bugs/xx-bug-create-question.txt'
116--- lib/lp/bugs/stories/bugs/xx-bug-create-question.txt 2009-09-01 10:13:20 +0000
117+++ lib/lp/bugs/stories/bugs/xx-bug-create-question.txt 2009-09-02 22:13:06 +0000
118@@ -59,7 +59,7 @@
119
120 >>> print extract_text(content(['table'], {'class' : 'listing'})[0])
121 Affects Status Importance Assigned to Milestone
122- linux-source-2.6.15 (Ubuntu) ... Invalid Medium
123+ linux-source-2.6.15 (Ubuntu) ... Invalid Medium Unassigned ...
124
125 Nor can the bugtask be edited if No Privileges Person accesses the
126 bugtask directly.
127@@ -251,7 +251,7 @@
128 >>> content = find_main_content(user_browser.contents)
129 >>> print extract_text(content(['table'], {'class' : 'listing'})[0])
130 Affects Status Importance Assigned to Milestone
131- Jokosher ... Invalid Critical
132+ Jokosher ... Invalid Critical Unassigned ...
133 Affecting: Jokosher
134 Filed here by: Foo Bar...
135
136
137=== modified file 'lib/lp/bugs/stories/bugtask-management/xx-bug-privileged-statuses.txt'
138--- lib/lp/bugs/stories/bugtask-management/xx-bug-privileged-statuses.txt 2009-08-27 13:45:25 +0000
139+++ lib/lp/bugs/stories/bugtask-management/xx-bug-privileged-statuses.txt 2009-09-02 22:13:06 +0000
140@@ -25,7 +25,7 @@
141 >>> print user_browser.url
142 http://bugs.launchpad.dev/ubuntu/+source/mozilla-firefox/+bug/1
143 >>> print_highlighted_bugtask(user_browser)
144- mozilla-firefox (Ubuntu) ... Confirmed Medium
145+ mozilla-firefox (Ubuntu) ... Confirmed Medium Unassigned ...
146
147 But he cannot change the status to Won't Fix or to Triaged, and so
148 those statuses are not shown in the UI:
149@@ -80,7 +80,7 @@
150 >>> print bug_supervisor_browser.url
151 http://bugs.launchpad.dev/ubuntu/+source/mozilla-firefox/+bug/1
152 >>> print_highlighted_bugtask(bug_supervisor_browser)
153- mozilla-firefox (Ubuntu) ... Won't Fix Medium
154+ mozilla-firefox (Ubuntu) ... Won't Fix Medium Unassigned ...
155
156 Now the bug has been changed, a regular user can see the Won't Fix
157 status. Earlier it was not even displayed as an option.
158@@ -105,7 +105,7 @@
159 >>> print bug_supervisor_browser.url
160 http://bugs.launchpad.dev/ubuntu/+source/mozilla-firefox/+bug/1
161 >>> print_highlighted_bugtask(bug_supervisor_browser)
162- mozilla-firefox (Ubuntu) ... Won't Fix Medium
163+ mozilla-firefox (Ubuntu) ... Won't Fix Medium Unassigned ...
164
165 The Bug Supervisor for Ubuntu can also change the status to Triaged:
166
167@@ -123,5 +123,5 @@
168 >>> print bug_supervisor_browser.url
169 http://bugs.launchpad.dev/ubuntu/+source/iceweasel/+bug/1
170 >>> print_highlighted_bugtask(bug_supervisor_browser)
171- iceweasel (Ubuntu) ... Triaged Medium
172+ iceweasel (Ubuntu) ... Triaged Medium Unassigned ...
173
174
175=== modified file 'lib/lp/bugs/templates/bugtask-tasks-and-nominations-table-row.pt'
176--- lib/lp/bugs/templates/bugtask-tasks-and-nominations-table-row.pt 2009-08-26 15:51:46 +0000
177+++ lib/lp/bugs/templates/bugtask-tasks-and-nominations-table-row.pt 2009-09-02 22:13:06 +0000
178@@ -101,12 +101,8 @@
179 </div>
180 </td>
181
182-
183- <td class="icon left right">
184- <metal:expander metal:use-macro="template/macros/expander" />
185- </td>
186-
187- <td style="margin: 0; padding: 0; vertical-align: middle">
188+ <td style="width:20%; margin: 0; padding: 0;
189+ vertical-align: middle; padding-left: 0.5em">
190 <tal:has_watch condition="context/bugwatch">
191 <div style="text-decoration: none; padding: 0.25em">
192 <tal:bugtracker-active
193@@ -121,19 +117,23 @@
194 <a tal:replace="structure context/bugwatch/fmt:external-link" />
195 </div>
196 </tal:has_watch>
197+
198 <tal:has_no_watch condition="not: context/bugwatch">
199-
200- <tal:has_assignee condition="context/assignee">
201- <a
202- style="display: block; padding: 0.25em; text-decoration: none;"
203- tal:attributes="href context/assignee/fmt:url/+assignedbugs"
204- >
205- <tal:block replace="structure context/assignee/fmt:icon" />
206- <tal:name replace="context/assignee/fmt:displayname">
207- assignee.displayname
208- </tal:name>
209- </a>
210- </tal:has_assignee>
211+ <span tal:attributes="id string:assignee-picker-${row_id}">
212+ <span class="yui-activator-data-box">
213+ <a tal:condition="context/assignee"
214+ tal:attributes="href context/assignee/fmt:url;
215+ class context/assignee/image:sprite_css"
216+ tal:content="context/assignee/fmt:displayname" />
217+ <tal:unassigned condition="not: context/assignee">
218+ Unassigned
219+ </tal:unassigned>
220+ </span>
221+ <button class="lazr-btn yui-activator-act">
222+ Edit
223+ </button>
224+ <div class="yui-activator-message-box yui-activator-hidden" />
225+ </span>
226 </tal:has_no_watch>
227 </td>
228
229
230=== modified file 'lib/lp/bugs/templates/bugtasks-and-nominations-table.pt'
231--- lib/lp/bugs/templates/bugtasks-and-nominations-table.pt 2009-08-04 14:51:23 +0000
232+++ lib/lp/bugs/templates/bugtasks-and-nominations-table.pt 2009-09-02 22:13:06 +0000
233@@ -24,7 +24,7 @@
234 <th colspan="2">Affects</th>
235 <th>Status</th>
236 <th>Importance</th>
237- <th colspan="2">Assigned to</th>
238+ <th>Assigned to</th>
239 <th>Milestone</th>
240 </tr>
241 </thead>