Merge lp:~salgado/launchpad/more-coc-three-o into lp:launchpad

Proposed by Guilherme Salgado
Status: Merged
Approved by: Brad Crittenden
Approved revision: no longer in the source branch.
Merged at revision: not available
Proposed branch: lp:~salgado/launchpad/more-coc-three-o
Merge into: lp:launchpad
Diff against target: None lines
To merge this branch: bzr merge lp:~salgado/launchpad/more-coc-three-o
Reviewer Review Type Date Requested Status
Brad Crittenden (community) code Approve
Review via email: mp+10330@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Guilherme Salgado (salgado) wrote :

= Summary =

Convert a couple remaining CoC pages to 3.0

== Proposed fix ==

Use the locationless macro in the pages and put the links inline.

Before/after screenshots at https://devpad.canonical.com/~salgado/coc/

== Pre-implementation notes ==

== Implementation details ==

== Tests ==

./bin/test -vvt stories.gpg-coc

== Demo and Q/A ==

= Launchpad lint =

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

Linting changed files:
  lib/lp/registry/browser/configure.zcml
  lib/lp/registry/templates/codeofconduct-index.pt
  lib/lp/registry/browser/codeofconduct.py
  lib/lp/registry/templates/codeofconduct-list.pt

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

The branch looks nice Salgado.

