c.write_thread_form = WriteThreadForm()
- c.threads = c.forum.threads.options(
- joinedload('last_post'),
- joinedload('last_post.author'),
- )
+ # nb: This will never show post-less threads. Oh well!
+ threads_q = c.forum.threads \
+ .join(forum_model.Thread.last_post) \
+ .order_by(forum_model.Post.posted_time.desc()) \
+ .options(joinedload('last_post.author'))
+ c.num_threads = threads_q.count()
+ try:
+ c.skip = int(request.params.get('skip', 0))
+ except ValueError:
+ abort(404)
+ c.per_page = 89
+ c.threads = threads_q.offset(c.skip).limit(c.per_page)
return render('/forum/threads.mako')
c.write_post_form = WritePostForm()
+ posts_q = c.thread.posts \
+ .order_by(forum_model.Post.position.asc()) \
+ .options(joinedload('author'))
+ c.num_posts = c.thread.post_count
+ try:
+ c.skip = int(request.params.get('skip', 0))
+ except ValueError:
+ abort(404)
+ c.per_page = 89
+ c.posts = posts_q.offset(c.skip).limit(c.per_page)
+
return render('/forum/posts.mako')
.forum-post .author .avatar { margin-bottom: 1em; }
.forum-post .author .avatar img { -moz-box-shadow: 0 0 2px black; }
.forum-post .meta { padding: 0.5em 1em; border: 1px solid #b4c7e6; background: url(${h.static_uri('local', 'images/layout/th-background.png')}) left bottom repeat-x; -moz-border-radius-topleft: 0.5em; -moz-border-radius-topright: 0.5em; -webkit-border-top-left-radius: 0.5em; -webkit-border-top-right-radius: 0.5em; }
+.forum-post .meta a { display: block; float: right; }
.forum-post .content { min-height: 12em; margin-right: 18.5em; padding: 1em; }
.forum-post:nth-child(2n) { background: #f4f4f4; }
</div>
</div>
<div class="meta">
+ <a href="${url(controller='forum', action='posts', forum_id=post.thread.forum_id, thread_id=post.thread.id)}">#${post.position}</a>
<time>${post.posted_time}</time>
</div>
<div class="content">${post.content | n}</div>
<%inherit file="/base.mako" />
<%namespace name="forumlib" file="/forum/lib.mako" />
+<%namespace name="lib" file="/lib.mako" />
<%def name="title()">${c.thread.subject} - Forums</%def>
% if c.thread.post_count == 0:
<p>Something terribly bogus has happened; this thread has no posts.</p>
% else:
-${forumlib.posts(c.thread.posts)}
+${lib.pager(c.skip, c.per_page, c.thread.post_count, dict(controller='forum', action='posts', forum_id=c.thread.forum_id, thread_id=c.thread.id))}
+${forumlib.posts(c.posts)}
+${lib.pager(c.skip, c.per_page, c.thread.post_count, dict(controller='forum', action='posts', forum_id=c.thread.forum_id, thread_id=c.thread.id))}
% endif
${forumlib.write_post_form(c.thread)}
<%inherit file="/base.mako" />
<%namespace name="forumlib" file="/forum/lib.mako" />
<%namespace name="userlib" file="/users/lib.mako" />
+<%namespace name="lib" file="/lib.mako" />
<%def name="title()">${c.forum.name} - Forums</%def>
<h1>Threads</h1>
${forumlib.hierarchy(c.forum)}
+${lib.pager(c.skip, c.per_page, c.num_threads, dict(controller='forum', action='threads', forum_id=c.forum.id))}
<table class="forum-list striped-rows">
<thead>
<tr class="header-row">
% endfor
</tbody>
</table>
+${lib.pager(c.skip, c.per_page, c.num_threads, dict(controller='forum', action='threads', forum_id=c.forum.id))}
${forumlib.write_thread_form(c.forum)}