Author: blackbird
Date: 2007-05-26 14:25:33 +0200 (Sat, 26 May 2007)
New Revision: 5157
Modified:
trunk/sandbox/py-rest-doc/sphinx/templates/admin/moderate_comments.html
trunk/sandbox/py-rest-doc/sphinx/web/admin.py
trunk/sandbox/py-rest-doc/sphinx/web/database.py
Log:
fixed some small bugs
Modified: trunk/sandbox/py-rest-doc/sphinx/templates/admin/moderate_comments.html
===================================================================
--- trunk/sandbox/py-rest-doc/sphinx/templates/admin/moderate_comments.html 2007-05-26 11:44:13 UTC (rev 5156)
+++ trunk/sandbox/py-rest-doc/sphinx/templates/admin/moderate_comments.html 2007-05-26 12:25:33 UTC (rev 5157)
@@ -46,12 +46,15 @@
</div>
</div>
{% endif %}
- {%- macro render_row(comment) %}
+ {%- macro render_row(comment, include_page=false) %}
<tr>
<td class="title">
<a href="{{ pathto(comment.url, true) }}">{{ comment.title|e }}</a>
<span class="meta">by <a href="mailto:{{ comment.author_mail|e
- }}">{{ comment.author|e }}</a></span>
+ }}">{{ comment.author|e }}</a>{% if include_page
+ %} on <a href="{{ pathto('admin/moderate_comments/' +
+ comment.associated_page) }}">{{ comment.associated_page }}</a{%
+ endif %}</span>
</td>
<td class="pub_date">{{ comment.pub_date|datetimeformat }}</td>
<td class="actions">
@@ -63,33 +66,35 @@
</tr>
{%- endmacro %}
<table class="mapping">
- <tr>
- <th colspan="4" class="recent_comments">
- <a href="{{ pathto('admin/moderate_comments/recent_comments/', true)
- }}">Recent Comments</a>
- <span class="meta">(<a href="{{ pathto('index.rst')
- }}?feed=recent_comments">feed</a>)</span>
- </th>
- </tr>
- {%- for comment in recent_comments %}
- {{- render_row(comment) }}
- {%- endfor %}
- {%- for page in pages_with_comments %}
+ {% if pages_with_comments %}
<tr>
- <th colspan="4">
- <a href="{{ pathto('admin/moderate_comments/' + page.page_id) }}">{{ page.title|e }}</a>
- <span class="meta">(<a href="{{ pathto(page.page_id) }}">view</a> |
- <a href="{{ pathto(page.page_id) }}?feed=comments">feed</a>)</span>
+ <th colspan="4" class="recent_comments">
+ <a href="{{ pathto('admin/moderate_comments/recent_comments/', true)
+ }}">Recent Comments</a>
+ <span class="meta">(<a href="{{ pathto('index.rst')
+ }}?feed=recent_comments">feed</a>)</span>
</th>
</tr>
- {%- if page.has_details %}
- {%- for comment in page.comments %}
- {{- render_row(comment) }}
- {%- endfor %}
- {%- endif %}
+ {%- for comment in recent_comments %}
+ {{- render_row(comment, true) }}
+ {%- endfor %}
+ {%- for page in pages_with_comments %}
+ <tr>
+ <th colspan="4">
+ <a href="{{ pathto('admin/moderate_comments/' + page.page_id) }}">{{ page.title|e }}</a>
+ <span class="meta">(<a href="{{ pathto(page.page_id) }}">view</a> |
+ <a href="{{ pathto(page.page_id) }}?feed=comments">feed</a>)</span>
+ </th>
+ </tr>
+ {%- if page.has_details %}
+ {%- for comment in page.comments %}
+ {{- render_row(comment) }}
+ {%- endfor %}
+ {%- endif %}
+ {% endfor %}
{%- else %}
<tr><th>no comments submitted so far</th></tr>
- {%- endfor %}
+ {%- endif %}
</table>
<div class="actions">
<input type="submit" value="Delete">
Modified: trunk/sandbox/py-rest-doc/sphinx/web/admin.py
===================================================================
--- trunk/sandbox/py-rest-doc/sphinx/web/admin.py 2007-05-26 11:44:13 UTC (rev 5156)
+++ trunk/sandbox/py-rest-doc/sphinx/web/admin.py 2007-05-26 12:25:33 UTC (rev 5157)
@@ -191,7 +191,7 @@
"""
if url == 'recent_comments':
details_for = None
- recent_comments = Comment.get_recent()
+ recent_comments = Comment.get_recent(20)
else:
details_for = url and self.env.get_real_filename(url) or None
recent_comments = None
Modified: trunk/sandbox/py-rest-doc/sphinx/web/database.py
===================================================================
--- trunk/sandbox/py-rest-doc/sphinx/web/database.py 2007-05-26 11:44:13 UTC (rev 5156)
+++ trunk/sandbox/py-rest-doc/sphinx/web/database.py 2007-05-26 12:25:33 UTC (rev 5157)
@@ -148,7 +148,7 @@
def get_for_page(associated_page, reverse=False):
cur = get_cursor()
cur.execute('''select * from comments where associated_page = ?
- order by comment_id %s''' % 'desc' if reverse else 'asc',
+ order by comment_id %s''' % ('desc' if reverse else 'asc'),
(associated_page,))
try:
return [Comment._make_comment(row) for row in cur]
|