Merge lp://staging/~michael.nelson/launchpad/429551-view-package-details-link into lp://staging/launchpad

Proposed by Michael Nelson
Status: Merged
Merged at revision: not available
Proposed branch: lp://staging/~michael.nelson/launchpad/429551-view-package-details-link
Merge into: lp://staging/launchpad
Diff against target: None lines
To merge this branch: bzr merge lp://staging/~michael.nelson/launchpad/429551-view-package-details-link
Reviewer Review Type Date Requested Status
Barry Warsaw (community) ui* Approve
Celso Providelo (community) code Approve
Review via email: mp+11961@code.staging.launchpad.net
To post a comment you must log in.
Revision history for this message
Michael Nelson (michael.nelson) wrote :

= Summary =

This branch simply adds a 'View package details' link next within the
context of the simple package list on the ppa index page, like this:

http://people.canonical.com/~michaeln/tmp/view-package-details-link.png

This is in addition to the menu item displayed in the side-bar, as there
are use-cases for both.

It is a fix for bug 429551.

== Implementation details ==

I used the opportunity to convert the other portlets on the
archive-index page to in-template macros, so that the structure of the
page is easier to read. They are straight copy-paste-re-indents.

== Tests ==

bin/test -vv -t archive-views.txt -t stories/ppa

== Demo and Q/A ==

Demo:
https://launchpad.dev/~cprov/+archive/ppa

QA:
https://edge.launchpad.net/~cprov/+archive/ppa

= Launchpad lint =

Checking for conflicts. and issues in doctests and templates.
Running jslint, xmllint, pyflakes, and pylint.
Using normal rules.

Linting changed files:
  lib/canonical/launchpad/pagetitles.py
  lib/lp/soyuz/browser/tests/archive-views.txt
  lib/lp/soyuz/stories/ppa/xx-ppa-navigation.txt
  lib/lp/soyuz/templates/archive-index.pt
  lib/lp/soyuz/browser/archive.py

--
Michael

Revision history for this message
Celso Providelo (cprov) wrote :

Well done, Michael!

Thanks for taking the opportunity to extract more portlets.

r=me

