Merge lp:~brian-murray/launchpad/bug-485229 into lp:launchpad/db-devel

Proposed by Brian Murray
Status: Merged
Approved by: Deryck Hodge
Approved revision: not available
Merged at revision: not available
Proposed branch: lp:~brian-murray/launchpad/bug-485229
Merge into: lp:launchpad/db-devel
Diff against target: 183 lines (+36/-23)
6 files modified
lib/canonical/launchpad/icing/style-3-0.css (+6/-1)
lib/canonical/launchpad/templates/root-index.pt (+5/-5)
lib/lp/bugs/browser/bugtarget.py (+1/-1)
lib/lp/registry/browser/root.py (+1/-6)
lib/lp/registry/stories/launchpad-root/xx-featuredprojects.txt (+15/-9)
sourcecode/Makefile (+8/-1)
To merge this branch: bzr merge lp:~brian-murray/launchpad/bug-485229
Reviewer Review Type Date Requested Status
Paul Hummer (community) Approve
Deryck Hodge (community) code Approve
Review via email: mp+15040@code.launchpad.net

Commit message

Modify sorting of unofficial tags so that the most popular ones are returned.

To post a comment you must log in.
Revision history for this message
Brian Murray (brian-murray) wrote :

Fix the sorting of popular bug tags by using reverse.

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

As we talked about here at UDS, I think we need a test to confirm this change produces the condition we expect -- i.e. that only the ten top tags are showing in the portlet.

I'll work up a test for you sometime in the next couple of days to demonstrate this.

review: Needs Fixing (code)
Revision history for this message
Deryck Hodge (deryck) wrote :

Here's the test I added:

=== modified file 'lib/lp/bugs/stories/bug-tags/xx-official-bug-tags.txt'
--- lib/lp/bugs/stories/bug-tags/xx-official-bug-tags.txt 2009-09-22 19:57:40 +0000
+++ lib/lp/bugs/stories/bug-tags/xx-official-bug-tags.txt 2009-11-20 16:46:24 +0000
@@ -139,6 +139,53 @@
     unofficial-tag-09
     unofficial-tag-10

+The 10 unofficial tags will be the 10 most popular tags. To demonstrate
+this, two additional bugs are created and unofficial tags 11 and 12 are
+added to those bugs.
+
+ >>> login('<email address hidden>')
+ >>> watersocks = factory.makeProduct(name='watersocks')
+ >>> watersocks_bugs_url = canonical_url(watersocks, rootsite='bugs')
+ >>> watersocks.official_bug_tags = [
+ ... u'official-tag-%02d' % idx for idx in range(1, 13)]
+ >>> ws_bug = factory.makeBug(product=watersocks)
+ >>> ws_bug.tags = [
+ ... u'unofficial-tag-%02d' % idx for idx in range(1, 13)]
+ >>> ws_bug_two = factory.makeBug(product=watersocks)
+ >>> ws_bug_two.tags = [u'unofficial-tag-11', u'unofficial-tag-12']
+ >>> ws_bug_three = factory.makeBug(product=watersocks)
+ >>> ws_bug_three.tags = [u'unofficial-tag-11', u'unofficial-tag-12']
+ >>> transaction.commit()
+ >>> logout()
+
+ >>> browser.open(watersocks_bugs_url + '/+bugtarget-portlet-tags-content')
+ >>> print_tags_portlet(browser.contents)
+ Tags
+ ----
+ official-tag-01
+ official-tag-02
+ official-tag-03
+ official-tag-04
+ official-tag-05
+ official-tag-06
+ official-tag-07
+ official-tag-08
+ official-tag-09
+ official-tag-10
+ official-tag-11
+ official-tag-12
+ unofficial-tag-01
+ unofficial-tag-02
+ unofficial-tag-03
+ unofficial-tag-04
+ unofficial-tag-05
+ unofficial-tag-06
+ unofficial-tag-07
+ unofficial-tag-08
+ unofficial-tag-11
+ unofficial-tag-12
+
+
 == Entering Official Tags ==

 === Available Official Tags in Javascript ===

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

Approved for brian's part. rockstar will review mine test.

