Merge lp://staging/~julian-edwards/launchpad/mechanical-30-ui-changes-4 into lp://staging/launchpad

Proposed by Julian Edwards
Status: Merged
Merged at revision: not available
Proposed branch: lp://staging/~julian-edwards/launchpad/mechanical-30-ui-changes-4
Merge into: lp://staging/launchpad
Diff against target: None lines
To merge this branch: bzr merge lp://staging/~julian-edwards/launchpad/mechanical-30-ui-changes-4
Reviewer Review Type Date Requested Status
Deryck Hodge (community) Approve
Review via email: mp+10301@code.staging.launchpad.net
To post a comment you must log in.
Revision history for this message
Julian Edwards (julian-edwards) wrote :

= Summary =
More mechanical 3.0 updates

== Proposed fix ==
Two more pages updated:
 * DistroArchSeries:+admin
 * DistributionSourcePackage:+publishinghistory

== Implementation details ==
The DistroArchSeries:+admin used a Zope form which I had to convert to an
LPForm so that I could add next_url, cancel_url and page_title in the new view
class.

== Tests ==
bin/test -vvt xx-distroarchseries.txt

== Demo and Q/A ==
The pages are at:
 * https://launchpad.dev/ubuntu/+source/alsa-utils/+publishinghistory
 * https://launchpad.dev/ubuntu/breezy-autotest/i386/+admin

You need to be logged in as an admin for the latter.

= 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/templates/distroarchseries-admin.pt
  lib/lp/soyuz/stories/soyuz/xx-distroarchseries.txt
  lib/lp/soyuz/browser/configure.zcml
  lib/lp/soyuz/browser/distroarchseries.py
  lib/lp/soyuz/templates/distributionsourcepackage-publishinghistory.pt

== Pylint notices ==

lib/lp/soyuz/browser/distroarchseries.py
    19: [C0301] Line too long (79/78)

Gah, warning me about this is too fscking late here. I'll have it fixed by
the time you read this MP.

Revision history for this message
Deryck Hodge (deryck) wrote :

Hi, Julian.

This looks good to me.

