Merge lp:~salgado/launchpad/team-page-tweaks into lp:launchpad

Proposed by Guilherme Salgado
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
Reviewer Review Type Date Requested Status
Curtis Hovey (community) Approve
Review via email: mp+11468@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Guilherme Salgado (salgado) wrote :

= 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:
  lib/lp/registry/browser/configure.zcml
  lib/lp/registry/templates/team-index.pt
  lib/lp/registry/templates/team-portlet-polls.pt
  lib/lp/registry/stories/foaf/xx-team-home.txt
  lib/lp/registry/browser/person.py
  lib/lp/registry/templates/person-related-software-navlinks.pt
  lib/lp/soyuz/templates/person-portlet-ppas.pt
  lib/lp/registry/templates/person-macros.pt
  lib/lp/registry/templates/team-portlet-membership.pt

== Pylint notices ==

lib/lp/registry/browser/person.py
    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.interface' (No module
named restful)

Revision history for this message
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/registry/browser/person.py'
> --- lib/lp/registry/browser/person.py 2009-09-08 14:07:32 +0000
> +++ lib/lp/registry/browser/person.py 2009-09-09 18:50:13 +0000
...

> @@ -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/registry/stories/foaf/xx-team-home.txt'
> --- lib/lp/registry/stories/foaf/xx-team-home.txt 2009-09-01 00:49:34 +0000
> +++ lib/lp/registry/stories/foaf/xx-team-home.txt 2009-09-09 18:50:13 +0000

...

> @@ -60,9 +62,10 @@
> Show polls
>
> >>> browser.open('http://launchpad.dev/~launchpad')
> - >>> print extract_text(find_tag_by_id(browser.contents, 'polls'))
> - Polls
> - No polls created.
> + >>> from BeautifulSoup import BeautifulSoup, SoupStrainer
> + >>> print BeautifulSoup(
> + ... browser.contents, parseOnlyThese=SoupStrainer(id='polls'))
> + <BLANKLINE>

