--- /dev/null
+from sqlalchemy import *
+from migrate import *
+import migrate.changeset
+
+from sqlalchemy.ext.declarative import declarative_base
+TableBase = declarative_base()
+
+class Forum(TableBase):
+ __tablename__ = 'forums'
+ id = Column(Integer, primary_key=True, autoincrement=True, nullable=False)
+ name = Column(Unicode(133), nullable=False)
+ description = Column(Unicode(1024), nullable=False, default=u'', server_default=u'')
+ access_level = Column(Enum(u'normal', u'soapbox', u'archive', name='forums_access_level'), nullable=False, default=u'normal', server_default=u'normal')
+
+
+def upgrade(migrate_engine):
+ TableBase.metadata.bind = migrate_engine
+
+ # populate_default gets all retarded I don't even
+ Forum.__table__.c.description.create(populate_default=False)
+
+def downgrade(migrate_engine):
+ TableBase.metadata.bind = migrate_engine
+
+ Forum.__table__.c.description.drop()
__tablename__ = 'forums'
id = Column(Integer, primary_key=True, autoincrement=True, nullable=False)
name = Column(Unicode(133), nullable=False)
+ description = Column(Unicode(1024), nullable=False, default=u'', server_default=u'')
access_level = Column(Enum(u'normal', u'soapbox', u'archive', name='forums_access_level'), nullable=False, default=u'normal', server_default=u'normal')
def can_create_thread(self, user):
.forum-access-level { font-size: 0.8em; padding: 0.25em 0.625em; font-style: italic; color: #606060; }
.forum-access-level img { vertical-align: middle; }
-table.forum-list { width: 100%; margin-top: 1em; }
+table.forum-list { width: 100%; margin-top: 0.5em; }
+table.forum-list .header-row th { vertical-align: middle; }
table.forum-list .name { text-align: left; }
table.forum-list td.name a { display: block; font-size: 1.5em; padding: 0.33em; }
+table.forum-list td.name .forum-description { padding: 0.33em 0.5em; color: #404040; }
table.forum-list .stats { width: 10em; text-align: center; }
.forum-post-container { }
<td class="name">
<a href="${url(controller='forum', action='threads', forum_id=forum.id)}">${forum.name}</a>
${forumlib.forum_access_level(forum)}
+ % if forum.description:
+ <div class="forum-description">
+ ${forum.description}
+ </div>
+ % endif
</td>
<td class="stats">xxx</td>
<td class="stats">xxx</th>
% endif
</%def>
+## Prints a little hierarchy of context when viewing a thread
+<%def name="hierarchy(forum, thread=None)">
+<ul class="forum-hierarchy">
+<li>
+ % if thread:
+ <a href="${url(controller='forum', action='threads', forum_id=forum.id)}">
+ % else:
+ <strong>
+ % endif
+ <img src="${h.static_uri('spline', 'icons/folders-stack.png')}" alt=""> ${forum.name}
+ % if thread:
+ </a>
+ % else:
+ </strong>
+ % endif
+ % if forum.description:
+ — ${forum.description}
+ % endif
+ ${forum_access_level(forum)}
+</li>
+% if thread:
+<li>
+ <strong><img src="${h.static_uri('spline', 'icons/folder-open-document-text.png')}" alt=""> ${thread.subject}</strong>
+</li>
+% endif
+</ul>
+</%def>
+
<%def name="posts(posts)">
<div class="forum-post-container">
% for post in posts:
</%def>
<h1>Posts</h1>
-<ul class="forum-hierarchy">
- <li>
- In forum: <a href="${url(controller='forum', action='threads', forum_id=c.thread.forum.id)}"><img src="${h.static_uri('spline', 'icons/folders-stack.png')}" alt=""> ${c.thread.forum.name}</a>
- ${forumlib.forum_access_level(c.thread.forum)}
- </li>
- <li>
- In thread: <strong><img src="${h.static_uri('spline', 'icons/folder-open-document-text.png')}" alt=""> ${c.thread.subject}</strong>
- </li>
-</ul>
+${forumlib.hierarchy(c.thread.forum, c.thread)}
% if c.thread.post_count == 0:
<p>Something terribly bogus has happened; this thread has no posts.</p>
</%def>
<h1>Threads</h1>
-<ul class="forum-hierarchy">
- <li>
- In forum: <strong><img src="${h.static_uri('spline', 'icons/folders-stack.png')}" alt=""> ${c.forum.name}</strong>
- ${forumlib.forum_access_level(c.forum)}
- </li>
-</ul>
+${forumlib.hierarchy(c.forum)}
<table class="forum-list striped-rows">
<thead>