Merge lp:~jtv/launchpad/mechanical-specificationtarget-assignments into lp:launchpad

Proposed by Jeroen T. Vermeulen
Status: Merged
Merge reported by: Brad Crittenden
Merged at revision: not available
Proposed branch: lp:~jtv/launchpad/mechanical-specificationtarget-assignments
Merge into: lp:launchpad
Diff against target: None lines
To merge this branch: bzr merge lp:~jtv/launchpad/mechanical-specificationtarget-assignments
Reviewer Review Type Date Requested Status
Michael Nelson (community) code Approve
Brad Crittenden (community) release-critical Disapprove
Review via email: mp+12203@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Jeroen T. Vermeulen (jtv) wrote :

= Mechanical conversion of Blueprints "+assignments" pages =

This is not a conversion I'm proud of, but we're in a hurry.

Example page:

    https://blueprints.launchpad.dev/ubuntu/+assignments

That page still has a 1.0-style actions menu that can come from one of a
number of different views, depending on the context for which you're
viewing the assignments list. So I chose not to go on a crusade to
convert these to 2.0 and then to 3.0. Others may be fixing the menus
right now, but if they are, the fixes are not in devel yet so I can't
rely on whatever they're doing. Instead I dropped the menu. There's
the breadcrumbs and the "All blueprints" link in the bottom-right corner
to get people back to the world of interconnected pages.

Layout is main_only, since this page does not deal in subscriptions or
anything like that. The portlet survives below the main content. I did
not go for a two-column layout since the widths of the portlet and the
main listing are inherently very different, and the result would look
weird.

Previously this page shared its view with some others, making it hard to
let go of pagetitles.py. That's why there is now a new view class
derived from HasSpecificationsView that specializes in +assignments
pages. It provides the new page_title and label.

Much of the diff is taken up by the template. A few notes about that:

 * All the fmt:url links turned out to be suitable for conversion to
   fmt:link. It's really worth checking for this. And an image was
   spritefied.

 * When there were no blueprints to display, the old template would show
   an information message. AIUI that's improper use of informational
   messages, since nothing happened as a result of the user's actions
   that they're being notified about. So I turned that into running
   text, which then had to be a lot less roadsignish.

 * I don't know why the explanatory paragraph about the listing was all
   the way at the bottom. I put it at the top; if you're not interested
   I'm sure your eyes will skip right over it anyway.

 * Does the main table need more styling work?

No lint. Test anything that has "blueprint," "sprint," "project," or
"distroseries" in it and you should have about covered it. That's what
I did.

Jeroen

Revision history for this message
Michael Nelson (michael.nelson) wrote :
Download full text (5.1 KiB)

> = Mechanical conversion of Blueprints "+assignments" pages =
>
> This is not a conversion I'm proud of, but we're in a hurry.

Hi Jeroen! I think you've done a great job :)

I'm marking it as needs information - as I think it might be best for Henning to merge your work here and then just ensure it's consistent with the hasspecification page that he's doing. Then you'll not need a separate rc either? What do you think?

>
> Example page:
>
> https://blueprints.launchpad.dev/ubuntu/+assignments
>
> That page still has a 1.0-style actions menu that can come from one of a
> number of different views, depending on the context for which you're
> viewing the assignments list. So I chose not to go on a crusade to
> convert these to 2.0 and then to 3.0. Others may be fixing the menus
> right now, but if they are, the fixes are not in devel yet so I can't
> rely on whatever they're doing. Instead I dropped the menu. There's
> the breadcrumbs and the "All blueprints" link in the bottom-right corner
> to get people back to the world of interconnected pages.

Ok, I think this will need to be done together with Henning, as he's
doing the hasspecification conversion.

So please chat with him, and just ensure it's consistent. He's already
doing the menu, so it'll be really easy. In fact, it might be even easier
if henninge just merges your branch and updates it and lands them together?

>
> Layout is main_only, since this page does not deal in subscriptions or
> anything like that. The portlet survives below the main content. I did
> not go for a two-column layout since the widths of the portlet and the
> main listing are inherently very different, and the result would look
> weird.

Again, please discuss this together with henninge.

