8a1893d5a14d87e480f53f840c7754c27ba15237
[zzz-spline-forum.git] / splinext / forum / templates / forum / lib.mako
1 <%namespace name="lib" file="/lib.mako" />
2 <%namespace name="userlib" file="/users/lib.mako" />
3
4 <%def name="posts(posts)">
5 <div class="forum-post-container">
6     % for post in posts:
7     <div class="forum-post">
8         <div class="author">
9             <div class="avatar">
10                 ${userlib.avatar(post.author)}
11             </div>
12             <div class="name">
13                 <a href="${url(controller='users', action='profile', id=post.author.id, name=post.author.name)}">
14                     ${post.author.name}
15                     ${userlib.color_bar(post.author)}
16                 </a>
17             </div>
18         </div>
19         <div class="meta">
20             <time>${post.posted_time}</time>
21         </div>
22         <div class="content">${post.content}</div>
23     </div>
24     % endfor
25 </div>
26 </%def>
27
28 <%def name="write_thread_form(forum)">
29 % if forum.can_create_thread(c.user):
30 <h1>Create new thread</h1>
31 ${h.form(url(controller='forum', action='write_thread', forum_id=forum.id))}
32 <dl class="standard-form">
33     ${lib.field('subject', form=c.write_thread_form)}
34     ${lib.field('content', form=c.write_thread_form, rows=12, cols=80)}
35
36     <dd><button type="submit">Post!</button></dd>
37 </dl>
38 ${h.end_form()}
39 % endif  ## can create post
40 </%def>
41
42 <%def name="write_post_form(thread)">
43 % if thread.can_create_post(c.user):
44 <h1>Reply</h1>
45 ${h.form(url(controller='forum', action='write', forum_id=thread.forum.id, thread_id=thread.id))}
46 <dl class="standard-form">
47     ${lib.field('content', form=c.write_post_form, rows=12, cols=80)}
48
49     <dd><button type="submit">Post!</button></dd>
50 </dl>
51 ${h.end_form()}
52 % endif  ## can create post
53 </%def>