Skip to content
Browse files

Update toplists of posts to:

* Include all posters in the posting toplist, not just the teamless ones
* Include team name after poster name in the top list
* Change the team toplist to just list the team, not all members, since
  members are now listed in the main toplist.

Along the line, fix indent of text vs RSS button when overflowing to a
second line for long names (more common now that team names are included)
  • Loading branch information...
1 parent 7c82d83 commit 24d593cff2c0a45325d26f664f950477f1b31d36 @mhagander committed Apr 20, 2010
Showing with 25 additions and 33 deletions.
  1. +8 −16 generator.py
  2. +1 −1 template/base.tmpl
  3. +4 −14 template/index.tmpl
  4. +12 −2 www/css/planet.css
View
24 generator.py
@@ -84,29 +84,21 @@ def Generate(self):
self.items.append(PlanetPost(post[0], post[1], post[2], post[3], post[5], post[6], desc, post[8], post[9]))
c.execute("""
-SELECT name,blogurl,feedurl,count(*),NULL,NULL,NULL FROM planet.feeds
+SELECT planet.feeds.name,blogurl,feedurl,count(*),planet.teams.name,planet.teams.teamurl,NULL FROM planet.feeds
INNER JOIN planet.posts ON planet.feeds.id=planet.posts.feed
-WHERE age(dat) < '1 month' AND team IS NULL AND approved AND NOT hidden GROUP BY name,blogurl,feedurl ORDER BY 4 DESC,1 LIMIT 20
+LEFT JOIN planet.teams ON planet.teams.id=planet.feeds.team
+WHERE age(dat) < '1 month' AND approved AND NOT hidden GROUP BY planet.feeds.name,blogurl,feedurl,planet.teams.name,teamurl ORDER BY 4 DESC,1 LIMIT 20
""")
self.topposters = [PlanetFeed(feed) for feed in c.fetchall()]
if len(self.topposters) < 2: self.topposters = []
c.execute("""
-SELECT feedname,blogurl,feedurl,feedcount,teamname,teamurl,teamcount FROM
- (SELECT team,name AS feedname,blogurl,feedurl,count(*) AS feedcount FROM planet.feeds
- INNER JOIN planet.posts ON planet.feeds.id=planet.posts.feed
- WHERE age(dat) < '1 month' AND approved AND NOT hidden GROUP BY team,name,blogurl,feedurl
- ) AS q_feeds
- INNER JOIN
- (SELECT teams.id AS team,teams.name AS teamname,teams.teamurl,count(*) AS teamcount FROM planet.teams
- INNER JOIN planet.feeds ON planet.feeds.team=planet.teams.id
- INNER JOIN planet.posts ON planet.feeds.id=planet.posts.feed
- WHERE age(dat) < '1 month' AND approved AND NOT hidden GROUP BY teams.id, teams.name, teams.teamurl ORDER BY 4 DESC,1 LIMIT 10
- ) AS q_teams
-ON q_feeds.team=q_teams.team
-ORDER BY teamcount DESC, teamname, feedcount DESC, feedname;
-""")
+SELECT NULL,NULL,NULL,NULL,planet.teams.name, teamurl, count(*) FROM
+planet.feeds
+INNER JOIN planet.posts ON planet.feeds.id=planet.posts.feed
+INNER JOIN planet.teams ON planet.teams.id=planet.feeds.team
+WHERE age(dat) < '1 month' AND approved AND NOT hidden GROUP BY planet.teams.name, teamurl ORDER BY 7 DESC, 1 LIMIT 10""")
self.topteams = [PlanetFeed(feed) for feed in c.fetchall()]
if len(self.topteams) < 2: self.topteams = []
View
2 template/base.tmpl
@@ -6,7 +6,7 @@
<meta http-equiv="Content-Type" content="text/xhtml; charset=utf-8" />
<link rel="shortcut icon" href="/favicon.ico" />
<link rel="alternate" type="application/rss+xml" title="Planet PostgreSQL" href="http://planet.postgresql.org/rss20.xml" />
- <style type="text/css" media="screen" title="Normal Text">@import url("/css/planet.css");</style>
+ <style type="text/css" media="screen" title="Normal Text">@import url("css/planet.css");</style>
</head>
<body>
<div id="planetWrap">
View
18 template/index.tmpl
@@ -4,9 +4,9 @@
{% if topposters %}
<div class="planetRightTitle">Top posters</div>
<div class="planetRightDescription">Number of posts in the past month</div>
- <ul>
+ <ul class="toplist">
{% for feed in topposters %}
- <li><a href="{{feed.feedurl}}"><img src="img/feed-icon-14x14.png" alt="RSS"/></a> {%if feed.blogurl %}<a href="{{feed.blogurl}}">{{feed.name}}</a>{%else%}{{feed.name}}{%endif%} ({{feed.numposts}})</li>
+ <li><a href="{{feed.feedurl}}"><img src="img/feed-icon-14x14.png" alt="RSS"/></a> {%if feed.blogurl %}<a href="{{feed.blogurl}}">{{feed.name}}</a>{%else%}{{feed.name}}{%endif%} {%if feed.teamname%}({{feed.teamname}}) {%endif%}- {{feed.numposts}}</li>
{% endfor %}
</ul>
{% endif %}
@@ -15,18 +15,8 @@
<div class="planetRightDescription">Number of posts in the past month</div>
<ul>
{% for feed in topteams %}
- {% ifchanged feed.teamname %}
- {% if not forloop.first %}
- </ul>
- </li>
- {% endif %}
- <li><a href="{{feed.teamurl}}">{{feed.teamname}}</a> ({{feed.teamcount}})
- <ul>
- {%endifchanged%}
- <li><a href="{{feed.feedurl}}"><img src="img/feed-icon-14x14.png" alt="RSS"/></a> {%if feed.blogurl %}<a href="{{feed.blogurl}}">{{feed.name}}</a>{%else%}{{feed.name}}{%endif%} ({{feed.numposts}})</li>
-{% endfor %}
- </ul>
- </li>
+ <li><a href="{{feed.teamurl}}">{{feed.teamname}}</a> - {{feed.teamcount}}</li>
+{%endfor%}
</ul>
{% endif %}
<div class="planetRightTitle">Feeds</div>
View
14 www/css/planet.css
@@ -30,7 +30,7 @@ div#planetMain {
}
div#planetLeft {
- margin-right: 270px;
+ margin-right: 300px;
padding-top: 10px;
}
@@ -104,7 +104,7 @@ div.planetPostContent img {
}
div#planetRight {
- width: 250px;
+ width: 280px;
margin-top: 10px;
float: right;
text-align: left;
@@ -142,6 +142,16 @@ a:visited { color:#004E66; text-decoration: underline; }
a:active { color:#0085B0; text-decoration: underline; }
a:hover { color:#000000; text-decoration: underline; }
+/* Toplist on the right */
+div#planetRight ul.toplist li {
+ padding-left: 20px;
+}
+
+div#planetRight ul.toplist li img {
+ margin-left: -20px;
+ float: left;
+}
+
/* blog-specific hackery */
div.serendipity_authorpic {
display: block;

0 comments on commit 24d593c

Please sign in to comment.
Something went wrong with that request. Please try again.