Merge lp:~rockstar/launchpad/change-recipe-link into lp:launchpad

Proposed by Paul Hummer
Status: Merged
Merged at revision: 10913
Proposed branch: lp:~rockstar/launchpad/change-recipe-link
Merge into: lp:launchpad
Diff against target: 395 lines (+119/-50)
11 files modified
lib/canonical/launchpad/templates/launchpad-graphics.pt (+5/-0)
lib/lp/blueprints/stories/standalone/xx-branch-links.txt (+2/-2)
lib/lp/code/browser/branch.py (+17/-7)
lib/lp/code/browser/configure.zcml (+3/-0)
lib/lp/code/browser/tests/test_sourcepackagerecipe.py (+2/-2)
lib/lp/code/stories/branches/xx-bug-branch-links.txt (+3/-3)
lib/lp/code/stories/sourcepackagerecipes/xx-recipe-listings.txt (+9/-7)
lib/lp/code/templates/branch-index.pt (+10/-22)
lib/lp/code/templates/branch-pending-merges.pt (+5/-3)
lib/lp/code/templates/branch-recipes.pt (+27/-0)
lib/lp/code/templates/branch-related-bugs-specs.pt (+36/-4)
To merge this branch: bzr merge lp:~rockstar/launchpad/change-recipe-link
Reviewer Review Type Date Requested Status
Eleanor Berger (community) code Approve
Curtis Hovey (community) ui Approve
Review via email: mp+25790@code.launchpad.net

Description of the change

This branch redesigns some of the branch page to accomodate a new relationship with source package recipes. The Code team has all discussed this, and we've decided that combining all these relationships in the same place is the best way to go. Now merge proposals, source package recipes, linked bugs and linked blueprints are all in the same "portlet" area. I think this will help demonstrate the point of this branch better than any other property of the branch itself. You can now easily see everything that depends on this branch.

A screenshot of this change can be found at: https://devpad.canonical.com/~rockstar/branch-relations.png

To post a comment you must log in.
Revision history for this message
Curtis Hovey (sinzui) wrote :

I like the consolidate presentation.

review: Approve (ui)
Revision history for this message
Eleanor Berger (intellectronica) wrote :

Looks great, with one exception. Please avoid using an inline javascript event handler, and the same by creating an event handler using YUI.

review: Needs Fixing (code)
Revision history for this message
Paul Hummer (rockstar) wrote :

The inline javascript event handler is not new, just moved. I plan on redoing all of the branch page itself in the next pipe of this branch, and I'll make sure to cover that then.

