User based option to switch off Twitter links

add "twitter: no" to the specified user in bloggers.yml to turn off the Twitter link for this user.
This commit is contained in:
Marcus -Chaosblog 2012-07-09 22:19:10 +02:00
parent cf11d9f4d8
commit 9c8654b674
3 changed files with 21 additions and 11 deletions

View File

@ -90,6 +90,7 @@ def render_template(path, week=None, **kwargs):
u.username = un u.username = un
u.name = rec['name'] u.name = rec['name']
u.links = rec['links'] u.links = rec['links']
u.twitter = rec.get('twitter')
u.start_de = datetime.datetime.strptime(rec['start'],"%Y/%m/%d").strftime("%d.%m.%Y") u.start_de = datetime.datetime.strptime(rec['start'],"%Y/%m/%d").strftime("%d.%m.%Y")
u.start = rec['start'] u.start = rec['start']
u.end = rec.get('end') u.end = rec.get('end')

View File

@ -8,7 +8,11 @@
% for u in sorted(userlist, key=lambda u:u.username): % for u in sorted(userlist, key=lambda u:u.username):
<tr> <tr>
<td align="left" valign="top">${u.name}</td> <td align="left" valign="top">${u.name}</td>
<td align="left" valign="top"><a href="https://twitter.com/#!/${u.username}">@${u.username}</a></td> <td align="left" valign="top">
% if u.twitter != False:
<a href="https://twitter.com/#!/${u.username}">@${u.username}</a>
% endif
</td>
<td align="left" valign="top"> <td align="left" valign="top">
% if u.links: % if u.links:
% for a in u.links: % for a in u.links:

View File

@ -2,7 +2,11 @@ Results for week beginning ${week_start.strftime("%F")}
<h2>Who posted:</h2> <h2>Who posted:</h2>
<dl> <dl>
% for u in sorted(good, key=lambda u:u.username): % for u in sorted(good, key=lambda u:u.username):
<dt><span class="user"><strong>${u.name} - </strong><a href="https://twitter.com/#!/${u.username}">@${u.username}</a>:</span></dt> <dt><span class="user"><strong>${u.name} </strong> \
% if u.twitter != False:
<a href="https://twitter.com/#!/${u.username}">@${u.username}</a> \
% endif
:</span></dt>
<dd> <dd>
<ul> <ul>
% for p in u.weeks[week]: % for p in u.weeks[week]:
@ -16,7 +20,11 @@ Results for week beginning ${week_start.strftime("%F")}
<h2>Slackers:</h2> <h2>Slackers:</h2>
<ul> <ul>
% for u in sorted(lame, key=lambda u:u.username): % for u in sorted(lame, key=lambda u:u.username):
<li class="user"><strong>${u.name} </strong>- <a href="https://twitter.com/#!/${u.username}">@${u.username}</a></li> <li class="user"><strong>${u.name} </strong> \
% if u.twitter != False:
<a href="https://twitter.com/#!/${u.username}">@${u.username}</a> \
% endif
</li>
% endfor % endfor
</ul> </ul>
@ -33,7 +41,11 @@ Results for week beginning ${week_start.strftime("%F")}
<h2>Who haven't started yet:</h2> <h2>Who haven't started yet:</h2>
<ul> <ul>
% for u in sorted(skip, key=lambda u:u.username): % for u in sorted(skip, key=lambda u:u.username):
<li class="user"><strong>${u.name} </strong>- <a href="https://twitter.com/#!/${u.username}">@${u.username}</a></li> <li class="user"><strong>${u.name} </strong> \
% if u.twitter != False:
- <a href="https://twitter.com/#!/${u.username}">@${u.username}</a> \
% endif
</li>
% endfor % endfor
</ul> </ul>
% endif % endif
@ -63,10 +75,3 @@ Results for week beginning ${week_start.strftime("%F")}
</tr> </tr>
%endif %endif
</table> </table>
<h2>Previously Punted (pay &euro;30 to return):</h2>
<ul>
% for (u) in sorted(punted, key=lambda p:p.username):
<li>${u.username} (${u.end})</li>
% endfor
</ul>