>
> Previously this page shared its view with some others, making it hard to
> let go of pagetitles.py. That's why there is now a new view class
> derived from HasSpecificationsView that specializes in +assignments
> pages. It provides the new page_title and label.

Great! I can now see the benefit of specifying a nice short page_title for
the breadcrumb-leaf, and a more detailed label for the main heading.
Looks great.

>
> Much of the diff is taken up by the template. A few notes about that:
>
> * All the fmt:url links turned out to be suitable for conversion to
> fmt:link. It's really worth checking for this. And an image was
> spritefied.

Thanks!

>
> * When there were no blueprints to display, the old template would show
> an information message. AIUI that's improper use of informational
> messages, since nothing happened as a result of the user's actions
> that they're being notified about. So I turned that into running
> text, which then had to be a lot less roadsignish.

Great.

>
> * I don't know why the explanatory paragraph about the listing was all
> the way at the bottom. I put it at the top; if you're not interested
> I'm sure your eyes will skip right over it anyway.

I personally like it better at the bottom - if I'm interested (ie. I don't
understand the information that I'm looking at) my eyes will reach it,
otherwise I don't have to skip over it. But ...

Read more...

review: Needs Information (code/ui)
Revision history for this message
Jeroen T. Vermeulen (jtv) wrote :

> I'm marking it as needs information - as I think it might be best for Henning
> to merge your work here and then just ensure it's consistent with the
> hasspecification page that he's doing. Then you'll not need a separate rc
> either? What do you think?

Fantastic.

> So please chat with him, and just ensure it's consistent. He's already
> doing the menu, so it'll be really easy. In fact, it might be even easier
> if henninge just merges your branch and updates it and lands them together?

So it hath been written; so it shall be done.

> > === modified file 'lib/lp/blueprints/browser/specificationtarget.py'
> > --- lib/lp/blueprints/browser/specificationtarget.py 2009-09-17 21:20:14
> +0000
> > +++ lib/lp/blueprints/browser/specificationtarget.py 2009-09-22 07:08:11
> +0000

> > @@ -115,7 +116,7 @@
> > self.batchnav = BatchNavigator(
> > self.specs, self.request,
> > size=config.launchpad.default_batch_size)
> > -
> > +
>
> ^^^ some trailing spaces.

"Not anymore, heh heh!"

> > @@ -313,6 +314,15 @@
> > quantity=quantity, prejoin_people=False)
> >
> >
> > +class SpecificationAssignmentsView(HasSpecificationsView):
> > + """View for +assignments pages."""
>
> Do we normally have a black line between class docstrings and the first
> attr/method? I couldn't find anything in the style guide, but it just
> looked a bit strange. Just ignore it this comment :)

I've wondered the same thing. PEP-8 says not to insert a blank line.
Personally I'm glad there's one thing of little consequence that isn't
the subject of endless debates. I do tend to like blank lines for one
very practical reason: provide natural separation to reduce the risk
of false merge conflicts.

> > + page_title = "Assignments"
> > +
> > + @property
> > + def label(self):
> > + return "Blueprint assignments for %s" % self.context.displayname
>
> If you feel like updating this to use smartquotes like the example
> directly below in SpecificatioDocumentationView, go for it.

Done.

Jeroen

Revision history for this message
Brad Crittenden (bac) wrote :

Jeroen your changes are great but the r-c is not approved since this branch is to be merged and landed by Henning. I will review his MP.

review: Disapprove (release-critical)
Revision history for this message
Michael Nelson (michael.nelson) wrote :