We agreed that this is the better way to test:

    >>> print find_tag_by_id(browser.contents, 'polls')
    None

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'lib/lp/registry/browser/configure.zcml'
--- lib/lp/registry/browser/configure.zcml 2009-09-09 09:24:47 +0000
+++ lib/lp/registry/browser/configure.zcml 2009-09-09 18:50:13 +0000
@@ -1042,6 +1042,12 @@
1042 template="../templates/team-index.pt"/>1042 template="../templates/team-index.pt"/>
1043 <browser:page1043 <browser:page
1044 for="lp.registry.interfaces.person.ITeam"1044 for="lp.registry.interfaces.person.ITeam"
1045 class="lp.registry.browser.person.TeamIndexView"
1046 permission="zope.Public"
1047 name="+portlet-polls"
1048 template="../templates/team-portlet-polls.pt"/>
1049 <browser:page
1050 for="lp.registry.interfaces.person.ITeam"
1045 permission="zope.Public"1051 permission="zope.Public"
1046 class="lp.registry.browser.team.TeamMapView"1052 class="lp.registry.browser.team.TeamMapView"
1047 name="+map"1053 name="+map"
10481054
=== modified file 'lib/lp/registry/browser/person.py'
--- lib/lp/registry/browser/person.py 2009-09-08 14:07:32 +0000
+++ lib/lp/registry/browser/person.py 2009-09-09 18:50:13 +0000
@@ -853,12 +853,6 @@
853 text = 'Change home page'853 text = 'Change home page'
854 return Link(target, text, icon='edit')854 return Link(target, text, icon='edit')
855855
856 def related_projects(self):
857 target = '+related-software#projects'
858 text = 'List related projects'
859 summary = 'Projects %s is involved with' % self.context.displayname
860 return Link(target, text, summary, icon='product')
861
862 @enabled_with_permission('launchpad.Edit')856 @enabled_with_permission('launchpad.Edit')
863 def activate_ppa(self):857 def activate_ppa(self):
864 target = "+activate-ppa"858 target = "+activate-ppa"
@@ -867,14 +861,14 @@
867 'Package Archive and create a new PPA.')861 'Package Archive and create a new PPA.')
868 return Link(target, text, summary, icon='add')862 return Link(target, text, summary, icon='add')
869863
870 def summary(self):864 def related_software_summary(self):
871 target = '+related-software'865 target = '+related-software'
872 text = 'Summary'866 text = 'Summary'
873 return Link(target, text, icon='info')867 return Link(target, text, icon='info')
874868
875 def maintained(self):869 def maintained(self):
876 target = '+maintained-packages'870 target = '+maintained-packages'
877 text = 'Maintained Packages'871 text = 'Maintained packages'
878 enabled = bool(self.person.getLatestMaintainedPackages())872 enabled = bool(self.person.getLatestMaintainedPackages())
879 return Link(target, text, enabled=enabled, icon='info')873 return Link(target, text, enabled=enabled, icon='info')
880874
@@ -884,11 +878,15 @@
884 return Link(target, text, icon='info')878 return Link(target, text, icon='info')
885879
886 def ppa(self):880 def ppa(self):
881 # XXX: salgado, 2009-09-09, bug=426899: Need to conditionally disable
882 # this link.
887 target = '+ppa-packages'883 target = '+ppa-packages'
888 text = 'PPA Packages'884 text = 'PPA Packages'
889 return Link(target, text, icon='info')885 return Link(target, text, icon='info')
890886
891 def projects(self):887 def projects(self):
888 # XXX: salgado, 2009-09-09, bug=426900: Need to conditionally disable
889 # this link.
892 target = '+related-projects'890 target = '+related-projects'
893 text = 'Related Projects'891 text = 'Related Projects'
894 return Link(target, text, icon='info')892 return Link(target, text, icon='info')
@@ -903,7 +901,7 @@
903 'editircnicknames', 'editjabberids', 'editpassword',901 'editircnicknames', 'editjabberids', 'editpassword',
904 'editsshkeys', 'editpgpkeys', 'editlocation', 'memberships',902 'editsshkeys', 'editpgpkeys', 'editlocation', 'memberships',
905 'mentoringoffers', 'codesofconduct', 'karma',903 'mentoringoffers', 'codesofconduct', 'karma',
906 'administer', 'related_projects', 'activate_ppa', 'maintained',904 'administer', 'projects', 'activate_ppa', 'maintained',
907 'view_ppa_subscriptions']905 'view_ppa_subscriptions']
908906
909 @enabled_with_permission('launchpad.Edit')907 @enabled_with_permission('launchpad.Edit')
@@ -1080,7 +1078,8 @@
10801078
1081 usedfor = IPersonRelatedSoftwareMenu1079 usedfor = IPersonRelatedSoftwareMenu
1082 facet = 'overview'1080 facet = 'overview'
1083 links = ('summary', 'maintained', 'uploaded', 'ppa', 'projects')1081 links = ('related_software_summary', 'maintained', 'uploaded', 'ppa',
1082 'projects')
10841083
1085 @property1084 @property
1086 def person(self):1085 def person(self):
@@ -1297,8 +1296,7 @@
1297 'editemail', 'configure_mailing_list', 'moderate_mailing_list',1296 'editemail', 'configure_mailing_list', 'moderate_mailing_list',
1298 'editlanguages', 'map', 'polls',1297 'editlanguages', 'map', 'polls',
1299 'add_poll', 'join', 'leave', 'add_my_teams', 'mentorships',1298 'add_poll', 'join', 'leave', 'add_my_teams', 'mentorships',
1300 'reassign', 'related_projects',1299 'reassign', 'projects', 'activate_ppa', 'maintained', 'ppa']
1301 'activate_ppa', 'maintained']
13021300
13031301
1304class TeamOverviewNavigationMenu(NavigationMenu, TeamMenuMixin):1302class TeamOverviewNavigationMenu(NavigationMenu, TeamMenuMixin):
@@ -2780,6 +2778,10 @@
2780 else:2778 else:
2781 raise AssertionError('Unknown group to contact.')2779 raise AssertionError('Unknown group to contact.')
27822780
2781 def should_show_polls_portlet(self):
2782 menu = TeamOverviewMenu(self.context)
2783 return self.hasCurrentPolls() or menu.add_poll().enabled
2784
2783 def hasCurrentPolls(self):2785 def hasCurrentPolls(self):
2784 """Return True if this team has any non-closed polls."""2786 """Return True if this team has any non-closed polls."""
2785 assert self.context.isTeam()2787 assert self.context.isTeam()
27862788
=== modified file 'lib/lp/registry/stories/foaf/xx-team-home.txt'
--- lib/lp/registry/stories/foaf/xx-team-home.txt 2009-09-01 00:49:34 +0000
+++ lib/lp/registry/stories/foaf/xx-team-home.txt 2009-09-09 18:50:13 +0000
@@ -36,8 +36,12 @@
36 2005-06-0636 2005-06-06
3737
38 >>> print extract_text(38 >>> print extract_text(
39 ... find_tag_by_id(browser.contents, 'subscription-policy'))
40 Subscription policy:
41 Moderated Team
42
43 >>> print extract_text(
39 ... find_tag_by_id(browser.contents, 'membership-summary'))44 ... find_tag_by_id(browser.contents, 'membership-summary'))
40 This is a Moderated Team.
41 10 active members, 1 invited members, 2 proposed members...45 10 active members, 1 invited members, 2 proposed members...
4246
43 >>> print extract_text(47 >>> print extract_text(
@@ -49,10 +53,8 @@
49 ... find_tag_by_id(browser.contents, 'contact-languages'))53 ... find_tag_by_id(browser.contents, 'contact-languages'))
50 Languages:54 Languages:
51 English55 English
52 Set preferred languages
5356
54The polls portlet only shows a link to view all polls if current57The polls portlet is only shown if current polls exist.
55polls exist.
5658
57 >>> print extract_text(find_tag_by_id(browser.contents, 'polls'))59 >>> print extract_text(find_tag_by_id(browser.contents, 'polls'))
58 Polls60 Polls
@@ -60,9 +62,10 @@
60 Show polls62 Show polls
6163
62 >>> browser.open('http://launchpad.dev/~launchpad')64 >>> browser.open('http://launchpad.dev/~launchpad')
63 >>> print extract_text(find_tag_by_id(browser.contents, 'polls'))65 >>> from BeautifulSoup import BeautifulSoup, SoupStrainer
64 Polls66 >>> print BeautifulSoup(
65 No polls created.67 ... browser.contents, parseOnlyThese=SoupStrainer(id='polls'))
68 <BLANKLINE>
6669
67The subteam-of portlet is not shown if the team is not a subteam.70The subteam-of portlet is not shown if the team is not a subteam.
6871
@@ -129,6 +132,7 @@
129 Email:132 Email:
130 Contact this team's email address133 Contact this team's email address
131 support@ubuntu.com134 support@ubuntu.com
135 Set contact address
132136
133Member can contact their team even if the team does not have a contact137Member can contact their team even if the team does not have a contact
134address:138address:
135139
=== modified file 'lib/lp/registry/templates/person-macros.pt'
--- lib/lp/registry/templates/person-macros.pt 2009-09-01 00:32:01 +0000
+++ lib/lp/registry/templates/person-macros.pt 2009-09-09 18:50:13 +0000
@@ -35,8 +35,7 @@
35 <div style="white-space: nowrap">35 <div style="white-space: nowrap">
36 <img src="/@@/mail" alt="mail" />36 <img src="/@@/mail" alt="mail" />
37 <tal:email replace="email">foo2@bar.com</tal:email>37 <tal:email replace="email">foo2@bar.com</tal:email>
38 <a class="sprite edit"38 <a tal:replace="structure overview_menu/editemail/fmt:icon"></a>
39 tal:attributes="href overview_menu/editemail/fmt:url"></a>
40 </div>39 </div>
41 </tal:emails>40 </tal:emails>
42 <a tal:condition="not: view/visible_email_addresses"41 <a tal:condition="not: view/visible_email_addresses"
@@ -65,9 +64,15 @@
65 <dt>Languages:</dt>64 <dt>Languages:</dt>
66 <dd>65 <dd>
67 <tal:languages content="view/languages">English</tal:languages>66 <tal:languages content="view/languages">English</tal:languages>
68 <a tal:attributes="href overview_menu/editlanguages/fmt:url"67 <a tal:replace="structure overview_menu/editlanguages/fmt:icon" />
69 class="sprite edit">68 </dd>
70 <span class="invisible-link">Set preferred languages</span></a>69 </dl>
70 <dl id="subscription-policy">
71 <dt>Subscription policy:</dt>
72 <dd>
73 <span tal:replace="context/subscriptionpolicy/title" />
74 <img src="/@@/maybe"
75 tal:attributes="title context/subscriptionpolicy/description" />
71 </dd>76 </dd>
72 </dl>77 </dl>
7378
7479
=== modified file 'lib/lp/registry/templates/person-related-software-navlinks.pt'
--- lib/lp/registry/templates/person-related-software-navlinks.pt 2009-09-08 14:37:17 +0000
+++ lib/lp/registry/templates/person-related-software-navlinks.pt 2009-09-09 18:50:13 +0000
@@ -6,7 +6,8 @@
66
7 <ul id="navlinks" class="horizontal">7 <ul id="navlinks" class="horizontal">
8 <li>8 <li>
9 <a tal:replace="structure view/menu:navigation/summary/render"/></li>9 <a tal:replace="structure
10 view/menu:navigation/related_software_summary/render"/></li>
10 <li>11 <li>
11 <a tal:replace="structure view/menu:navigation/maintained/render"/></li>12 <a tal:replace="structure view/menu:navigation/maintained/render"/></li>
12 <li>13 <li>
1314
=== modified file 'lib/lp/registry/templates/team-index.pt'
--- lib/lp/registry/templates/team-index.pt 2009-08-28 00:57:32 +0000
+++ lib/lp/registry/templates/team-index.pt 2009-09-09 18:50:13 +0000
@@ -43,54 +43,8 @@
43 </ul>43 </ul>
4444
45 <tal:menu replace="structure view/@@+global-actions" />45 <tal:menu replace="structure view/@@+global-actions" />
4646 <tal:polls replace="structure context/@@+portlet-polls" />
47 <div id="polls" class="portlet">47
48 <h2>Polls</h2>
49 <p tal:condition="not: view/hasCurrentPolls">
50 No polls created.
51 </p>
52
53 <ul tal:condition="view/hasCurrentPolls">
54 <li tal:repeat="poll view/openpolls">
55 <a tal:attributes="href poll/fmt:url">
56 <span tal:replace="poll/title" />
57 </a> - closes
58 <span
59 tal:attributes="title poll/datecloses/fmt:datetime"
60 tal:content="poll/datecloses/fmt:displaydate" />.
61
62 <tal:block define="user request/lp:person" condition="user">
63 <tal:block condition="python: poll.personVoted(user)">
64 You have
65 <span tal:replace="poll/closesIn/fmt:approximateduration" />
66 to change your vote if you wish.
67 </tal:block>
68
69 <tal:block condition="python: not poll.personVoted(user)">
70 You have
71 <span tal:replace="poll/closesIn/fmt:approximateduration" />
72 left to vote in this poll.
73 </tal:block>
74 </tal:block>
75
76 </li>
77
78 <li tal:condition="view/userIsOwner"
79 tal:repeat="poll view/notyetopenedpolls">
80 <a tal:attributes="href poll/fmt:url">
81 <span tal:replace="poll/title" />
82 </a> - opens
83 <span
84 tal:attributes="title poll/dateopens/fmt:datetime"
85 tal:content="poll/dateopens/fmt:displaydate" />
86 </li>
87 </ul>
88
89 <a tal:condition="view/hasCurrentPolls"
90 tal:replace="structure overview_menu/polls/fmt:link" />
91 <a tal:replace="structure overview_menu/add_poll/fmt:link" />
92
93 </div>
94</div>48</div>
9549
96<!-- heading slot. -->50<!-- heading slot. -->
@@ -111,6 +65,20 @@
111 class="description"65 class="description"
112 tal:content="structure context/teamdescription/fmt:text-to-html"66 tal:content="structure context/teamdescription/fmt:text-to-html"
113 />67 />
68 <ul class="horizontal">
69 <li
70 tal:define="link context/menu:overview/projects"
71 tal:condition="link/enabled"
72 tal:content="structure link/fmt:link" />
73 <li
74 tal:define="link context/menu:overview/maintained"
75 tal:condition="link/enabled"
76 tal:content="structure link/fmt:link" />
77 <li
78 tal:define="link context/menu:overview/ppa"
79 tal:condition="link/enabled"
80 tal:content="structure link/fmt:link" />
81 </ul>
114</div>82</div>
11583
116<!-- main slot. -->84<!-- main slot. -->
@@ -120,16 +88,16 @@
120 <div class="yui-g">88 <div class="yui-g">
121 <!-- First portlet column. -->89 <!-- First portlet column. -->
122 <div class="first yui-u">90 <div class="first yui-u">
123 <div tal:content="structure context/@@+portlet-membership" />91 <metal:details use-macro="context/@@+person-macros/team-details" />
124 <div tal:content="structure context/@@+portlet-ppas" />92 <div tal:content="structure context/@@+portlet-ppas" />
125 <metal:subteam-of use-macro="context/@@+person-macros/subteam-of" />93 <div tal:content="structure context/@@+portlet-mailinglist" />
126 </div>94 </div>
12795
128 <!-- Second portlet column. -->96 <!-- Second portlet column. -->
129 <div class="yui-u">97 <div class="yui-u">
130 <metal:details use-macro="context/@@+person-macros/team-details" />98 <div tal:content="structure context/@@+portlet-membership" />
131 <div tal:content="structure context/@@+portlet-related-projects" />99 <div tal:content="structure context/@@+portlet-related-projects" />
132 <div tal:content="structure context/@@+portlet-mailinglist" />100 <metal:subteam-of use-macro="context/@@+person-macros/subteam-of" />
133 </div>101 </div>
134 </div>102 </div>
135103
136104
=== modified file 'lib/lp/registry/templates/team-portlet-membership.pt'
--- lib/lp/registry/templates/team-portlet-membership.pt 2009-09-03 17:20:42 +0000
+++ lib/lp/registry/templates/team-portlet-membership.pt 2009-09-09 18:53:47 +0000
@@ -17,13 +17,6 @@
17 <div id="membership-summary" class="portletBody portletContent"17 <div id="membership-summary" class="portletBody portletContent"
18 style="margin-bottom: 1.5em;">18 style="margin-bottom: 1.5em;">
19 <div id="membership-summary">19 <div id="membership-summary">
20 This is a
21 <span>
22 <strong id="subscription-policy"
23 tal:content="context/subscriptionpolicy/title" />.
24 <img src="/@@/maybe"
25 tal:attributes="title context/subscriptionpolicy/description" />
26 </span>
27 <div>20 <div>
28 <img src="/@@/team" alt="team" />21 <img src="/@@/team" alt="team" />
29 <strong><tal:active content="context/all_member_count" /></strong>22 <strong><tal:active content="context/all_member_count" /></strong>
@@ -128,4 +121,5 @@
128 </tr>121 </tr>
129 </table>122 </table>
130 </tal:can-view>123 </tal:can-view>
124</div>
131</tal:root>125</tal:root>
132126
=== added file 'lib/lp/registry/templates/team-portlet-polls.pt'
--- lib/lp/registry/templates/team-portlet-polls.pt 1970-01-01 00:00:00 +0000
+++ lib/lp/registry/templates/team-portlet-polls.pt 2009-09-09 18:50:13 +0000
@@ -0,0 +1,56 @@
1<tal:root
2 xmlns:tal="http://xml.zope.org/namespaces/tal"
3 xmlns:metal="http://xml.zope.org/namespaces/metal"
4 xmlns:i18n="http://xml.zope.org/namespaces/i18n"
5 omit-tag="">
6
7 <div id="polls" class="portlet"
8 tal:define="overview_menu context/menu:overview"
9 tal:condition="view/should_show_polls_portlet">
10 <h2>Polls</h2>
11 <p tal:condition="not: view/hasCurrentPolls">
12 No polls created.
13 </p>
14
15 <ul tal:condition="view/hasCurrentPolls">
16 <li tal:repeat="poll view/openpolls">
17 <a tal:attributes="href poll/fmt:url">
18 <span tal:replace="poll/title" />
19 </a> - closes
20 <span
21 tal:attributes="title poll/datecloses/fmt:datetime"
22 tal:content="poll/datecloses/fmt:displaydate" />.
23
24 <tal:block define="user request/lp:person" condition="user">
25 <tal:block condition="python: poll.personVoted(user)">
26 You have
27 <span tal:replace="poll/closesIn/fmt:approximateduration" />
28 to change your vote if you wish.
29 </tal:block>
30
31 <tal:block condition="python: not poll.personVoted(user)">
32 You have
33 <span tal:replace="poll/closesIn/fmt:approximateduration" />
34 left to vote in this poll.
35 </tal:block>
36 </tal:block>
37
38 </li>
39
40 <li tal:condition="view/userIsOwner"
41 tal:repeat="poll view/notyetopenedpolls">
42 <a tal:attributes="href poll/fmt:url">
43 <span tal:replace="poll/title" />
44 </a> - opens
45 <span
46 tal:attributes="title poll/dateopens/fmt:datetime"
47 tal:content="poll/dateopens/fmt:displaydate" />
48 </li>
49 </ul>
50
51 <a tal:condition="view/hasCurrentPolls"
52 tal:replace="structure overview_menu/polls/fmt:link" />
53 <a tal:replace="structure overview_menu/add_poll/fmt:link" />
54
55 </div>
56</tal:root>
057
=== modified file 'lib/lp/soyuz/templates/person-portlet-ppas.pt'
--- lib/lp/soyuz/templates/person-portlet-ppas.pt 2009-08-21 15:16:48 +0000
+++ lib/lp/soyuz/templates/person-portlet-ppas.pt 2009-09-09 18:50:13 +0000
@@ -15,10 +15,6 @@
15 tal:condition="link/enabled"15 tal:condition="link/enabled"
16 tal:content="structure link/fmt:icon-link" />16 tal:content="structure link/fmt:icon-link" />
1717
18 <li tal:define="link context/menu:overview/maintained"
19 tal:condition="link/enabled"
20 tal:replace="structure link/fmt:icon-link" />
21
22 <tal:is-person condition="not: context/is_team">18 <tal:is-person condition="not: context/is_team">
23 <li tal:define="link context/menu:overview/view_ppa_subscriptions"19 <li tal:define="link context/menu:overview/view_ppa_subscriptions"
24 tal:condition="link/enabled"20 tal:condition="link/enabled"
2521