Revision history for this message
Eleanor Berger (intellectronica) :
review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'lib/canonical/launchpad/images/source-package-recipe.png'
2Binary files lib/canonical/launchpad/images/source-package-recipe.png 1970-01-01 00:00:00 +0000 and lib/canonical/launchpad/images/source-package-recipe.png 2010-05-25 04:39:31 +0000 differ
3=== modified file 'lib/canonical/launchpad/templates/launchpad-graphics.pt'
4--- lib/canonical/launchpad/templates/launchpad-graphics.pt 2009-09-17 22:05:48 +0000
5+++ lib/canonical/launchpad/templates/launchpad-graphics.pt 2010-05-25 04:39:31 +0000
6@@ -756,6 +756,11 @@
7 <td>To be used when a branch is being upgraded.</td>
8 </tr>
9 <tr>
10+ <td>source-package-recipe</td>
11+ <td><img src="/@@/source-package-recipe" /></td>
12+ <td>Represents a source package recipe.</td>
13+ </tr>
14+ <tr>
15 <td colspan="3">
16 <h2>Packages</h2>
17 </td>
18
19=== modified file 'lib/lp/blueprints/stories/standalone/xx-branch-links.txt'
20--- lib/lp/blueprints/stories/standalone/xx-branch-links.txt 2009-09-22 10:48:09 +0000
21+++ lib/lp/blueprints/stories/standalone/xx-branch-links.txt 2010-05-25 04:39:31 +0000
22@@ -44,7 +44,7 @@
23 >>> browser.getControl('Blueprint').value = ['canvas']
24 >>> browser.getControl('Continue').click()
25 >>> printSpecBranchLinks(browser)
26- Support &lt;canvas&gt; Objects (Medium) - edit
27+ Support &lt;canvas&gt; Objects edit
28
29
30 == From the blueprint page ==
31@@ -116,7 +116,7 @@
32 >>> browser.open(
33 ... 'http://code.launchpad.dev/~name12/firefox/main')
34 >>> printSpecBranchLinks(browser)
35- Support &lt;canvas&gt; Objects (Medium) - edit
36+ Support &lt;canvas&gt; Objects edit
37
38 Clicking on the edit link shows the form. Unfortunately the
39 testbrowser cannot handle javascript. In these situations
40
41=== modified file 'lib/lp/code/browser/branch.py'
42--- lib/lp/code/browser/branch.py 2010-04-21 02:50:20 +0000
43+++ lib/lp/code/browser/branch.py 2010-05-25 04:39:31 +0000
44@@ -197,7 +197,7 @@
45 facet = 'branches'
46 title = 'Edit branch'
47 links = (
48- 'edit', 'reviewer', 'edit_whiteboard', 'delete', 'create_recipe')
49+ 'edit', 'reviewer', 'edit_whiteboard', 'delete')
50
51 def branch_is_import(self):
52 return self.context.branch_type == BranchType.IMPORTED
53@@ -224,11 +224,6 @@
54 text = 'Set branch reviewer'
55 return Link('+reviewer', text, icon='edit')
56
57- def create_recipe(self):
58- enabled = config.build_from_branch.enabled
59- text = 'Create source package recipe'
60- return Link('+new-recipe', text, enabled=enabled, icon='add')
61-
62
63 class BranchContextMenu(ContextMenu, HasRecipesMenuMixin):
64 """Context menu for branches."""
65@@ -236,7 +231,7 @@
66 usedfor = IBranch
67 facet = 'branches'
68 links = [
69- 'add_subscriber', 'browse_revisions', 'link_bug',
70+ 'add_subscriber', 'browse_revisions', 'create_recipe', 'link_bug',
71 'link_blueprint', 'register_merge', 'source', 'subscription',
72 'edit_status', 'edit_import', 'upgrade_branch', 'view_recipes']
73
74@@ -322,6 +317,11 @@
75 return Link(
76 '+upgrade', 'Upgrade this branch', icon='edit', enabled=enabled)
77
78+ def create_recipe(self):
79+ enabled = config.build_from_branch.enabled
80+ text = 'Create packaging recipe'
81+ return Link('+new-recipe', text, enabled=enabled, icon='add')
82+
83
84 class DecoratedBug:
85 """Provide some additional attributes to a normal bug."""
86@@ -470,6 +470,16 @@
87 if check_permission('launchpad.View', proposal)]
88
89 @property
90+ def recipe_count_text(self):
91+ count = self.context.getRecipes().count()
92+ if count == 0:
93+ return 'No recipes'
94+ elif count == 1:
95+ return '1 recipe'
96+ else:
97+ return '%s recipes' % count
98+
99+ @property
100 def is_import_branch_with_no_landing_candidates(self):
101 """Is the branch an import branch with no landing candidates?"""
102 if self.landing_candidates:
103
104=== modified file 'lib/lp/code/browser/configure.zcml'
105--- lib/lp/code/browser/configure.zcml 2010-05-18 15:21:49 +0000
106+++ lib/lp/code/browser/configure.zcml 2010-05-25 04:39:31 +0000
107@@ -392,6 +392,9 @@
108 name="++branch-pending-merges"
109 template="../templates/branch-pending-merges.pt" />
110 <browser:page
111+ name="++branch-recipes"
112+ template="../templates/branch-recipes.pt" />
113+ <browser:page
114 name="++branch-import-details"
115 template="../templates/branch-import-details.pt" />
116 <browser:page
117
118=== modified file 'lib/lp/code/browser/tests/test_sourcepackagerecipe.py'
119--- lib/lp/code/browser/tests/test_sourcepackagerecipe.py 2010-05-19 17:03:40 +0000
120+++ lib/lp/code/browser/tests/test_sourcepackagerecipe.py 2010-05-25 04:39:31 +0000
121@@ -74,7 +74,7 @@
122
123 # A new recipe can be created from the branch page.
124 browser = self.getUserBrowser(canonical_url(branch), user=self.chef)
125- browser.getLink('Create source package recipe').click()
126+ browser.getLink('Create packaging recipe').click()
127
128 browser.getControl(name='field.name').value = 'daily'
129 browser.getControl('Description').value = 'Make some food!'
130@@ -114,7 +114,7 @@
131
132 # A new recipe can be created from the branch page.
133 browser = self.getUserBrowser(canonical_url(branch), user=self.chef)
134- browser.getLink('Create source package recipe').click()
135+ browser.getLink('Create packaging recipe').click()
136
137 browser.getControl(name='field.name').value = 'daily'
138 browser.getControl('Description').value = 'Make some food!'
139
140=== modified file 'lib/lp/code/stories/branches/xx-bug-branch-links.txt'
141--- lib/lp/code/stories/branches/xx-bug-branch-links.txt 2010-04-07 14:57:03 +0000
142+++ lib/lp/code/stories/branches/xx-bug-branch-links.txt 2010-05-25 04:39:31 +0000
143@@ -56,7 +56,7 @@
144 >>> browser.getControl('Bug #').value = "9"
145 >>> browser.getControl('Continue').click()
146 >>> printBugBranchLinks(browser)
147- Bug #9: Thunderbird crashes Unknown Unknown
148+ Bug #9: Thunderbird crashes
149
150 Attempting to link to the same bug again gives no error.
151
152@@ -91,7 +91,7 @@
153 >>> browser.open(
154 ... 'http://code.launchpad.dev/~name12/gnome-terminal/klingon')
155 >>> printBugBranchLinks(browser)
156- Bug #9: Thunderbird crashes Unknown Unknown
157+ Bug #9: Thunderbird crashes
158
159 ... but an anonymous user cannot.
160
161@@ -130,7 +130,7 @@
162
163 >>> browser.getLink('~name12/gnome-terminal/scanned').click()
164 >>> printBugBranchLinks(browser)
165- Bug #11: Make Jokosher use autoaudiosink Undecided New
166+ Bug #11: Make Jokosher use autoaudiosink
167
168
169 Quick branch registration
170
171=== modified file 'lib/lp/code/stories/sourcepackagerecipes/xx-recipe-listings.txt'
172--- lib/lp/code/stories/sourcepackagerecipes/xx-recipe-listings.txt 2010-04-21 02:06:38 +0000
173+++ lib/lp/code/stories/sourcepackagerecipes/xx-recipe-listings.txt 2010-05-25 04:39:31 +0000
174@@ -29,13 +29,14 @@
175 >>> nopriv_browser = setupBrowser(
176 ... auth='Basic nopriv@canonical.com:test')
177
178+There should be a link on the branch page that says "No recipes" that leads to
179+the recipe listings page.
180+
181 The link to the source package recipe listings should not be shown.
182
183 >>> nopriv_browser.open(recipeless_branch_url)
184- >>> nopriv_browser.getLink('View source package recipes')
185- Traceback (most recent call last):
186- ...
187- LinkNotFoundError
188+ >>> print nopriv_browser.getLink('No recipes').url
189+ http://code.launchpad.dev/%7Eperson-name.../product-name.../branch.../+recipes
190
191 Create a new sample branch, but this time create some source package branches
192 to go along with them.
193@@ -53,12 +54,13 @@
194
195 >>> logout()
196
197-The link to source package recipes should now be shown. Let's click through.
198+Since there are 3 recipes associated with this branch now, the link should now
199+read "3 recipes." Let's click through.
200
201 >>> nopriv_browser.open(branch_url)
202- >>> nopriv_browser.getLink('View source package recipes').click()
203+ >>> nopriv_browser.getLink('3 recipes').click()
204 >>> print nopriv_browser.url
205- http://code.launchpad.dev/~person-name.../product-name.../branch.../+recipes
206+ http://code.launchpad.dev/%7Eperson-name.../product-name.../branch.../+recipes
207
208 The "Base branch" column should not be shown.
209
210
211=== modified file 'lib/lp/code/templates/branch-index.pt'
212--- lib/lp/code/templates/branch-index.pt 2010-04-19 03:36:55 +0000
213+++ lib/lp/code/templates/branch-index.pt 2010-05-25 04:39:31 +0000
214@@ -12,8 +12,9 @@
215 .logtail {
216 padding-left: 2em;
217 }
218- #merge-summary {
219- margin: 1em 0;
220+ #merge-summary, #recipe-summary {
221+ margin-top: .5em;
222+ margin-bottom: .1em;
223 }
224 #download-url dt, #upload-url dt {
225 font-weight: normal;
226@@ -100,12 +101,15 @@
227 </div>
228 </div>
229
230- <div class="yui-g" tal:condition="view/show_merge_links">
231+ <div class="yui-g">
232
233- <div class="portlet" id="branch-merges">
234- <h2>Branch merges</h2>
235+ <div class="portlet" id="branch-relations">
236 <tal:branch-pending-merges
237- replace="structure context/@@++branch-pending-merges" />
238+ replace="structure context/@@++branch-pending-merges" />
239+ <tal:branch-recipes
240+ replace="structure context/@@++branch-recipes" />
241+ <tal:related-bugs-specs
242+ replace="structure context/@@++branch-related-bugs-specs" />
243 </div>
244
245 </div>
246@@ -117,14 +121,6 @@
247 </div>
248 </div>
249
250- <div class="yui-g">
251- <div id="related-bugs-and-blueprints" class="portlet">
252- <h2>Related bugs and blueprints</h2>
253- <tal:related-bugs-specs
254- replace="structure context/@@++branch-related-bugs-specs" />
255- </div>
256- </div>
257-
258 <div id="branch-import-details"
259 class="yui-g"
260 tal:condition="context/branch_type/enumvalue:IMPORTED">
261@@ -213,14 +209,6 @@
262 </li>
263 </ul>
264
265- <div
266- style="margin-top: 1.5em"
267- tal:define="link context/menu:context/view_recipes"
268- tal:condition="link/enabled"
269- >
270- <a tal:replace="structure link/fmt:link" />
271- </div>
272-
273 </div>
274
275 </div>
276
277=== modified file 'lib/lp/code/templates/branch-pending-merges.pt'
278--- lib/lp/code/templates/branch-pending-merges.pt 2010-01-14 23:24:10 +0000
279+++ lib/lp/code/templates/branch-pending-merges.pt 2010-05-25 04:39:31 +0000
280@@ -1,11 +1,13 @@
281 <div
282 xmlns:tal="http://xml.zope.org/namespaces/tal"
283 xmlns:metal="http://xml.zope.org/namespaces/metal"
284- xmlns:i18n="http://xml.zope.org/namespaces/i18n">
285+ xmlns:i18n="http://xml.zope.org/namespaces/i18n"
286+ tal:define="context_menu context/menu:context"
287+ tal:condition="view/show_merge_links">
288
289+ <h3>Branch merges</h3>
290 <div id="merge-links"
291- tal:condition="view/show_merge_links"
292- tal:define="context_menu context/menu:context">
293+ class="actions">
294 <div id="merge-summary">
295
296 <div id="landing-candidates"
297
298=== added file 'lib/lp/code/templates/branch-recipes.pt'
299--- lib/lp/code/templates/branch-recipes.pt 1970-01-01 00:00:00 +0000
300+++ lib/lp/code/templates/branch-recipes.pt 2010-05-25 04:39:31 +0000
301@@ -0,0 +1,27 @@
302+<div
303+ xmlns:tal="http://xml.zope.org/namespaces/tal"
304+ xmlns:metal="http://xml.zope.org/namespaces/metal"
305+ xmlns:i18n="http://xml.zope.org/namespaces/i18n"
306+ tal:define="context_menu context/menu:context"
307+ id="related-bugs-and-blueprints">
308+
309+ <h3>Related source package recipes</h3>
310+
311+ <div id="recipe-links" class="actions">
312+ <div id="recipe-summary">
313+ <img src="/@@/source-package-recipe" />
314+ <a href="+recipes" tal:content="structure view/recipe_count_text">
315+ 1 branch
316+ </a>
317+ based off of this branch.
318+
319+ </div>
320+
321+ <div
322+ tal:define="link context_menu/create_recipe"
323+ tal:condition="link/enabled"
324+ tal:replace="structure link/render"
325+ />
326+ </div>
327+
328+</div>
329
330=== modified file 'lib/lp/code/templates/branch-related-bugs-specs.pt'
331--- lib/lp/code/templates/branch-related-bugs-specs.pt 2010-03-01 18:41:31 +0000
332+++ lib/lp/code/templates/branch-related-bugs-specs.pt 2010-05-25 04:39:31 +0000
333@@ -4,11 +4,29 @@
334 xmlns:i18n="http://xml.zope.org/namespaces/i18n"
335 tal:define="context_menu context/menu:context">
336
337+ <h3>Related bugs</h3>
338 <div id="buglinks" class="actions">
339 <div id="buglink-list">
340 <tal:bugs tal:define="branch context;
341 show_edit python:True;">
342- <metal:bug-branch-links use-macro="context/@@+macros/bug-branch-links"/>
343+
344+ <ul tal:repeat="bug view/linked_bugs">
345+ <li tal:condition="bug/required:launchpad.View"
346+ tal:define="bugtask bug/bugtask;
347+ show_edit show_edit|Nothing"
348+ tal:attributes="id string:buglink-${bug/id}"
349+ class="bug-branch-summary">
350+ <tal:buglink content="structure bugtask/fmt:link" />
351+ <tal:buglink-edit condition="show_edit|nothing">
352+ <a title="Remove link"
353+ class="delete-buglink"
354+ tal:attributes="href string:+bug/${bug/id}/+delete;
355+ id string:delete-buglink-${bug/id}">
356+ <img src="/@@/remove"/>
357+ </a>
358+ </tal:buglink-edit>
359+ </li>
360+ </ul>
361 </tal:bugs>
362 </div>
363
364@@ -21,14 +39,28 @@
365 tal:attributes="href link/url"
366 tal:content="link/text" />
367 </div>
368-
369 </div>
370
371+ <h3>Related blueprints</h3>
372 <div class="actions">
373 <tal:blueprints tal:define="branch context;
374 show_edit python:True;">
375- <metal:spec-branch-links
376- use-macro="context/@@+macros/spec-branch-links"/>
377+ <ul tal:repeat="spec_branch context/spec_links">
378+ <li tal:define="has_edit_permission spec_branch/required:launchpad.AnyPerson;
379+ show_edit show_edit|nothing;
380+ show_edit python: show_edit and has_edit_permission;
381+ spec spec_branch/specification;"
382+ class="spec-branch-summary">
383+ <tal:link replace="structure spec/fmt:link" />
384+ <tal:show-edit condition="show_edit|nothing">
385+ <a tal:attributes="href spec_branch/fmt:url;
386+ onclick string:return switchSpecBranchFormAndSummary('${spec_branch/id}')">
387+ edit<img src="/@@/edit"/>
388+ </a>
389+ </tal:show-edit>
390+ </li>
391+
392+ </ul>
393 </tal:blueprints>
394 <div
395 tal:define="link context_menu/link_blueprint"