review: Approve (code)
Revision history for this message
Paul Hummer (rockstar) :
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/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-19 15:05:35 +0000
4@@ -471,13 +471,18 @@
5 ol.subordinate {
6 margin-left: 4em;
7 }
8-.two-column-list li,
9 .two-column-list dl {
10 width: 48%;
11 float: left;
12 display: inline;
13 margin: 0 0.25em 0.75em 0;
14 }
15+.two-column-list li {
16+ width: 48%;
17+ float: left;
18+ display: inline;
19+ margin: 0 0.25em 0 0;
20+ }
21 .two-column-list:after {
22 content: ".";
23 display: block;
24
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-19 15:05:35 +0000
28@@ -51,14 +51,14 @@
29 margin-top: 1em;
30 font-size: 161%;
31 }
32- .featured-project h3 {
33+ .featured-project-top h3 {
34 font-size: 131%;
35 font-weight: bold;
36 }
37- .featured-project h3 img {
38+ .featured-project-top h3 img {
39 vertical-align: middle;
40 }
41- .featured-project p {
42+ .featured-project-top p {
43 margin-top: 0.5em;
44 margin-bottom: 1em;
45 border-bottom: 1px solid #888888;
46@@ -226,7 +226,7 @@
47 <div id="homepage-featured" class="homepage-portlet">
48 <h2>Featured projects</h2>
49
50- <div class="featured-project"
51+ <div class="featured-project-top"
52 tal:define="topproject view/featured_projects_top"
53 tal:condition="topproject">
54 <h3>
55@@ -241,7 +241,7 @@
56 </div>
57
58 <div class="two-column-list">
59- <ul id="homepage-featured">
60+ <ul class="featured-projects-list">
61 <li tal:repeat="project view/featured_projects">
62 <a tal:replace="structure project/fmt:link" />
63 </li>
64
65=== modified file 'lib/lp/bugs/browser/bugtarget.py'
66--- lib/lp/bugs/browser/bugtarget.py 2009-11-06 21:06:38 +0000
67+++ lib/lp/bugs/browser/bugtarget.py 2009-11-19 15:05:35 +0000
68@@ -1201,7 +1201,7 @@
69 tags = self.getUsedBugTagsWithURLs()
70 other_tags = [tag for tag in tags if tag['tag'] not in official_tags]
71 popular_tags = [tag['tag'] for tag in sorted(
72- other_tags, key=itemgetter('count'))[:10]]
73+ other_tags, key=itemgetter('count'), reverse=True)[:10]]
74 tags = [
75 tag for tag in tags
76 if tag['tag'] in official_tags + popular_tags]
77
78=== modified file 'lib/lp/registry/browser/root.py'
79--- lib/lp/registry/browser/root.py 2009-11-13 18:23:59 +0000
80+++ lib/lp/registry/browser/root.py 2009-11-19 15:05:35 +0000
81@@ -54,10 +54,6 @@
82 class LaunchpadRootIndexView(HasAnnouncementsView, LaunchpadView):
83 """An view for the default view of the LaunchpadRoot."""
84
85- # The homepage has two columns to hold featured projects. This
86- # determines the number of projects we display in each column.
87- FEATURED_PROJECT_ROWS = 11
88-
89 featured_projects = []
90 featured_projects_top = None
91
92@@ -75,9 +71,8 @@
93 super(LaunchpadRootIndexView, self).initialize()
94 # The maximum number of projects to be displayed as defined by the
95 # number of items plus one top featured project.
96- max_projects = self.FEATURED_PROJECT_ROWS + 1
97 self.featured_projects = list(
98- getUtility(IPillarNameSet).featured_projects)[:max_projects]
99+ getUtility(IPillarNameSet).featured_projects)
100 self._setFeaturedProjectsTop()
101
102 def _setFeaturedProjectsTop(self):
103
104=== modified file 'lib/lp/registry/stories/launchpad-root/xx-featuredprojects.txt'
105--- lib/lp/registry/stories/launchpad-root/xx-featuredprojects.txt 2009-09-21 14:48:17 +0000
106+++ lib/lp/registry/stories/launchpad-root/xx-featuredprojects.txt 2009-11-19 15:05:35 +0000
107@@ -19,17 +19,22 @@
108 >>> from lp.registry.browser.root import LaunchpadRootIndexView
109 >>> LaunchpadRootIndexView._get_day_of_year = staticmethod(
110 ... fake_get_day_of_year)
111+
112+Anonymous users will see the list of featured projects with links to the
113+projects' pages in Launchpad. The "project of the day" is listed separately.
114+
115 >>> anon_browser.open('http://launchpad.dev/')
116 >>> featured = find_tag_by_id(anon_browser.contents, 'homepage-featured')
117 >>> print extract_text(featured.h2)
118 Featured projects
119
120-We show the featured projects in our sample data, the "project of the day" is
121-"GNOME" and it is listed first:
122+ >>> top_project = featured.find('', 'featured-project-top')
123+ >>> print extract_text(top_project.h3)
124+ GNOME
125
126- >>> for link in featured.findAll('a'):
127+ >>> featured_list = featured.find('', 'featured-projects-list')
128+ >>> for link in featured_list.findAll('a'):
129 ... print extract_text(link)
130- GNOME
131 Gnome Applets
132 Bazaar
133 Mozilla Firefox
134@@ -38,7 +43,6 @@
135 the Mozilla Project
136 Mozilla Thunderbird
137 Ubuntu
138- Browse all ... projects
139
140 == Adding a featured project ==
141
142@@ -88,9 +92,13 @@
143
144 >>> anon_browser.open('http://launchpad.dev/')
145 >>> featured = find_tag_by_id(anon_browser.contents, 'homepage-featured')
146- >>> for link in featured.findAll('a'):
147+ >>> top_project = featured.find('', 'featured-project-top')
148+ >>> print extract_text(top_project.h3)
149+ Gentoo
150+
151+ >>> featured_list = featured.find('', 'featured-projects-list')
152+ >>> for link in featured_list.findAll('a'):
153 ... print extract_text(link)
154- Gentoo
155 Apache
156 Gnome Applets
157 Bazaar
158@@ -100,8 +108,6 @@
159 the Mozilla Project
160 Mozilla Thunderbird
161 Ubuntu
162- Browse all ... projects
163-
164
165 == Removing a project ==
166
167
168=== modified file 'sourcecode/Makefile'
169--- sourcecode/Makefile 2009-10-31 12:07:16 +0000
170+++ sourcecode/Makefile 2009-11-19 15:05:35 +0000
171@@ -25,4 +25,11 @@
172 fi;\
173 done
174
175-.PHONY: check all build
176+clean:
177+ @ for subdir in ${build_dirs}; do\
178+ if [ -e $$subdir/Makefile ]; then\
179+ (cd $$subdir && bzr clean-tree --ignored --force) || exit $$?;\
180+ fi;\
181+ done
182+
183+.PHONY: check all build clean

Subscribers

People subscribed via source and target branches

to status/vote changes: