Merge lp:~henninge/launchpad/bug-467079 into lp:launchpad
- bug-467079
- Merge into devel
Status: | Merged |
---|---|
Approved by: | Henning Eggers |
Approved revision: | no longer in the source branch. |
Merged at revision: | not available |
Proposed branch: | lp:~henninge/launchpad/bug-467079 |
Merge into: | lp:launchpad |
Diff against target: |
152 lines (+27/-21) 4 files modified
lib/canonical/launchpad/icing/style-3-0.css (+6/-1) lib/canonical/launchpad/templates/root-index.pt (+5/-5) lib/lp/registry/browser/root.py (+1/-6) lib/lp/registry/stories/launchpad-root/xx-featuredprojects.txt (+15/-9) |
To merge this branch: | bzr merge lp:~henninge/launchpad/bug-467079 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Curtis Hovey (community) | code | Approve | |
Michael Nelson (community) | release-critical | Abstain | |
Paul Hummer (community) | code | Approve | |
Review via email: mp+14264@code.launchpad.net |
Commit message
Description of the change
Henning Eggers (henninge) wrote : | # |
Paul Hummer (rockstar) : | # |
Michael Nelson (michael.nelson) wrote : | # |
Hi Henning,
Thanks for fixing this! I'd prefer to see this land on edge next week - I can't classify it as a blocker, but I won't be offended if you get a second opinion :)
Curtis Hovey (sinzui) wrote : | # |
Hi Henning.
review needs-fixing
Your view and CSS changes are good. The narrative of the story needs
revising. It is not a story. The narrative must explain what is seen and
happens from the users perspective. *We* care about contracts, and if
this test ware really about what *we* want to create, we could
instantiate the view, call render() and verify the markup much easier in
a view test.
I do not see how this test can pass. It checks for ids that do not exist
since the columns table-column properties were replace with simple CSS.
On Tue, 2009-11-17 at 17:23 +0000, Henning Eggers wrote:
> === modified file 'lib/lp/
> --- lib/lp/
> +++ lib/lp/
> @@ -24,21 +24,32 @@
> >>> print extract_
> Featured projects
>
> -We show the featured projects in our sample data, the "project of the day" is
> -"GNOME" and it is listed first:
> +We show the featured projects in our sample data. The "project of the day"
> +is "GNOME" and it is listed separately:
Any user can see the Launchpad featured projects. The project of the day
is listed separately.
> - >>> for link in featured.
> - ... print extract_text(link)
> + >>> top_project = find_tag_
> + >>> print extract_
> GNOME
> +
> +These are the projects in the left column.
He see's content in a left column.
--but I cannot see how this will work because the template does not have
these ids, we let the stylesheet do the layout. There is a single list
that we need to test. If the layout is changed in the CSS, we do not
need to worry about the test breaking. This was one of the 3.0 UI
goals--no brittle tests that verifies markup. While this does not verify
the markup, it still feels like it is trying to force a two column
table.
> + >>> def print_column(
> + ... column = find_tag_
> + ... for link in column.
> + ... print extract_text(link)
> + >>> print_column(
> Gnome Applets
> Bazaar
> Mozilla Firefox
> Gentoo
> +
> +These are the projects in the right column.
And content in a right column.
-- but I know that this test will fail
> + >>> print_column(
> GNOME Terminal
> the Mozilla Project
> Mozilla Thunderbird
> Ubuntu
> - Browse all ... projects
>
> == Adding a featured project ==
>
> @@ -88,19 +99,27 @@
>
> >>> anon_browser.open('http://
> >>> featured = find_tag_
> - >>> for link in featured.
> - ... print extract_text(link)
> + >>> top_project = find_tag_
> + >>> print extract_
> Gentoo
I am not sure 'odd' is important here if we change the css, to be 3
column or 1 column it will not be odd. As...
Henning Eggers (henninge) wrote : | # |
Am 18.11.2009 01:18, Curtis Hovey schrieb:
> Review: Needs Fixing
> Hi Henning.
>
> review needs-fixing
>
> Your view and CSS changes are good.
Thanks, great to hear.
> The narrative of the story needs
> revising. It is not a story. The narrative must explain what is seen and
> happens from the users perspective. *We* care about contracts, and if
> this test ware really about what *we* want to create, we could
> instantiate the view, call render() and verify the markup much easier in
> a view test.
Ok, I reworded the test in that manner.
>
> I do not see how this test can pass. It checks for ids that do not exist
> since the columns table-column properties were replace with simple CSS.
I am very sorry but I knew that and I thought I had told you about it on
IRC yesterday. I just didn't have the time to update the test. This test
was still referring to the changes I had originally introduced. Again,
sorry for getting you confused...
I fixed the the test and also changed an id in the template to a class
because the id was used twice. I'll paste the incremental diff.
Cheers,
Henning
Henning Eggers (henninge) wrote : | # |
=== modified file 'lib/canonical/
--- lib/canonical/
+++ lib/canonical/
@@ -51,14 +51,14 @@
}
- .featured-project h3 {
+ .featured-
}
- .featured-project h3 img {
+ .featured-
}
- .featured-project p {
+ .featured-
@@ -226,7 +226,7 @@
<div id="homepage-
- <div class="
+ <div class="
@@ -241,7 +241,7 @@
<div class="
- <ul id="homepage-
+ <ul class="
=== modified file 'lib/lp/
--- lib/lp/
+++ lib/lp/
@@ -19,33 +19,26 @@
>>> from lp.registry.
>>> LaunchpadRootIn
... fake_get_
+
+Anonymous users will see the list of featured projects with links to the
+projects' pages in Launchpad. The "project of the day" is listed separately.
+
>>> anon_browser.open('http://
>>> featured = find_tag_
>>> print extract_
Featured projects
-We show the featured projects in our sample data. The "project of the day"
-is "GNOME" and it is listed separately:
-
- >>> top_project = find_tag_
- >>> print extract_
+ >>> top_project = featured.find('', 'featured-
+ >>> print extract_
GNOME
-These are the projects in the left column.
-
- >>> def print_column(
- ... column = find_tag_
- ... for link in column.
- ... print extract_text(link)
- >>> print_column(
+ >>> featured_list = featured.find('', 'featured-
+ >>> for link in featured_
+ ... print extract_text(link)
Gnome Applets
Bazaar
Mozilla Firefox
Gentoo
-
-These are the projects in the ri...
Curtis Hovey (sinzui) wrote : | # |
Thanks for removing the limitiation
Preview Diff
1 | === modified file 'lib/canonical/launchpad/icing/style-3-0.css' | |||
2 | --- lib/canonical/launchpad/icing/style-3-0.css 2009-11-13 17:49:40 +0000 | |||
3 | +++ lib/canonical/launchpad/icing/style-3-0.css 2009-11-18 11:26:12 +0000 | |||
4 | @@ -471,13 +471,18 @@ | |||
5 | 471 | ol.subordinate { | 471 | ol.subordinate { |
6 | 472 | margin-left: 4em; | 472 | margin-left: 4em; |
7 | 473 | } | 473 | } |
8 | 474 | .two-column-list li, | ||
9 | 475 | .two-column-list dl { | 474 | .two-column-list dl { |
10 | 476 | width: 48%; | 475 | width: 48%; |
11 | 477 | float: left; | 476 | float: left; |
12 | 478 | display: inline; | 477 | display: inline; |
13 | 479 | margin: 0 0.25em 0.75em 0; | 478 | margin: 0 0.25em 0.75em 0; |
14 | 480 | } | 479 | } |
15 | 480 | .two-column-list li { | ||
16 | 481 | width: 48%; | ||
17 | 482 | float: left; | ||
18 | 483 | display: inline; | ||
19 | 484 | margin: 0 0.25em 0 0; | ||
20 | 485 | } | ||
21 | 481 | .two-column-list:after { | 486 | .two-column-list:after { |
22 | 482 | content: "."; | 487 | content: "."; |
23 | 483 | display: block; | 488 | display: block; |
24 | 484 | 489 | ||
25 | === modified file 'lib/canonical/launchpad/templates/root-index.pt' | |||
26 | --- lib/canonical/launchpad/templates/root-index.pt 2009-11-13 18:03:35 +0000 | |||
27 | +++ lib/canonical/launchpad/templates/root-index.pt 2009-11-18 11:26:12 +0000 | |||
28 | @@ -51,14 +51,14 @@ | |||
29 | 51 | margin-top: 1em; | 51 | margin-top: 1em; |
30 | 52 | font-size: 161%; | 52 | font-size: 161%; |
31 | 53 | } | 53 | } |
33 | 54 | .featured-project h3 { | 54 | .featured-project-top h3 { |
34 | 55 | font-size: 131%; | 55 | font-size: 131%; |
35 | 56 | font-weight: bold; | 56 | font-weight: bold; |
36 | 57 | } | 57 | } |
38 | 58 | .featured-project h3 img { | 58 | .featured-project-top h3 img { |
39 | 59 | vertical-align: middle; | 59 | vertical-align: middle; |
40 | 60 | } | 60 | } |
42 | 61 | .featured-project p { | 61 | .featured-project-top p { |
43 | 62 | margin-top: 0.5em; | 62 | margin-top: 0.5em; |
44 | 63 | margin-bottom: 1em; | 63 | margin-bottom: 1em; |
45 | 64 | border-bottom: 1px solid #888888; | 64 | border-bottom: 1px solid #888888; |
46 | @@ -226,7 +226,7 @@ | |||
47 | 226 | <div id="homepage-featured" class="homepage-portlet"> | 226 | <div id="homepage-featured" class="homepage-portlet"> |
48 | 227 | <h2>Featured projects</h2> | 227 | <h2>Featured projects</h2> |
49 | 228 | 228 | ||
51 | 229 | <div class="featured-project" | 229 | <div class="featured-project-top" |
52 | 230 | tal:define="topproject view/featured_projects_top" | 230 | tal:define="topproject view/featured_projects_top" |
53 | 231 | tal:condition="topproject"> | 231 | tal:condition="topproject"> |
54 | 232 | <h3> | 232 | <h3> |
55 | @@ -241,7 +241,7 @@ | |||
56 | 241 | </div> | 241 | </div> |
57 | 242 | 242 | ||
58 | 243 | <div class="two-column-list"> | 243 | <div class="two-column-list"> |
60 | 244 | <ul id="homepage-featured"> | 244 | <ul class="featured-projects-list"> |
61 | 245 | <li tal:repeat="project view/featured_projects"> | 245 | <li tal:repeat="project view/featured_projects"> |
62 | 246 | <a tal:replace="structure project/fmt:link" /> | 246 | <a tal:replace="structure project/fmt:link" /> |
63 | 247 | </li> | 247 | </li> |
64 | 248 | 248 | ||
65 | === modified file 'lib/lp/registry/browser/root.py' | |||
66 | --- lib/lp/registry/browser/root.py 2009-11-13 18:23:59 +0000 | |||
67 | +++ lib/lp/registry/browser/root.py 2009-11-18 11:26:12 +0000 | |||
68 | @@ -54,10 +54,6 @@ | |||
69 | 54 | class LaunchpadRootIndexView(HasAnnouncementsView, LaunchpadView): | 54 | class LaunchpadRootIndexView(HasAnnouncementsView, LaunchpadView): |
70 | 55 | """An view for the default view of the LaunchpadRoot.""" | 55 | """An view for the default view of the LaunchpadRoot.""" |
71 | 56 | 56 | ||
72 | 57 | # The homepage has two columns to hold featured projects. This | ||
73 | 58 | # determines the number of projects we display in each column. | ||
74 | 59 | FEATURED_PROJECT_ROWS = 11 | ||
75 | 60 | |||
76 | 61 | featured_projects = [] | 57 | featured_projects = [] |
77 | 62 | featured_projects_top = None | 58 | featured_projects_top = None |
78 | 63 | 59 | ||
79 | @@ -75,9 +71,8 @@ | |||
80 | 75 | super(LaunchpadRootIndexView, self).initialize() | 71 | super(LaunchpadRootIndexView, self).initialize() |
81 | 76 | # The maximum number of projects to be displayed as defined by the | 72 | # The maximum number of projects to be displayed as defined by the |
82 | 77 | # number of items plus one top featured project. | 73 | # number of items plus one top featured project. |
83 | 78 | max_projects = self.FEATURED_PROJECT_ROWS + 1 | ||
84 | 79 | self.featured_projects = list( | 74 | self.featured_projects = list( |
86 | 80 | getUtility(IPillarNameSet).featured_projects)[:max_projects] | 75 | getUtility(IPillarNameSet).featured_projects) |
87 | 81 | self._setFeaturedProjectsTop() | 76 | self._setFeaturedProjectsTop() |
88 | 82 | 77 | ||
89 | 83 | def _setFeaturedProjectsTop(self): | 78 | def _setFeaturedProjectsTop(self): |
90 | 84 | 79 | ||
91 | === modified file 'lib/lp/registry/stories/launchpad-root/xx-featuredprojects.txt' | |||
92 | --- lib/lp/registry/stories/launchpad-root/xx-featuredprojects.txt 2009-09-21 14:48:17 +0000 | |||
93 | +++ lib/lp/registry/stories/launchpad-root/xx-featuredprojects.txt 2009-11-18 11:26:12 +0000 | |||
94 | @@ -19,17 +19,22 @@ | |||
95 | 19 | >>> from lp.registry.browser.root import LaunchpadRootIndexView | 19 | >>> from lp.registry.browser.root import LaunchpadRootIndexView |
96 | 20 | >>> LaunchpadRootIndexView._get_day_of_year = staticmethod( | 20 | >>> LaunchpadRootIndexView._get_day_of_year = staticmethod( |
97 | 21 | ... fake_get_day_of_year) | 21 | ... fake_get_day_of_year) |
98 | 22 | |||
99 | 23 | Anonymous users will see the list of featured projects with links to the | ||
100 | 24 | projects' pages in Launchpad. The "project of the day" is listed separately. | ||
101 | 25 | |||
102 | 22 | >>> anon_browser.open('http://launchpad.dev/') | 26 | >>> anon_browser.open('http://launchpad.dev/') |
103 | 23 | >>> featured = find_tag_by_id(anon_browser.contents, 'homepage-featured') | 27 | >>> featured = find_tag_by_id(anon_browser.contents, 'homepage-featured') |
104 | 24 | >>> print extract_text(featured.h2) | 28 | >>> print extract_text(featured.h2) |
105 | 25 | Featured projects | 29 | Featured projects |
106 | 26 | 30 | ||
109 | 27 | We show the featured projects in our sample data, the "project of the day" is | 31 | >>> top_project = featured.find('', 'featured-project-top') |
110 | 28 | "GNOME" and it is listed first: | 32 | >>> print extract_text(top_project.h3) |
111 | 33 | GNOME | ||
112 | 29 | 34 | ||
114 | 30 | >>> for link in featured.findAll('a'): | 35 | >>> featured_list = featured.find('', 'featured-projects-list') |
115 | 36 | >>> for link in featured_list.findAll('a'): | ||
116 | 31 | ... print extract_text(link) | 37 | ... print extract_text(link) |
117 | 32 | GNOME | ||
118 | 33 | Gnome Applets | 38 | Gnome Applets |
119 | 34 | Bazaar | 39 | Bazaar |
120 | 35 | Mozilla Firefox | 40 | Mozilla Firefox |
121 | @@ -38,7 +43,6 @@ | |||
122 | 38 | the Mozilla Project | 43 | the Mozilla Project |
123 | 39 | Mozilla Thunderbird | 44 | Mozilla Thunderbird |
124 | 40 | Ubuntu | 45 | Ubuntu |
125 | 41 | Browse all ... projects | ||
126 | 42 | 46 | ||
127 | 43 | == Adding a featured project == | 47 | == Adding a featured project == |
128 | 44 | 48 | ||
129 | @@ -88,9 +92,13 @@ | |||
130 | 88 | 92 | ||
131 | 89 | >>> anon_browser.open('http://launchpad.dev/') | 93 | >>> anon_browser.open('http://launchpad.dev/') |
132 | 90 | >>> featured = find_tag_by_id(anon_browser.contents, 'homepage-featured') | 94 | >>> featured = find_tag_by_id(anon_browser.contents, 'homepage-featured') |
134 | 91 | >>> for link in featured.findAll('a'): | 95 | >>> top_project = featured.find('', 'featured-project-top') |
135 | 96 | >>> print extract_text(top_project.h3) | ||
136 | 97 | Gentoo | ||
137 | 98 | |||
138 | 99 | >>> featured_list = featured.find('', 'featured-projects-list') | ||
139 | 100 | >>> for link in featured_list.findAll('a'): | ||
140 | 92 | ... print extract_text(link) | 101 | ... print extract_text(link) |
141 | 93 | Gentoo | ||
142 | 94 | Apache | 102 | Apache |
143 | 95 | Gnome Applets | 103 | Gnome Applets |
144 | 96 | Bazaar | 104 | Bazaar |
145 | @@ -100,8 +108,6 @@ | |||
146 | 100 | the Mozilla Project | 108 | the Mozilla Project |
147 | 101 | Mozilla Thunderbird | 109 | Mozilla Thunderbird |
148 | 102 | Ubuntu | 110 | Ubuntu |
149 | 103 | Browse all ... projects | ||
150 | 104 | |||
151 | 105 | 111 | ||
152 | 106 | == Removing a project == | 112 | == Removing a project == |
153 | 107 | 113 |
= Bug 467079 =
The list of featured projects on the home page had a fixed length, an error which I introduced last cylcle although the old solution was bad too. It capped the first column at a fixed number and let the second grow to infinivity.
== Proposed fix ==
Dynamically calculate the length for each column according to the number of featured projects minus the top featured project. If the number is odd, make the first column one longer.
== Text ==
bin/test -vvct featuredprojects
== Demo/QA ==
Look at the homepage and see if Ubuntu and Zope are visible again ...
= 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/ root.py registry/ stories/ launchpad- root/xx- featuredproject s.txt
lib/lp/
lib/lp/
== Pylint notices ==
lib/lp/ registry/ browser/ root.py gator.z3batchin g' (No module named batchnavigator) ch.__iter_ _] Use super on an old style class
45: [F0401] Unable to import 'lazr.batchnavi
509: [E1002, WindowedListBat