review: Approve (code)
Revision history for this message
Barry Warsaw (barry) :
review: Approve (ui*)

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-16 22:32:36 +0000
3+++ lib/canonical/launchpad/pagetitles.py 2009-09-17 09:21:27 +0000
4@@ -128,8 +128,6 @@
5
6 archive_edit_dependencies = ContextDisplayName('Edit dependencies for %s')
7
8-archive_index = ContextDisplayName('%s')
9-
10 archive_subscriber_edit = ContextDisplayName('Edit %s')
11
12 archive_subscribers = ContextDisplayName('Manage access to %s')
13
14=== modified file 'lib/lp/soyuz/browser/archive.py'
15--- lib/lp/soyuz/browser/archive.py 2009-09-15 08:25:32 +0000
16+++ lib/lp/soyuz/browser/archive.py 2009-09-17 09:21:27 +0000
17@@ -732,20 +732,21 @@
18 implements(IArchiveIndexActionsMenu)
19
20 def initialize(self):
21- """Setup infrastructure for the PPA index page.
22-
23- Setup sources list entries widget and the search result list.
24- """
25+ """Redirect if our context is a main archive."""
26 if self.context.is_main:
27 self.request.response.redirect(
28 canonical_url(self.context.distribution))
29 return
30 super(ArchiveView, self).initialize()
31
32- self.displayname_edit_widget = TextLineEditorWidget(
33+ @property
34+ def displayname_edit_widget(self):
35+ widget = TextLineEditorWidget(
36 self.context, 'displayname',
37 canonical_url(self.context, view_name='+edit'),
38- id="displayname", title="Edit this displayname")
39+ id="displayname", title="Edit the displayname")
40+ return widget
41+
42
43 @property
44 def sources_list_entries(self):
45
46=== modified file 'lib/lp/soyuz/browser/tests/archive-views.txt'
47--- lib/lp/soyuz/browser/tests/archive-views.txt 2009-09-15 08:25:32 +0000
48+++ lib/lp/soyuz/browser/tests/archive-views.txt 2009-09-17 11:45:59 +0000
49@@ -428,6 +428,12 @@
50 PENDING
51 PUBLISHED
52
53+To enable the inline editing of the archive displayname, ArchiveView
54+also provides a custom widget, displayname_edit_widget.
55+
56+ >>> print view.displayname_edit_widget.title
57+ Edit the displayname
58+
59
60 == ArchivePackageView ==
61
62
63=== modified file 'lib/lp/soyuz/stories/ppa/xx-ppa-navigation.txt'
64--- lib/lp/soyuz/stories/ppa/xx-ppa-navigation.txt 2009-09-12 02:09:47 +0000
65+++ lib/lp/soyuz/stories/ppa/xx-ppa-navigation.txt 2009-09-17 11:23:17 +0000
66@@ -92,8 +92,12 @@
67 Main heading: Default PPA
68
69 The user can view all the package details using the 'View package details'
70-link.
71+link. This link is the first link displayed within
72+the packages listing portlet.
73
74+ >>> packages_portlet = find_tag_by_id(anon_browser.contents, 'packages')
75+ >>> print packages_portlet.find('a').string
76+ View package details
77 >>> anon_browser.getLink('View package details').click()
78 >>> print anon_browser.title
79 +packages : Default PPA : Celso Providelo
80
81=== modified file 'lib/lp/soyuz/templates/archive-index.pt'
82--- lib/lp/soyuz/templates/archive-index.pt 2009-09-11 17:19:00 +0000
83+++ lib/lp/soyuz/templates/archive-index.pt 2009-09-17 11:35:39 +0000
84@@ -7,161 +7,68 @@
85 i18n:domain="launchpad"
86 >
87 <body>
88- <tal:heading metal:fill-slot="heading">
89- <h1 tal:condition="context/enabled"
90- tal:replace="structure view/displayname_edit_widget">
91- PPA for user
92- </h1>
93- <h1 tal:condition="not: context/enabled"
94- tal:content="CONTEXTS/fmt:pagetitle"
95- class="disabled">
96- PPA for user
97- </h1>
98- </tal:heading>
99- <tal:main metal:fill-slot="main"
100- tal:define="archive_active view/has_sources;
101- archive_label view/archive_label;"
102- tal:attributes="class string:archive">
103-
104- <div class="top-portlet" style="padding-top:0.5em;">
105-
106- <p tal:condition="not: context/enabled"
107- style="clear: right;" class="warning message">
108- This archive has been disabled.
109- </p>
110-
111- <div id="edit-description"
112- tal:content="structure view/archive_description_html"
113- />
114- </div>
115-
116- <div class="portlet" id="upload-hint"
117- tal:condition="context/required:launchpad.Append">
118- <h2>Uploading packages to this PPA</h2>
119- <p tal:condition="view/has_disabled_dependencies"
120- class="message warning">
121- This PPA depends on disabled archives. it may cause
122- spurious build failures or binaries with unexpected
123- contents.</p>
124- <p>You can upload packages to this PPA using:</p>
125- <p><tt>dput <tal:ppa-ref replace="view/ppa_reference"
126- >ppa:cprov/ppa</tal:ppa-ref> &lt;source.changes&gt;</tt>
127- (<a href="https://help.launchpad.net/Packaging/PPA/Uploading"
128- >Read about uploading</a>)</p>
129- </div>
130-
131- <div class="yui-gc">
132-
133- <div class="yui-u first">
134- <tal:ppa-install tal:condition="context/is_ppa">
135- <metal:ppa-install
136- use-macro="template/macros/ppa-install-portlet" />
137- </tal:ppa-install>
138- <tal:package-copy-request-list tal:condition="context/is_copy">
139- <metal:package-copy-request-list
140- use-macro="context/@@+macros/package-copy-request-list" />
141- </tal:package-copy-request-list>
142- </div>
143-
144- <div class="yui-u"><div class="portlet">
145- <h2><tal:archive_label replace="archive_label" /> statistics</h2>
146- <dl tal:define="num_updates view/num_updates_over_last_days;
147- pkg_build_counts view/num_pkgs_building">
148- <dt>Activity</dt>
149- <dd><span tal:replace="num_updates">10</span>
150- update<tal:plural content="string:s"
151- condition="python:num_updates!=1"/>
152- added during the past month.</dd>
153- <dd tal:condition="pkg_build_counts/total">
154- Currently
155- <a tal:attributes="href context/menu:overview/builds_building/fmt:url"
156- tal:omit-tag="not:pkg_build_counts/building">
157- <span tal:replace="pkg_build_counts/building">2</span>
158- package<tal:plural content="string:s"
159- condition="python:pkg_build_counts['building']!=1"
160- /> building</a> and
161- <a tal:attributes="href context/menu:overview/builds_pending/fmt:url"
162- tal:omit-tag="not:pkg_build_counts/waiting">
163- <span tal:replace="pkg_build_counts/waiting">2</span>
164- package<tal:plural content="string:s"
165- condition="python:pkg_build_counts['waiting']!=1"
166- />
167- waiting to build</a>.</dd>
168- </dl>
169- </div></div>
170-
171- </div><!-- yui-gc -->
172-
173- <div class="portlet" tal:condition="archive_active">
174- <h2>Overview of all packages published in
175- <form class="package-search-filter" action="" method="GET"
176- style="display:inline;font-size:90%">
177- <tal:series_filter
178- replace="structure view/plain_series_filter_widget" />
179- <input type="submit" value="Filter" />
180- </form>
181- </h2>
182-
183- <div style="padding-top: 1em;" tal:define="batch view/batched_sources">
184-
185- <tal:navigation_top
186- replace="structure view/batchnav/@@+navigation-links-upper" />
187-
188- <table class="listing sortable" id="packages_list"
189- tal:condition="batch">
190- <thead>
191- <tr>
192- <th>Package</th>
193- <th>Version</th>
194- <th>Uploaded by</th>
195- </tr>
196- </thead>
197- <tbody>
198- <tr tal:repeat="publishing batch">
199- <td>
200- <img src="/@@/package-source" />
201- <tal:source_name replace="publishing/sourcepackagerelease/name">
202- foo
203- </tal:source_name>
204- </td>
205- <td tal:define="
206- version_name publishing/meta_distroseriessourcepackagerelease/version;"
207- tal:content="version_name">
208- 2.0.39</td>
209- <td tal:define="spr publishing/sourcepackagerelease;
210- signer spr/dscsigningkey/owner/fmt:link|string:no signer">
211- <span tal:replace="structure signer">Joe Bloggs</span>
212- <tal:date_published
213- condition="publishing/datepublished">
214- (<span
215- tal:replace="publishing/datepublished/fmt:approximatedate">
216- 2007-08-01</span>)
217- </tal:date_published>
218- </td>
219-
220- </tr>
221- </tbody>
222- </table>
223-
224- <tal:navigation_bottom
225- replace="structure view/batchnav/@@+navigation-links-lower" />
226-
227- <div id="empty-result"
228- tal:define="name_filter view/specified_name_filter|nothing"
229- tal:condition="not: batch">
230- No matching package for '<tal:name_filter replace="name_filter" />'.
231- </div>
232-
233- </div>
234- </div>
235-
236- </tal:main>
237-
238- <tal:side metal:fill-slot="side">
239- <tal:menu replace="structure view/@@+global-actions" />
240- <metal:build-status-summary
241- use-macro="context/@@+macros/latest-updates-portlet" />
242- </tal:side>
243+ <tal:heading metal:fill-slot="heading">
244+ <h1 tal:condition="context/enabled"
245+ tal:replace="structure view/displayname_edit_widget">
246+ PPA for user
247+ </h1>
248+ <h1 tal:condition="not: context/enabled"
249+ tal:content="context/displayname"
250+ class="disabled">
251+ PPA for user
252+ </h1>
253+ </tal:heading>
254+
255+ <tal:main metal:fill-slot="main"
256+ tal:define="archive_active view/has_sources;
257+ archive_label view/archive_label;"
258+ tal:attributes="class string:archive">
259+
260+ <div class="top-portlet" style="padding-top:0.5em;">
261+ <p tal:condition="not: context/enabled"
262+ style="clear: right;" class="warning message">
263+ This archive has been disabled.
264+ </p>
265+
266+ <div id="edit-description"
267+ tal:content="structure view/archive_description_html"
268+ />
269+ </div>
270+
271+ <metal:ppa-install
272+ use-macro="template/macros/ppa-upload-hint-portlet" />
273+
274+ <div class="yui-gc">
275+
276+ <div class="yui-u first">
277+ <tal:ppa-install tal:condition="context/is_ppa">
278+ <metal:ppa-install
279+ use-macro="template/macros/ppa-install-portlet" />
280+ </tal:ppa-install>
281+ <tal:package-copy-request-list tal:condition="context/is_copy">
282+ <metal:package-copy-request-list
283+ use-macro="context/@@+macros/package-copy-request-list" />
284+ </tal:package-copy-request-list>
285+ </div>
286+
287+ <div class="yui-u">
288+ <metal:ppa-statistics-portlet
289+ use-macro="template/macros/ppa-statistics-portlet" />
290+ </div>
291+
292+ <metal:ppa-simplified-packages-portlet
293+ use-macro="template/macros/ppa-simplified-packages-portlet" />
294+
295+ </div><!-- yui-gc -->
296+
297+
298+ </tal:main>
299+
300+ <tal:side metal:fill-slot="side">
301+ <tal:menu replace="structure view/@@+global-actions" />
302+ <metal:build-status-summary
303+ use-macro="context/@@+macros/latest-updates-portlet" />
304+ </tal:side>
305
306 <metal:macros fill-slot="bogus">
307
308@@ -279,6 +186,130 @@
309 </div> <!-- ppa-install -->
310 </metal:ppa-install-portlet>
311
312+ <metal:ppa-statistics-portlet define-macro="ppa-statistics-portlet">
313+ <tal:comment replace="nothing">
314+ Present the statistics for a PPA in a portlet.
315+ </tal:comment>
316+ <div class="portlet">
317+ <h2><tal:archive_label replace="archive_label" /> statistics</h2>
318+ <dl tal:define="num_updates view/num_updates_over_last_days;
319+ pkg_build_counts view/num_pkgs_building">
320+ <dt>Activity</dt>
321+ <dd><span tal:replace="num_updates">10</span>
322+ update<tal:plural content="string:s"
323+ condition="python:num_updates!=1"/>
324+ added during the past month.</dd>
325+ <dd tal:condition="pkg_build_counts/total">
326+ Currently
327+ <a tal:attributes="href context/menu:overview/builds_building/fmt:url"
328+ tal:omit-tag="not:pkg_build_counts/building">
329+ <span tal:replace="pkg_build_counts/building">2</span>
330+ package<tal:plural content="string:s"
331+ condition="python:pkg_build_counts['building']!=1"
332+ /> building</a> and
333+ <a tal:attributes="href context/menu:overview/builds_pending/fmt:url"
334+ tal:omit-tag="not:pkg_build_counts/waiting">
335+ <span tal:replace="pkg_build_counts/waiting">2</span>
336+ package<tal:plural content="string:s"
337+ condition="python:pkg_build_counts['waiting']!=1"
338+ />
339+ waiting to build</a>.</dd>
340+ </dl>
341+ </div>
342+ </metal:ppa-statistics-portlet>
343+
344+ <metal:ppa-simplified-packages-portlet
345+ define-macro="ppa-simplified-packages-portlet">
346+ <tal:comment replace="nothing">
347+ Present the simplified packages listing for the PPA index page.
348+ </tal:comment>
349+ <div class="portlet" tal:condition="archive_active" id="packages">
350+ <span class="see-all"
351+ tal:content="structure view/menu:overview/packages/fmt:link">
352+ View package details</span>
353+ <h2>Overview of all packages published in
354+ <form class="package-search-filter" action="" method="GET"
355+ style="display:inline;font-size:90%">
356+ <tal:series_filter
357+ replace="structure view/plain_series_filter_widget" />
358+ <input type="submit" value="Filter" />
359+ </form>
360+ </h2>
361+
362+ <div style="padding-top: 1em;" tal:define="batch view/batched_sources">
363+
364+ <tal:navigation_top
365+ replace="structure view/batchnav/@@+navigation-links-upper" />
366+
367+ <table class="listing sortable" id="packages_list"
368+ tal:condition="batch">
369+ <thead>
370+ <tr>
371+ <th>Package</th>
372+ <th>Version</th>
373+ <th>Uploaded by</th>
374+ </tr>
375+ </thead>
376+ <tbody>
377+ <tr tal:repeat="publishing batch">
378+ <td>
379+ <img src="/@@/package-source" />
380+ <tal:source_name replace="publishing/sourcepackagerelease/name">
381+ foo
382+ </tal:source_name>
383+ </td>
384+ <td tal:define="
385+ version_name publishing/meta_distroseriessourcepackagerelease/version;"
386+ tal:content="version_name">
387+ 2.0.39</td>
388+ <td tal:define="spr publishing/sourcepackagerelease;
389+ signer spr/dscsigningkey/owner/fmt:link|string:no signer">
390+ <span tal:replace="structure signer">Joe Bloggs</span>
391+ <tal:date_published
392+ condition="publishing/datepublished">
393+ (<span
394+ tal:replace="publishing/datepublished/fmt:approximatedate">
395+ 2007-08-01</span>)
396+ </tal:date_published>
397+ </td>
398+ </tr>
399+ </tbody>
400+ </table>
401+
402+ <tal:navigation_bottom
403+ replace="structure view/batchnav/@@+navigation-links-lower" />
404+
405+ <div id="empty-result"
406+ tal:define="name_filter view/specified_name_filter|nothing"
407+ tal:condition="not: batch">
408+ No matching package for '<tal:name_filter replace="name_filter" />'.
409+ </div>
410+
411+ </div>
412+ </div>
413+ </metal:ppa-simplified-packages-portlet>
414+
415+ <metal:ppa-upload-hint-portlet
416+ define-macro="ppa-upload-hint-portlet">
417+ <tal:comment replace="nothing">
418+ Present the upload hints for the PPA index page.
419+ </tal:comment>
420+ <div class="portlet" id="upload-hint"
421+ tal:condition="context/required:launchpad.Append">
422+ <h2>Uploading packages to this PPA</h2>
423+ <p tal:condition="view/has_disabled_dependencies"
424+ class="message warning">
425+ This PPA depends on disabled archives. it may cause
426+ spurious build failures or binaries with unexpected
427+ contents.</p>
428+ <p>You can upload packages to this PPA using:</p>
429+ <p><tt>dput <tal:ppa-ref replace="view/ppa_reference"
430+ >ppa:cprov/ppa</tal:ppa-ref> &lt;source.changes&gt;</tt>
431+ (<a href="https://help.launchpad.net/Packaging/PPA/Uploading"
432+ >Read about uploading</a>)</p>
433+ </div>
434+ </metal:ppa-upload-hint-portlet>
435+
436 </metal:macros>
437
438 </body>