c364c8c607f0a0483bfb2a314f2ffd3fb799df72
[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="forum_access_level(forum)">
5 % if forum.access_level != 'normal':
6 <div class="forum-access-level">
7     % if forum.access_level == 'soapbox':
8     <img src="${h.static_uri('spline', 'icons/soap.png')}" alt=""> <strong>Soapbox</strong>: Regular users can't start new threads.
9     % elif forum.access_level == 'archive':
10     <img src="${h.static_uri('spline', 'icons/wooden-box.png')}" alt=""> <strong>Archive</strong>: No more posting!
11     % endif
12 </div>
13 % endif
14 </%def>
15
16 <%def name="posts(posts)">
17 <div class="forum-post-container">
18     % for post in posts:
19     <div class="forum-post">
20         <div class="author">
21             <div class="avatar">
22                 ${userlib.avatar(post.author)}
23             </div>
24             <div class="name">
25                 <a href="${url(controller='users', action='profile', id=post.author.id, name=post.author.name)}">
26                     ${post.author.name}
27                     ${userlib.color_bar(post.author)}
28                 </a>
29             </div>
30         </div>
31         <div class="meta">
32             <time>${post.posted_time}</time>
33         </div>
34         <div class="content">${post.content}</div>
35     </div>
36     % endfor
37 </div>
38 </%def>
39
40 <%def name="write_thread_form(forum)">
41 % if forum.can_create_thread(c.user):
42 <h1>Create new thread</h1>
43 ${h.form(url(controller='forum', action='write_thread', forum_id=forum.id))}
44 <dl class="standard-form">
45     ${lib.field('subject', form=c.write_thread_form)}
46     ${lib.field('content', form=c.write_thread_form, rows=12, cols=80)}
47
48     <dd><button type="submit">Post!</button></dd>
49 </dl>
50 ${h.end_form()}
51 % endif  ## can create post
52 </%def>
53
54 <%def name="write_post_form(thread)">
55 % if thread.can_create_post(c.user):
56 <h1>Reply</h1>
57 ${h.form(url(controller='forum', action='write', forum_id=thread.forum.id, thread_id=thread.id))}
58 <dl class="standard-form">
59     ${lib.field('content', form=c.write_post_form, rows=12, cols=80)}
60
61     <dd><button type="submit">Post!</button></dd>
62 </dl>
63 ${h.end_form()}
64 % endif  ## can create post
65 </%def>