review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/registry/browser/codeofconduct.py'
2--- lib/lp/registry/browser/codeofconduct.py 2009-08-17 15:36:10 +0000
3+++ lib/lp/registry/browser/codeofconduct.py 2009-08-18 17:15:10 +0000
4@@ -8,8 +8,8 @@
5 __all__ = [
6 'SignedCodeOfConductSetNavigation',
7 'CodeOfConductSetNavigation',
8- 'CodeOfConductContextMenu',
9- 'CodeOfConductSetContextMenu',
10+ 'CodeOfConductOverviewMenu',
11+ 'CodeOfConductSetOverviewMenu',
12 'SignedCodeOfConductSetOverviewMenu',
13 'SignedCodeOfConductOverviewMenu',
14 'CodeOfConductView',
15@@ -27,8 +27,8 @@
16 from zope.component import getUtility
17
18 from canonical.launchpad.webapp import (
19- ApplicationMenu, canonical_url, ContextMenu, Link,
20- enabled_with_permission, GetitemNavigation)
21+ ApplicationMenu, canonical_url, enabled_with_permission,
22+ GetitemNavigation, LaunchpadView, Link)
23 from canonical.launchpad.webapp.launchpadform import action, LaunchpadFormView
24 from canonical.launchpad.webapp.interfaces import ILaunchBag
25 from lp.registry.interfaces.codeofconduct import (
26@@ -45,13 +45,14 @@
27 usedfor = ICodeOfConductSet
28
29
30-class CodeOfConductContextMenu(ContextMenu):
31+class CodeOfConductOverviewMenu(ApplicationMenu):
32
33 usedfor = ICodeOfConduct
34+ facet = 'overview'
35 links = ['sign', 'download']
36
37 def sign(self):
38- text = 'Sign this version'
39+ text = 'Sign it'
40 if (self.context.current and
41 self.user and
42 not self.user.is_ubuntu_coc_signer):
43@@ -67,9 +68,10 @@
44 return Link('+download', text, enabled=is_current, icon='download')
45
46
47-class CodeOfConductSetContextMenu(ContextMenu):
48+class CodeOfConductSetOverviewMenu(ApplicationMenu):
49
50 usedfor = ICodeOfConductSet
51+ facet = 'overview'
52 links = ['admin']
53
54 @enabled_with_permission('launchpad.Admin')
55@@ -114,7 +116,7 @@
56 def __init__(self, context, request):
57 self.context = context
58 self.request = request
59- self.bag = getUtility(ILaunchBag)
60+
61
62 class CodeOfConductDownloadView:
63 """Download view class for CoC page.
64@@ -146,13 +148,9 @@
65 return content
66
67
68-class CodeOfConductSetView:
69+class CodeOfConductSetView(LaunchpadView):
70 """Simple view class for CoCSet page."""
71
72- def __init__(self, context, request):
73- self.context = context
74- self.request = request
75-
76
77 class SignedCodeOfConductAddView(LaunchpadFormView):
78 """Add a new SignedCodeOfConduct Entry."""
79
80=== modified file 'lib/lp/registry/browser/configure.zcml'
81--- lib/lp/registry/browser/configure.zcml 2009-08-18 04:57:21 +0000
82+++ lib/lp/registry/browser/configure.zcml 2009-08-18 17:15:10 +0000
83@@ -145,8 +145,8 @@
84 <browser:menus
85 module="lp.registry.browser.codeofconduct"
86 classes="
87- CodeOfConductContextMenu
88- CodeOfConductSetContextMenu
89+ CodeOfConductOverviewMenu
90+ CodeOfConductSetOverviewMenu
91 SignedCodeOfConductOverviewMenu
92 SignedCodeOfConductSetOverviewMenu"/>
93 <browser:defaultView
94@@ -181,14 +181,12 @@
95 <browser:defaultView
96 for="lp.registry.interfaces.codeofconduct.ICodeOfConductSet"
97 name="+index"/>
98- <browser:pages
99+ <browser:page
100 for="lp.registry.interfaces.codeofconduct.ICodeOfConductSet"
101 class="lp.registry.browser.codeofconduct.CodeOfConductSetView"
102- permission="zope.Public">
103- <browser:page
104- template="../templates/codeofconduct-list.pt"
105- name="+index"/>
106- </browser:pages>
107+ permission="zope.Public"
108+ template="../templates/codeofconduct-list.pt"
109+ name="+index"/>
110 <browser:defaultView
111 for="lp.registry.interfaces.codeofconduct.ISignedCodeOfConduct"
112 name="+index"/>
113
114=== modified file 'lib/lp/registry/stories/gpg-coc/02-signcoc.txt'
115--- lib/lp/registry/stories/gpg-coc/02-signcoc.txt 2009-04-17 10:32:16 +0000
116+++ lib/lp/registry/stories/gpg-coc/02-signcoc.txt 2009-08-18 17:25:41 +0000
117@@ -49,7 +49,7 @@
118
119 We navigate to the current Code page
120 >>> current_coc_link.click()
121- >>> browser.getLink("Sign this version").click()
122+ >>> browser.getLink("Sign it").click()
123 >>> browser.url
124 'http://launchpad.dev/codeofconduct/1.0.1/+sign'
125
126
127=== modified file 'lib/lp/registry/stories/gpg-coc/99-coc-presentation.txt'
128--- lib/lp/registry/stories/gpg-coc/99-coc-presentation.txt 2009-08-17 19:37:59 +0000
129+++ lib/lp/registry/stories/gpg-coc/99-coc-presentation.txt 2009-08-18 17:25:41 +0000
130@@ -34,12 +34,12 @@
131 Back to the CoC front page let's see the current version of the CoC
132
133 >>> browser.open('http://localhost:9000/codeofconduct')
134- >>> browser.getLink('1.0.1').click()
135+ >>> browser.getLink('current version').click()
136
137 >>> 'Ubuntu Code of Conduct - 1.0.1' in browser.contents
138 True
139
140- >>> browser.getLink('Sign this version').url
141+ >>> browser.getLink('Sign it').url
142 'http://localhost:9000/codeofconduct/1.0.1/+sign'
143
144 >>> browser.getLink('Download this version').url
145
146=== modified file 'lib/lp/registry/templates/codeofconduct-index.pt'
147--- lib/lp/registry/templates/codeofconduct-index.pt 2009-07-17 17:59:07 +0000
148+++ lib/lp/registry/templates/codeofconduct-index.pt 2009-08-18 17:15:10 +0000
149@@ -3,26 +3,26 @@
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/locationless"
158 i18n:domain="launchpad"
159 >
160 <body>
161- <metal:heading fill-slot="pageheading">
162+
163+<div metal:fill-slot="main">
164+
165 <h1 tal:content="context/title">Foopy Code</h1>
166- </metal:heading>
167-
168-<div metal:fill-slot="main">
169-
170
171 <p tal:condition="context/current">
172 This is the current version of this code of conduct.
173+ <tal:sign replace="structure context/menu:overview/sign/render" />
174 </p>
175
176 <pre tal:content="context/content">CONTENT</pre>
177
178+ <br />
179+ <p>
180+ <tal:download replace="structure context/menu:overview/download/render" />
181+ </p>
182 </div>
183
184 </body>
185
186=== modified file 'lib/lp/registry/templates/codeofconduct-list.pt'
187--- lib/lp/registry/templates/codeofconduct-list.pt 2009-07-17 18:46:25 +0000
188+++ lib/lp/registry/templates/codeofconduct-list.pt 2009-08-18 17:15:10 +0000
189@@ -3,29 +3,24 @@
190 xmlns:tal="http://xml.zope.org/namespaces/tal"
191 xmlns:metal="http://xml.zope.org/namespaces/metal"
192 xmlns:i18n="http://xml.zope.org/namespaces/i18n"
193- xml:lang="en"
194- lang="en"
195- dir="ltr"
196- metal:use-macro="context/@@main_template/master"
197+ metal:use-macro="view/macro:page/locationless"
198 i18n:domain="launchpad"
199 >
200 <body>
201- <metal:heading fill-slot="pageheading">
202- <h1>Ubuntu Codes of Conduct</h1>
203- </metal:heading>
204
205 <div metal:fill-slot="main"
206- tal:define="user request/lp:person;
207+ tal:define="user view/user;
208 is_ubuntu_coc_signer user/is_ubuntu_coc_signer|nothing;
209 gpgkeys user/gpgkeys|nothing">
210
211- <ul>
212- <li>Current version: <a tal:attributes="href
213- context/current_code_of_conduct/fmt:url"
214- tal:content="context/current_code_of_conduct/version" /></li>
215- <li>Released on: <span
216- tal:replace="context/current_code_of_conduct/datereleased" /></li>
217- </ul>
218+ <h1>Ubuntu Codes of Conduct</h1>
219+ <p>
220+ The <a tal:attributes="href context/current_code_of_conduct/fmt:url">
221+ current version</a> is
222+ <tal:version replace="context/current_code_of_conduct/version" />,
223+ released
224+ <tal:date replace="context/current_code_of_conduct/datereleased/fmt:date" />
225+ </p>
226
227 <div tal:condition="not: is_ubuntu_coc_signer">
228
229@@ -66,12 +61,11 @@
230 </ol>
231 </div>
232
233- <div tal:condition="is_ubuntu_coc_signer">
234+ <p tal:condition="is_ubuntu_coc_signer">
235 Congratulations; you have already <a tal:attributes="href
236 string:${user/fmt:url}/+codesofconduct">signed</a> the Ubuntu Code
237 of Conduct.
238-
239- </div>
240+ </p>
241
242 <h2>Older (obsolete) versions of the Code of Conduct</h2>
243
244@@ -83,6 +77,11 @@
245 </tal:not_current>
246 </tal:codes>
247 </ul>
248+
249+ <br />
250+ <p>
251+ <a tal:replace="structure context/menu:overview/admin/render" />
252+ </p>
253
254 </div>
255
256