Thanks for the updates Jeroen!

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/pagetitles.py'
2--- lib/canonical/launchpad/pagetitles.py 2009-09-20 19:40:47 +0000
3+++ lib/canonical/launchpad/pagetitles.py 2009-09-22 00:49:37 +0000
4@@ -848,8 +848,6 @@
5 """Return the page title for a specificationtarget."""
6 return view.title
7
8-specificationtarget_assignments = ContextTitle('Blueprint assignments for %s')
9-
10 specificationtarget_workload = ContextTitle('Blueprint workload in %s')
11
12 sprint_attend = ContextTitle('Register your attendance at %s')
13
14=== modified file 'lib/lp/blueprints/browser/configure.zcml'
15--- lib/lp/blueprints/browser/configure.zcml 2009-09-17 21:20:14 +0000
16+++ lib/lp/blueprints/browser/configure.zcml 2009-09-22 00:13:14 +0000
17@@ -56,13 +56,17 @@
18 name="+specs"
19 template="../templates/hasspecifications-specs.pt"/>
20 <browser:page
21- name="+assignments"
22- template="../templates/specificationtarget-assignments.pt"/>
23- <browser:page
24 name="+portlet-latestspecs"
25 template="../templates/specificationtarget-portlet-latestspecs.pt"/>
26 </browser:pages>
27 <browser:page
28+ name="+assignments"
29+ for="lp.blueprints.interfaces.sprint.ISprint"
30+ class="canonical.launchpad.browser.SpecificationAssignmentsView"
31+ facet="specifications"
32+ permission="zope.Public"
33+ template="../templates/specificationtarget-assignments.pt"/>
34+ <browser:page
35 name="+edit"
36 for="lp.blueprints.interfaces.sprint.ISprint"
37 class="lp.blueprints.browser.sprint.SprintEditView"
38@@ -537,13 +541,16 @@
39 name="+specs"
40 template="../templates/hasspecifications-specs.pt"/>
41 <browser:page
42- name="+assignments"
43- template="../templates/specificationtarget-assignments.pt"/>
44- <browser:page
45 name="+portlet-latestspecs"
46 template="../templates/specificationtarget-portlet-latestspecs.pt"/>
47 </browser:pages>
48 <browser:page
49+ name="+assignments"
50+ for="lp.blueprints.interfaces.specificationtarget.IHasSpecifications"
51+ class="lp.blueprints.browser.specificationtarget.SpecificationAssignmentsView"
52+ permission="zope.Public"
53+ template="../templates/specificationtarget-assignments.pt"/>
54+ <browser:page
55 name="+register-a-blueprint-button"
56 for="lp.blueprints.interfaces.specificationtarget.ISpecificationTarget"
57 class="lp.blueprints.browser.specificationtarget.RegisterABlueprintButtonView"
58@@ -585,12 +592,16 @@
59 name="+specs"
60 template="../templates/hasspecifications-specs.pt"/>
61 <browser:page
62- name="+assignments"
63- template="../templates/specificationtarget-assignments.pt"/>
64- <browser:page
65 name="+portlet-latestspecs"
66 template="../templates/specificationtarget-portlet-latestspecs.pt"/>
67 </browser:pages>
68+ <browser:page
69+ name="+assignments"
70+ for="lp.registry.interfaces.project.IProject"
71+ class="lp.blueprints.browser.specificationtarget.SpecificationAssignmentsView"
72+ facet="specifications"
73+ permission="zope.Public"
74+ template="../templates/specificationtarget-assignments.pt"/>
75
76 <browser:page
77 name="+addspec"
78
79=== modified file 'lib/lp/blueprints/browser/specificationtarget.py'
80--- lib/lp/blueprints/browser/specificationtarget.py 2009-09-17 21:20:14 +0000
81+++ lib/lp/blueprints/browser/specificationtarget.py 2009-09-22 00:15:46 +0000
82@@ -8,6 +8,7 @@
83 __all__ = [
84 'HasSpecificationsView',
85 'RegisterABlueprintButtonView',
86+ 'SpecificationAssignmentsView',
87 'SpecificationDocumentationView',
88 ]
89
90@@ -115,7 +116,7 @@
91 self.batchnav = BatchNavigator(
92 self.specs, self.request,
93 size=config.launchpad.default_batch_size)
94-
95+
96 def mdzCsv(self):
97 """Quick hack for mdz, to get csv dump of specs."""
98 import csv
99@@ -313,6 +314,15 @@
100 quantity=quantity, prejoin_people=False)
101
102
103+class SpecificationAssignmentsView(HasSpecificationsView):
104+ """View for +assignments pages."""
105+ page_title = "Assignments"
106+
107+ @property
108+ def label(self):
109+ return "Blueprint assignments for %s" % self.context.displayname
110+
111+
112 class SpecificationDocumentationView(HasSpecificationsView):
113 """View for blueprints +documentation page."""
114
115
116=== modified file 'lib/lp/blueprints/stories/sprints/15-sprint-tabular-view.txt'
117--- lib/lp/blueprints/stories/sprints/15-sprint-tabular-view.txt 2009-05-11 18:19:21 +0000
118+++ lib/lp/blueprints/stories/sprints/15-sprint-tabular-view.txt 2009-09-22 00:13:14 +0000
119@@ -1,12 +1,12 @@
120 We should be able to see the workload of a sprint:
121
122 >>> anon_browser.open('http://launchpad.dev/sprints/ubz/+assignments')
123- >>> anon_browser.title
124- 'Blueprint assignments for Ubuntu Below Zero'
125+ >>> print anon_browser.title
126+ Assignments : Ubuntu Below Zero : Meetings
127
128 We should be able to see the spec assignment table of a sprint:
129
130- >>> mainarea = find_tag_by_id(anon_browser.contents, 'mainarea')
131+ >>> mainarea = find_main_content(anon_browser.contents)
132 >>> for header in mainarea.findAll('th'):
133 ... print header.renderContents()
134 Priority
135@@ -21,6 +21,7 @@
136 no spec assigned to people.
137
138 >>> anon_browser.open('http://launchpad.dev/sprints/ltsponsteroids/+assignments')
139- >>> 'No blueprints to display' in anon_browser.contents
140- True
141+ >>> notice = find_tag_by_id(anon_browser.contents, 'no-blueprints')
142+ >>> print extract_text(notice)
143+ There are no open blueprints.
144
145
146=== modified file 'lib/lp/blueprints/templates/specificationtarget-assignments.pt'
147--- lib/lp/blueprints/templates/specificationtarget-assignments.pt 2009-07-17 17:59:07 +0000
148+++ lib/lp/blueprints/templates/specificationtarget-assignments.pt 2009-09-22 00:13:14 +0000
149@@ -3,91 +3,92 @@
150 xmlns:tal="http://xml.zope.org/namespaces/tal"
151 xmlns:metal="http://xml.zope.org/namespaces/metal"
152 xmlns:i18n="http://xml.zope.org/namespaces/i18n"
153- xml:lang="en"
154- lang="en"
155- dir="ltr"
156- metal:use-macro="context/@@main_template/master"
157+ metal:use-macro="view/macro:page/main_only"
158 i18n:domain="launchpad"
159 >
160
161 <body>
162
163-<metal:leftportlets fill-slot="portlets_one">
164- <div tal:replace="structure context/@@+portlet-latestspecs" />
165-</metal:leftportlets>
166-
167-<metal:heading fill-slot="pageheading">
168- <h1>Assignment of work on blueprints</h1>
169-</metal:heading>
170-
171 <div metal:fill-slot="main">
172
173- <p class="informational message" tal:condition="not: view/specs">
174- No blueprints to display.
175- </p>
176-
177- <table class="listing sortable" tal:condition="view/specs" id="work">
178- <thead>
179- <tr>
180- <th>Priority</th>
181- <th>Name</th>
182- <th>Definition</th>
183- <th>Delivery</th>
184- <th>Assignee</th>
185- <th>Drafter</th>
186- <th>Approver</th>
187- </tr>
188- </thead>
189- <tbody class="lesser">
190- <tr tal:repeat="spec view/specs">
191- <td>
192- <span class="sortkey" tal:content="spec/priority/sortkey" />
193- <span tal:content="spec/priority/title"
194- tal:attributes="
195- class string:specpriority${spec/priority/name}">High</span>
196- </td>
197- <td><a tal:content="spec/name/fmt:shorten/35"
198- tal:attributes="
199- href spec/fmt:url;
200- title spec/title">foo-bar-baz</a>
201- <img src="/@@/info" alt="Informational"
202- tal:condition="spec/informational" />
203- </td>
204- <td>
205- <span class="sortkey" tal:content="spec/definition_status/sortkey" />
206- <span tal:content="spec/definition_status/title"
207- tal:attributes="
208- class string:specstatus${spec/definition_status/name}">Approved</span>
209- </td>
210- <td>
211- <span class="sortkey" tal:content="spec/implementation_status/sortkey" />
212- <span tal:content="spec/implementation_status/title"
213- tal:attributes="
214- class string:specdelivery${spec/implementation_status/name}">Slow
215- </span>
216- </td>
217- <td><a tal:condition="spec/assignee"
218- tal:content="spec/assignee/name"
219- tal:attributes="href spec/assignee/fmt:url">Assignee Bar</a></td>
220- <td><a tal:condition="spec/drafter"
221- tal:content="spec/drafter/name"
222- tal:attributes="href spec/drafter/fmt:url">Drafter Baz</a></td>
223- <td><a tal:condition="spec/approver"
224- tal:content="spec/approver/name"
225- tal:attributes="href spec/approver/fmt:url">Approver Foo</a></td>
226- </tr>
227- </tbody>
228- </table>
229-
230- <p tal:condition="view/specs">
231- This listing shows the assignment of work for
232- blueprints currently associated with
233- <span tal:replace="context/displayname">Mozilla</span>.
234- The drafter is responsible for getting the specification correctly
235- written up and approved.
236- The approver is usually the person who would
237- sign off on the specification.
238- </p>
239+ <p class="portlet" tal:condition="not: view/specs" id="no-blueprints">
240+ There are no open blueprints.
241+ </p>
242+
243+ <div tal:condition="view/specs" class="portlet">
244+ <p>
245+ This listing shows the assignment of work for
246+ blueprints currently associated with
247+ <span tal:replace="context/displayname">Mozilla</span>.
248+ The drafter is responsible for getting the specification correctly
249+ written up and approved.
250+ The approver is usually the person who would
251+ sign off on the specification.
252+ </p>
253+
254+ <table class="listing sortable" id="work">
255+ <thead>
256+ <tr>
257+ <th>Priority</th>
258+ <th>Name</th>
259+ <th>Definition</th>
260+ <th>Delivery</th>
261+ <th>Assignee</th>
262+ <th>Drafter</th>
263+ <th>Approver</th>
264+ </tr>
265+ </thead>
266+ <tbody class="lesser">
267+ <tr tal:repeat="spec view/specs">
268+ <td>
269+ <span class="sortkey" tal:content="spec/priority/sortkey" />
270+ <span tal:content="spec/priority/title"
271+ tal:attributes="
272+ class string:specpriority${spec/priority/name}">High</span>
273+ </td>
274+ <td>
275+ <a tal:replace="structure spec/fmt:link">Better mousetrap</a>
276+ <span tal:condition="spec/informational"
277+ class="info sprite"
278+ alt="Informational" />
279+ </td>
280+ <td>
281+ <span class="sortkey" tal:content="spec/definition_status/sortkey" />
282+ <span tal:content="spec/definition_status/title"
283+ tal:attributes="
284+ class string:specstatus${spec/definition_status/name}">Approved</span>
285+ </td>
286+ <td>
287+ <span class="sortkey" tal:content="spec/implementation_status/sortkey" />
288+ <span tal:content="spec/implementation_status/title"
289+ tal:attributes="
290+ class string:specdelivery${spec/implementation_status/name}">Slow
291+ </span>
292+ </td>
293+ <td>
294+ <a tal:condition="spec/assignee"
295+ tal:replace="structure spec/assignee/fmt:link">
296+ Assignee Bar
297+ </a>
298+ </td>
299+ <td>
300+ <a tal:condition="spec/drafter"
301+ tal:replace="structure spec/drafter/fmt:link">
302+ Drafter Baz
303+ </a>
304+ </td>
305+ <td>
306+ <a tal:condition="spec/approver"
307+ tal:replace="structure spec/approver/fmt:link">
308+ Approver Foo
309+ </a>
310+ </td>
311+ </tr>
312+ </tbody>
313+ </table>
314+ </div>
315+
316+ <div class="portlet" tal:content="structure context/@@+portlet-latestspecs" />
317
318 </div>
319 </body>