Merge lp:~salgado/launchpad/team-page-tweaks into lp:launchpad
- team-page-tweaks
- Merge into devel
Status: | Merged |
---|---|
Approved by: | Curtis Hovey |
Approved revision: | no longer in the source branch. |
Merged at revision: | not available |
Proposed branch: | lp:~salgado/launchpad/team-page-tweaks |
Merge into: | lp:launchpad |
Diff against target: | None lines |
To merge this branch: | bzr merge lp:~salgado/launchpad/team-page-tweaks |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Curtis Hovey (community) | Approve | ||
Review via email: mp+11468@code.launchpad.net |
Commit message
Description of the change
Guilherme Salgado (salgado) wrote : | # |
Curtis Hovey (sinzui) wrote : | # |
Hi Guilherme.
I really appreciate these fixes. I looked at the UI and we agreed that the top two portlets are guaranteed to display so we can place them in their own <div class="yui-g"> to make them align.
I recorded our IRC conversation inline.
> === modified file 'lib/lp/
> --- lib/lp/
> +++ lib/lp/
...
> @@ -884,11 +878,15 @@
> return Link(target, text, icon='info')
>
> def ppa(self):
> + # XXX: salgado, 2009-09-09, bug=426899: Need to conditionally disable
> + # this link.
> target = '+ppa-packages'
> text = 'PPA Packages'
> return Link(target, text, icon='info')
>
> def projects(self):
> + # XXX: salgado, 2009-09-09, bug=426900: Need to conditionally disable
> + # this link.
We agreed this is harder to do than the time we have allotted to fix these
issues.
...
> === modified file 'lib/lp/
> --- lib/lp/
> +++ lib/lp/
...
> @@ -60,9 +62,10 @@
> Show polls
>
> >>> browser.open('http://
> - >>> print extract_
> - Polls
> - No polls created.
> + >>> from BeautifulSoup import BeautifulSoup, SoupStrainer
> + >>> print BeautifulSoup(
> + ... browser.contents, parseOnlyThese=
> + <BLANKLINE>
We agreed that this is the better way to test:
>>> print find_tag_
None
Preview Diff
1 | === modified file 'lib/lp/registry/browser/configure.zcml' |
2 | --- lib/lp/registry/browser/configure.zcml 2009-09-09 09:24:47 +0000 |
3 | +++ lib/lp/registry/browser/configure.zcml 2009-09-09 18:50:13 +0000 |
4 | @@ -1042,6 +1042,12 @@ |
5 | template="../templates/team-index.pt"/> |
6 | <browser:page |
7 | for="lp.registry.interfaces.person.ITeam" |
8 | + class="lp.registry.browser.person.TeamIndexView" |
9 | + permission="zope.Public" |
10 | + name="+portlet-polls" |
11 | + template="../templates/team-portlet-polls.pt"/> |
12 | + <browser:page |
13 | + for="lp.registry.interfaces.person.ITeam" |
14 | permission="zope.Public" |
15 | class="lp.registry.browser.team.TeamMapView" |
16 | name="+map" |
17 | |
18 | === modified file 'lib/lp/registry/browser/person.py' |
19 | --- lib/lp/registry/browser/person.py 2009-09-08 14:07:32 +0000 |
20 | +++ lib/lp/registry/browser/person.py 2009-09-09 18:50:13 +0000 |
21 | @@ -853,12 +853,6 @@ |
22 | text = 'Change home page' |
23 | return Link(target, text, icon='edit') |
24 | |
25 | - def related_projects(self): |
26 | - target = '+related-software#projects' |
27 | - text = 'List related projects' |
28 | - summary = 'Projects %s is involved with' % self.context.displayname |
29 | - return Link(target, text, summary, icon='product') |
30 | - |
31 | @enabled_with_permission('launchpad.Edit') |
32 | def activate_ppa(self): |
33 | target = "+activate-ppa" |
34 | @@ -867,14 +861,14 @@ |
35 | 'Package Archive and create a new PPA.') |
36 | return Link(target, text, summary, icon='add') |
37 | |
38 | - def summary(self): |
39 | + def related_software_summary(self): |
40 | target = '+related-software' |
41 | text = 'Summary' |
42 | return Link(target, text, icon='info') |
43 | |
44 | def maintained(self): |
45 | target = '+maintained-packages' |
46 | - text = 'Maintained Packages' |
47 | + text = 'Maintained packages' |
48 | enabled = bool(self.person.getLatestMaintainedPackages()) |
49 | return Link(target, text, enabled=enabled, icon='info') |
50 | |
51 | @@ -884,11 +878,15 @@ |
52 | return Link(target, text, icon='info') |
53 | |
54 | def ppa(self): |
55 | + # XXX: salgado, 2009-09-09, bug=426899: Need to conditionally disable |
56 | + # this link. |
57 | target = '+ppa-packages' |
58 | text = 'PPA Packages' |
59 | return Link(target, text, icon='info') |
60 | |
61 | def projects(self): |
62 | + # XXX: salgado, 2009-09-09, bug=426900: Need to conditionally disable |
63 | + # this link. |
64 | target = '+related-projects' |
65 | text = 'Related Projects' |
66 | return Link(target, text, icon='info') |
67 | @@ -903,7 +901,7 @@ |
68 | 'editircnicknames', 'editjabberids', 'editpassword', |
69 | 'editsshkeys', 'editpgpkeys', 'editlocation', 'memberships', |
70 | 'mentoringoffers', 'codesofconduct', 'karma', |
71 | - 'administer', 'related_projects', 'activate_ppa', 'maintained', |
72 | + 'administer', 'projects', 'activate_ppa', 'maintained', |
73 | 'view_ppa_subscriptions'] |
74 | |
75 | @enabled_with_permission('launchpad.Edit') |
76 | @@ -1080,7 +1078,8 @@ |
77 | |
78 | usedfor = IPersonRelatedSoftwareMenu |
79 | facet = 'overview' |
80 | - links = ('summary', 'maintained', 'uploaded', 'ppa', 'projects') |
81 | + links = ('related_software_summary', 'maintained', 'uploaded', 'ppa', |
82 | + 'projects') |
83 | |
84 | @property |
85 | def person(self): |
86 | @@ -1297,8 +1296,7 @@ |
87 | 'editemail', 'configure_mailing_list', 'moderate_mailing_list', |
88 | 'editlanguages', 'map', 'polls', |
89 | 'add_poll', 'join', 'leave', 'add_my_teams', 'mentorships', |
90 | - 'reassign', 'related_projects', |
91 | - 'activate_ppa', 'maintained'] |
92 | + 'reassign', 'projects', 'activate_ppa', 'maintained', 'ppa'] |
93 | |
94 | |
95 | class TeamOverviewNavigationMenu(NavigationMenu, TeamMenuMixin): |
96 | @@ -2780,6 +2778,10 @@ |
97 | else: |
98 | raise AssertionError('Unknown group to contact.') |
99 | |
100 | + def should_show_polls_portlet(self): |
101 | + menu = TeamOverviewMenu(self.context) |
102 | + return self.hasCurrentPolls() or menu.add_poll().enabled |
103 | + |
104 | def hasCurrentPolls(self): |
105 | """Return True if this team has any non-closed polls.""" |
106 | assert self.context.isTeam() |
107 | |
108 | === modified file 'lib/lp/registry/stories/foaf/xx-team-home.txt' |
109 | --- lib/lp/registry/stories/foaf/xx-team-home.txt 2009-09-01 00:49:34 +0000 |
110 | +++ lib/lp/registry/stories/foaf/xx-team-home.txt 2009-09-09 18:50:13 +0000 |
111 | @@ -36,8 +36,12 @@ |
112 | 2005-06-06 |
113 | |
114 | >>> print extract_text( |
115 | + ... find_tag_by_id(browser.contents, 'subscription-policy')) |
116 | + Subscription policy: |
117 | + Moderated Team |
118 | + |
119 | + >>> print extract_text( |
120 | ... find_tag_by_id(browser.contents, 'membership-summary')) |
121 | - This is a Moderated Team. |
122 | 10 active members, 1 invited members, 2 proposed members... |
123 | |
124 | >>> print extract_text( |
125 | @@ -49,10 +53,8 @@ |
126 | ... find_tag_by_id(browser.contents, 'contact-languages')) |
127 | Languages: |
128 | English |
129 | - Set preferred languages |
130 | |
131 | -The polls portlet only shows a link to view all polls if current |
132 | -polls exist. |
133 | +The polls portlet is only shown if current polls exist. |
134 | |
135 | >>> print extract_text(find_tag_by_id(browser.contents, 'polls')) |
136 | Polls |
137 | @@ -60,9 +62,10 @@ |
138 | Show polls |
139 | |
140 | >>> browser.open('http://launchpad.dev/~launchpad') |
141 | - >>> print extract_text(find_tag_by_id(browser.contents, 'polls')) |
142 | - Polls |
143 | - No polls created. |
144 | + >>> from BeautifulSoup import BeautifulSoup, SoupStrainer |
145 | + >>> print BeautifulSoup( |
146 | + ... browser.contents, parseOnlyThese=SoupStrainer(id='polls')) |
147 | + <BLANKLINE> |
148 | |
149 | The subteam-of portlet is not shown if the team is not a subteam. |
150 | |
151 | @@ -129,6 +132,7 @@ |
152 | Email: |
153 | Contact this team's email address |
154 | support@ubuntu.com |
155 | + Set contact address |
156 | |
157 | Member can contact their team even if the team does not have a contact |
158 | address: |
159 | |
160 | === modified file 'lib/lp/registry/templates/person-macros.pt' |
161 | --- lib/lp/registry/templates/person-macros.pt 2009-09-01 00:32:01 +0000 |
162 | +++ lib/lp/registry/templates/person-macros.pt 2009-09-09 18:50:13 +0000 |
163 | @@ -35,8 +35,7 @@ |
164 | <div style="white-space: nowrap"> |
165 | <img src="/@@/mail" alt="mail" /> |
166 | <tal:email replace="email">foo2@bar.com</tal:email> |
167 | - <a class="sprite edit" |
168 | - tal:attributes="href overview_menu/editemail/fmt:url"></a> |
169 | + <a tal:replace="structure overview_menu/editemail/fmt:icon"></a> |
170 | </div> |
171 | </tal:emails> |
172 | <a tal:condition="not: view/visible_email_addresses" |
173 | @@ -65,9 +64,15 @@ |
174 | <dt>Languages:</dt> |
175 | <dd> |
176 | <tal:languages content="view/languages">English</tal:languages> |
177 | - <a tal:attributes="href overview_menu/editlanguages/fmt:url" |
178 | - class="sprite edit"> |
179 | - <span class="invisible-link">Set preferred languages</span></a> |
180 | + <a tal:replace="structure overview_menu/editlanguages/fmt:icon" /> |
181 | + </dd> |
182 | + </dl> |
183 | + <dl id="subscription-policy"> |
184 | + <dt>Subscription policy:</dt> |
185 | + <dd> |
186 | + <span tal:replace="context/subscriptionpolicy/title" /> |
187 | + <img src="/@@/maybe" |
188 | + tal:attributes="title context/subscriptionpolicy/description" /> |
189 | </dd> |
190 | </dl> |
191 | |
192 | |
193 | === modified file 'lib/lp/registry/templates/person-related-software-navlinks.pt' |
194 | --- lib/lp/registry/templates/person-related-software-navlinks.pt 2009-09-08 14:37:17 +0000 |
195 | +++ lib/lp/registry/templates/person-related-software-navlinks.pt 2009-09-09 18:50:13 +0000 |
196 | @@ -6,7 +6,8 @@ |
197 | |
198 | <ul id="navlinks" class="horizontal"> |
199 | <li> |
200 | - <a tal:replace="structure view/menu:navigation/summary/render"/></li> |
201 | + <a tal:replace="structure |
202 | + view/menu:navigation/related_software_summary/render"/></li> |
203 | <li> |
204 | <a tal:replace="structure view/menu:navigation/maintained/render"/></li> |
205 | <li> |
206 | |
207 | === modified file 'lib/lp/registry/templates/team-index.pt' |
208 | --- lib/lp/registry/templates/team-index.pt 2009-08-28 00:57:32 +0000 |
209 | +++ lib/lp/registry/templates/team-index.pt 2009-09-09 18:50:13 +0000 |
210 | @@ -43,54 +43,8 @@ |
211 | </ul> |
212 | |
213 | <tal:menu replace="structure view/@@+global-actions" /> |
214 | - |
215 | - <div id="polls" class="portlet"> |
216 | - <h2>Polls</h2> |
217 | - <p tal:condition="not: view/hasCurrentPolls"> |
218 | - No polls created. |
219 | - </p> |
220 | - |
221 | - <ul tal:condition="view/hasCurrentPolls"> |
222 | - <li tal:repeat="poll view/openpolls"> |
223 | - <a tal:attributes="href poll/fmt:url"> |
224 | - <span tal:replace="poll/title" /> |
225 | - </a> - closes |
226 | - <span |
227 | - tal:attributes="title poll/datecloses/fmt:datetime" |
228 | - tal:content="poll/datecloses/fmt:displaydate" />. |
229 | - |
230 | - <tal:block define="user request/lp:person" condition="user"> |
231 | - <tal:block condition="python: poll.personVoted(user)"> |
232 | - You have |
233 | - <span tal:replace="poll/closesIn/fmt:approximateduration" /> |
234 | - to change your vote if you wish. |
235 | - </tal:block> |
236 | - |
237 | - <tal:block condition="python: not poll.personVoted(user)"> |
238 | - You have |
239 | - <span tal:replace="poll/closesIn/fmt:approximateduration" /> |
240 | - left to vote in this poll. |
241 | - </tal:block> |
242 | - </tal:block> |
243 | - |
244 | - </li> |
245 | - |
246 | - <li tal:condition="view/userIsOwner" |
247 | - tal:repeat="poll view/notyetopenedpolls"> |
248 | - <a tal:attributes="href poll/fmt:url"> |
249 | - <span tal:replace="poll/title" /> |
250 | - </a> - opens |
251 | - <span |
252 | - tal:attributes="title poll/dateopens/fmt:datetime" |
253 | - tal:content="poll/dateopens/fmt:displaydate" /> |
254 | - </li> |
255 | - </ul> |
256 | - |
257 | - <a tal:condition="view/hasCurrentPolls" |
258 | - tal:replace="structure overview_menu/polls/fmt:link" /> |
259 | - <a tal:replace="structure overview_menu/add_poll/fmt:link" /> |
260 | - |
261 | - </div> |
262 | + <tal:polls replace="structure context/@@+portlet-polls" /> |
263 | + |
264 | </div> |
265 | |
266 | <!-- heading slot. --> |
267 | @@ -111,6 +65,20 @@ |
268 | class="description" |
269 | tal:content="structure context/teamdescription/fmt:text-to-html" |
270 | /> |
271 | + <ul class="horizontal"> |
272 | + <li |
273 | + tal:define="link context/menu:overview/projects" |
274 | + tal:condition="link/enabled" |
275 | + tal:content="structure link/fmt:link" /> |
276 | + <li |
277 | + tal:define="link context/menu:overview/maintained" |
278 | + tal:condition="link/enabled" |
279 | + tal:content="structure link/fmt:link" /> |
280 | + <li |
281 | + tal:define="link context/menu:overview/ppa" |
282 | + tal:condition="link/enabled" |
283 | + tal:content="structure link/fmt:link" /> |
284 | + </ul> |
285 | </div> |
286 | |
287 | <!-- main slot. --> |
288 | @@ -120,16 +88,16 @@ |
289 | <div class="yui-g"> |
290 | <!-- First portlet column. --> |
291 | <div class="first yui-u"> |
292 | - <div tal:content="structure context/@@+portlet-membership" /> |
293 | + <metal:details use-macro="context/@@+person-macros/team-details" /> |
294 | <div tal:content="structure context/@@+portlet-ppas" /> |
295 | - <metal:subteam-of use-macro="context/@@+person-macros/subteam-of" /> |
296 | + <div tal:content="structure context/@@+portlet-mailinglist" /> |
297 | </div> |
298 | |
299 | <!-- Second portlet column. --> |
300 | <div class="yui-u"> |
301 | - <metal:details use-macro="context/@@+person-macros/team-details" /> |
302 | + <div tal:content="structure context/@@+portlet-membership" /> |
303 | <div tal:content="structure context/@@+portlet-related-projects" /> |
304 | - <div tal:content="structure context/@@+portlet-mailinglist" /> |
305 | + <metal:subteam-of use-macro="context/@@+person-macros/subteam-of" /> |
306 | </div> |
307 | </div> |
308 | |
309 | |
310 | === modified file 'lib/lp/registry/templates/team-portlet-membership.pt' |
311 | --- lib/lp/registry/templates/team-portlet-membership.pt 2009-09-03 17:20:42 +0000 |
312 | +++ lib/lp/registry/templates/team-portlet-membership.pt 2009-09-09 18:53:47 +0000 |
313 | @@ -17,13 +17,6 @@ |
314 | <div id="membership-summary" class="portletBody portletContent" |
315 | style="margin-bottom: 1.5em;"> |
316 | <div id="membership-summary"> |
317 | - This is a |
318 | - <span> |
319 | - <strong id="subscription-policy" |
320 | - tal:content="context/subscriptionpolicy/title" />. |
321 | - <img src="/@@/maybe" |
322 | - tal:attributes="title context/subscriptionpolicy/description" /> |
323 | - </span> |
324 | <div> |
325 | <img src="/@@/team" alt="team" /> |
326 | <strong><tal:active content="context/all_member_count" /></strong> |
327 | @@ -128,4 +121,5 @@ |
328 | </tr> |
329 | </table> |
330 | </tal:can-view> |
331 | +</div> |
332 | </tal:root> |
333 | |
334 | === added file 'lib/lp/registry/templates/team-portlet-polls.pt' |
335 | --- lib/lp/registry/templates/team-portlet-polls.pt 1970-01-01 00:00:00 +0000 |
336 | +++ lib/lp/registry/templates/team-portlet-polls.pt 2009-09-09 18:50:13 +0000 |
337 | @@ -0,0 +1,56 @@ |
338 | +<tal:root |
339 | + xmlns:tal="http://xml.zope.org/namespaces/tal" |
340 | + xmlns:metal="http://xml.zope.org/namespaces/metal" |
341 | + xmlns:i18n="http://xml.zope.org/namespaces/i18n" |
342 | + omit-tag=""> |
343 | + |
344 | + <div id="polls" class="portlet" |
345 | + tal:define="overview_menu context/menu:overview" |
346 | + tal:condition="view/should_show_polls_portlet"> |
347 | + <h2>Polls</h2> |
348 | + <p tal:condition="not: view/hasCurrentPolls"> |
349 | + No polls created. |
350 | + </p> |
351 | + |
352 | + <ul tal:condition="view/hasCurrentPolls"> |
353 | + <li tal:repeat="poll view/openpolls"> |
354 | + <a tal:attributes="href poll/fmt:url"> |
355 | + <span tal:replace="poll/title" /> |
356 | + </a> - closes |
357 | + <span |
358 | + tal:attributes="title poll/datecloses/fmt:datetime" |
359 | + tal:content="poll/datecloses/fmt:displaydate" />. |
360 | + |
361 | + <tal:block define="user request/lp:person" condition="user"> |
362 | + <tal:block condition="python: poll.personVoted(user)"> |
363 | + You have |
364 | + <span tal:replace="poll/closesIn/fmt:approximateduration" /> |
365 | + to change your vote if you wish. |
366 | + </tal:block> |
367 | + |
368 | + <tal:block condition="python: not poll.personVoted(user)"> |
369 | + You have |
370 | + <span tal:replace="poll/closesIn/fmt:approximateduration" /> |
371 | + left to vote in this poll. |
372 | + </tal:block> |
373 | + </tal:block> |
374 | + |
375 | + </li> |
376 | + |
377 | + <li tal:condition="view/userIsOwner" |
378 | + tal:repeat="poll view/notyetopenedpolls"> |
379 | + <a tal:attributes="href poll/fmt:url"> |
380 | + <span tal:replace="poll/title" /> |
381 | + </a> - opens |
382 | + <span |
383 | + tal:attributes="title poll/dateopens/fmt:datetime" |
384 | + tal:content="poll/dateopens/fmt:displaydate" /> |
385 | + </li> |
386 | + </ul> |
387 | + |
388 | + <a tal:condition="view/hasCurrentPolls" |
389 | + tal:replace="structure overview_menu/polls/fmt:link" /> |
390 | + <a tal:replace="structure overview_menu/add_poll/fmt:link" /> |
391 | + |
392 | + </div> |
393 | +</tal:root> |
394 | |
395 | === modified file 'lib/lp/soyuz/templates/person-portlet-ppas.pt' |
396 | --- lib/lp/soyuz/templates/person-portlet-ppas.pt 2009-08-21 15:16:48 +0000 |
397 | +++ lib/lp/soyuz/templates/person-portlet-ppas.pt 2009-09-09 18:50:13 +0000 |
398 | @@ -15,10 +15,6 @@ |
399 | tal:condition="link/enabled" |
400 | tal:content="structure link/fmt:icon-link" /> |
401 | |
402 | - <li tal:define="link context/menu:overview/maintained" |
403 | - tal:condition="link/enabled" |
404 | - tal:replace="structure link/fmt:icon-link" /> |
405 | - |
406 | <tal:is-person condition="not: context/is_team"> |
407 | <li tal:define="link context/menu:overview/view_ppa_subscriptions" |
408 | tal:condition="link/enabled" |
409 |
= Summary =
Fix a bunch of trivial bugs on the team-index page.
== Proposed fix ==
Fix
Bug 423080
Bug 423085
Bug 423091
Bug 423681
As part of it I moved the polls portlet into a separate file and got rid
of a now-unused menu link from CommonLinksMixin
= Launchpad lint =
Checking for conflicts. and issues in doctests and templates.
Running jslint, xmllint, pyflakes, and pylint.
Using normal rules.
Linting changed files: registry/ browser/ configure. zcml registry/ templates/ team-index. pt registry/ templates/ team-portlet- polls.pt registry/ stories/ foaf/xx- team-home. txt registry/ browser/ person. py registry/ templates/ person- related- software- navlinks. pt soyuz/templates /person- portlet- ppas.pt registry/ templates/ person- macros. pt registry/ templates/ team-portlet- membership. pt
lib/lp/
lib/lp/
lib/lp/
lib/lp/
lib/lp/
lib/lp/
lib/lp/
lib/lp/
lib/lp/
== Pylint notices ==
lib/lp/ registry/ browser/ person. py interface' (No module
118: [F0401] Unable to import 'lazr.delegates' (No module named
delegates)
119: [F0401] Unable to import 'lazr.config' (No module named config)
120: [F0401] Unable to import 'lazr.restful.
named restful)