sh4nks 11 лет назад
Родитель
Сommit
1c0a997085
3 измененных файлов с 9 добавлено и 3 удалено
  1. 7 0
      flaskbb/app.py
  2. 1 2
      flaskbb/forum/views.py
  3. 1 1
      flaskbb/templates/forum/category_layout.html

+ 7 - 0
flaskbb/app.py

@@ -188,6 +188,13 @@ def configure_template_filters(app):
         return False
 
 
+    @app.template_filter()
+    def crop_topic_title(title):
+        if len(title) > 15:
+            return title[:15] + "..."
+        return title
+
+
 def configure_before_handlers(app):
     """
     Configures the before request handlers

+ 1 - 2
flaskbb/forum/views.py

@@ -110,8 +110,7 @@ def view_post(post_id):
 def new_topic(forum_id):
     forum = Forum.query.filter_by(id=forum_id).first()
 
-    if not check_perm(current_user, 'posttopic') or \
-        can_moderate(current_user, forum):
+    if not check_perm(current_user, 'posttopic', forum):
         flash("You do not have the permissions to create a new topic.")
         return redirect(url_for('forum.view_forum', forum_id=forum.id))
 

+ 1 - 1
flaskbb/templates/forum/category_layout.html

@@ -37,7 +37,7 @@
             <td valign="top" align="right" style="white-space: nowrap">
                 {% if forum.last_post_id %}
                 <a href="{{ url_for('forum.view_post', post_id=forum.last_post_id) }}" title="{{ forum.last_post.topic.title }}">
-                    <strong>{{ forum.last_post.topic.title }}</strong>
+                    <strong>{{ forum.last_post.topic.title|crop_topic_title() }}</strong>
                 </a>
                 <br />
                 {{ forum.last_post.date_created|time_since }}<br />