As mentioned on IRC, I think (based on Curtis' last email to our dev list) that we don't need the h1 headings defined inside the headling slot. I'll still mark Approve since as you see this isn't clear to you and you've done other pages this same way. But I do want to note it and ask Curtis or Martin A. to confirm.

Cheers,
deryck

review: Approve

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-08-16 02:37:06 +0000
3+++ lib/canonical/launchpad/pagetitles.py 2009-08-17 14:03:19 +0000
4@@ -515,8 +515,6 @@
5
6 distributionsourcepackagerelease_index = ContextTitle('%s')
7
8-distroarchseries_admin = ContextTitle('Administer %s')
9-
10 distroarchseries_index = ContextTitle('%s in Launchpad')
11
12 distroarchseries_builds = ContextTitle('%s builds')
13
14=== modified file 'lib/lp/soyuz/browser/configure.zcml'
15--- lib/lp/soyuz/browser/configure.zcml 2009-08-12 14:51:49 +0000
16+++ lib/lp/soyuz/browser/configure.zcml 2009-08-18 10:09:08 +0000
17@@ -637,13 +637,11 @@
18 name="+search"
19 class="lp.soyuz.browser.distroarchseries.DistroArchSeriesPackageSearchView"
20 template="../templates/distroarchseries-search.pt"/>
21- <browser:editform
22+ <browser:page
23+ name="+admin"
24 for="lp.soyuz.interfaces.distroarchseries.IDistroArchSeries"
25+ class="lp.soyuz.browser.distroarchseries.DistroArchSeriesAdminView"
26 permission="launchpad.Admin"
27- name="+admin"
28- schema="lp.soyuz.interfaces.distroarchseries.IDistroArchSeries"
29- facet="overview"
30- fields="architecturetag official supports_virtualized"
31 template="../templates/distroarchseries-admin.pt"/>
32 <browser:page
33 for="lp.registry.interfaces.person.IPerson"
34
35=== modified file 'lib/lp/soyuz/browser/distroarchseries.py'
36--- lib/lp/soyuz/browser/distroarchseries.py 2009-06-25 04:06:00 +0000
37+++ lib/lp/soyuz/browser/distroarchseries.py 2009-08-18 10:09:08 +0000
38@@ -5,6 +5,7 @@
39
40 __all__ = [
41 'DistroArchSeriesAddView',
42+ 'DistroArchSeriesAdminView',
43 'DistroArchSeriesPackageSearchView',
44 'DistroArchSeriesContextMenu',
45 'DistroArchSeriesNavigation',
46@@ -15,12 +16,13 @@
47 from lp.soyuz.browser.build import BuildRecordsView
48 from canonical.launchpad.browser.packagesearch import PackageSearchViewBase
49 from lp.soyuz.interfaces.distroarchseries import IDistroArchSeries
50-from canonical.launchpad.webapp import GetitemNavigation
51+from canonical.launchpad.webapp import GetitemNavigation, LaunchpadEditFormView
52 from canonical.launchpad.webapp.launchpadform import (
53 action, LaunchpadFormView)
54 from canonical.launchpad.webapp.menu import (
55 ContextMenu, enabled_with_permission, Link)
56 from canonical.launchpad.webapp.publisher import canonical_url
57+from canonical.lazr.utils import smartquote
58
59
60 class DistroArchSeriesNavigation(GetitemNavigation):
61@@ -72,3 +74,36 @@
62 data['architecturetag'], data['processorfamily'],
63 data['official'], self.user, data['supports_virtualized'])
64 self.next_url = canonical_url(distroarchseries)
65+
66+
67+class DistroArchSeriesAdminView(LaunchpadEditFormView):
68+ """View class for admin of DistroArchSeries."""
69+
70+ schema = IDistroArchSeries
71+
72+ field_names = [
73+ 'architecturetag', 'official', 'supports_virtualized'
74+ ]
75+
76+ @action(_('Change'), name='update')
77+ def change_details(self, action, data):
78+ """Update with details from the form."""
79+ modified = self.updateContextFromData(data)
80+
81+ if modified:
82+ self.request.response.addNotification(
83+ "Successfully updated")
84+
85+ return modified
86+
87+ @property
88+ def next_url(self):
89+ return canonical_url(self.context)
90+
91+ @property
92+ def cancel_url(self):
93+ return self.next_url
94+
95+ @property
96+ def page_title(self):
97+ return smartquote("Administer %s" % self.context.title)
98
99=== modified file 'lib/lp/soyuz/stories/soyuz/xx-distroarchseries.txt'
100--- lib/lp/soyuz/stories/soyuz/xx-distroarchseries.txt 2009-08-05 14:48:06 +0000
101+++ lib/lp/soyuz/stories/soyuz/xx-distroarchseries.txt 2009-08-17 13:10:51 +0000
102@@ -99,10 +99,32 @@
103 >>> admin_browser.getControl("PPA support available").selected
104 True
105
106+The page presents a cancellation link that returns the user back to the
107+DistroArchSeries page if clicked:
108+
109+ >>> print admin_browser.getLink("Cancel").url
110+ http://launchpad.dev/ubuntu/warty/i386
111+
112 Removing the PPA support for this DistroArchSeries.
113
114 >>> admin_browser.getControl("PPA support available").selected = False
115+
116+Clicking the "Change" button makes the change and takes the user back to the
117+DistroArchSeries page.
118+
119 >>> admin_browser.getControl("Change").click()
120+ >>> print admin_browser.url
121+ http://launchpad.dev/ubuntu/warty/i386
122+
123+There's also a notification message announcing the success of the change:
124+
125+ >>> for message in get_feedback_messages(admin_browser.contents):
126+ ... print message
127+ Successfully updated
128+
129+Navigating back to the admin page shows the change was made:
130+
131+ >>> admin_browser.getLink("Administer").click()
132
133 >>> admin_browser.getControl("Architecture Tag").value
134 'i386'
135@@ -152,6 +174,7 @@
136
137 The same effect is observed when we make warty/i386 unofficial.
138
139+ >>> admin_browser.getLink("Administer").click()
140 >>> admin_browser.getControl("Official Support").selected = False
141 >>> admin_browser.getControl("Change").click()
142
143
144=== modified file 'lib/lp/soyuz/templates/distributionsourcepackage-publishinghistory.pt'
145--- lib/lp/soyuz/templates/distributionsourcepackage-publishinghistory.pt 2009-07-17 17:59:07 +0000
146+++ lib/lp/soyuz/templates/distributionsourcepackage-publishinghistory.pt 2009-08-17 14:00:03 +0000
147@@ -3,22 +3,19 @@
148 xmlns:tal="http://xml.zope.org/namespaces/tal"
149 xmlns:metal="http://xml.zope.org/namespaces/metal"
150 xmlns:i18n="http://xml.zope.org/namespaces/i18n"
151- xml:lang="en"
152- lang="en"
153- dir="ltr"
154- metal:use-macro="context/@@main_template/master"
155+ metal:use-macro="view/macro:page/main_only"
156 i18n:domain="launchpad"
157 >
158
159 <body>
160
161- <metal:leftportlets fill-slot="portlets_one">
162- <div tal:replace="structure context/@@+portlet-details" />
163- </metal:leftportlets>
164+<div metal:fill-slot="heading">
165+ <h1>Source package publishing history</h1>
166+</div>
167
168 <div metal:fill-slot="main">
169
170- <h1>Source package publishing history</h1>
171+ <div class="top-portlet">
172
173 <table id="publishing-summary" class="listing">
174 <thead>
175@@ -40,6 +37,8 @@
176 </tbody>
177 </table>
178
179+ </div>
180+
181 <p>
182 <a href=".">&laquo;back</a>
183 </p>
184
185=== modified file 'lib/lp/soyuz/templates/distroarchseries-admin.pt'
186--- lib/lp/soyuz/templates/distroarchseries-admin.pt 2009-07-17 17:59:07 +0000
187+++ lib/lp/soyuz/templates/distroarchseries-admin.pt 2009-08-17 13:10:51 +0000
188@@ -3,28 +3,17 @@
189 xmlns:tal="http://xml.zope.org/namespaces/tal"
190 xmlns:metal="http://xml.zope.org/namespaces/metal"
191 xmlns:i18n="http://xml.zope.org/namespaces/i18n"
192- xml:lang="en"
193- lang="en"
194- dir="ltr"
195- metal:use-macro="context/@@main_template/master"
196+ metal:use-macro="view/macro:page/main_only"
197 i18n:domain="launchpad"
198 >
199 <body>
200- <tal:tag condition="view/update"/>
201- <metal:heading fill-slot="pageheading">
202+ <metal:heading fill-slot="heading">
203 <h1>Administer architecture release</h1>
204 </metal:heading>
205
206-<metal:leftportlets fill-slot="portlets_one">
207- <div tal:replace="structure context/@@+portlet-details" />
208-</metal:leftportlets>
209-
210-<metal:rightportlets fill-slot="portlets_two">
211-</metal:rightportlets>
212-
213 <div metal:fill-slot="main">
214
215- <div metal:use-macro="context/@@launchpad_editform/editform">
216+ <div metal:use-macro="context/@@launchpad_form/form">
217
218 <p metal:fill-slot="extra_info" class="exception">
219 <strong>Changing the architecture tag will use large amounts of archive disk space,