Browse Source

Recent Topics setting - #116

litnimax 10 years ago
parent
commit
c15e7616fd
2 changed files with 9 additions and 1 deletions
  1. 7 0
      flaskbb/plugins/portal/__init__.py
  2. 2 1
      flaskbb/plugins/portal/views.py

+ 7 - 0
flaskbb/plugins/portal/__init__.py

@@ -27,6 +27,13 @@ fixture = (
                 'description':  "The forum ids from which forums the posts should be displayed on the portal.",
                 'extra': {"choices": available_forums, "coerce": int}
             }),
+            ('plugin_portal_recent_topics', {
+                'value':        10,
+                'value_type':   "integer",
+                'name':         "Number of Recent Topics",
+                'description':  "The number of topics in Recent Topics portlet.",
+                'extra': {"min": 1},
+            }),
         ),
     }),
 )

+ 2 - 1
flaskbb/plugins/portal/views.py

@@ -30,7 +30,8 @@ def index():
         order_by(Topic.id.desc()).\
         paginate(page, flaskbb_config["TOPICS_PER_PAGE"], True)
 
-    recent_topics = Topic.query.order_by(Topic.last_updated.desc()).limit(5)
+    recent_topics = Topic.query.order_by(Topic.last_updated.desc()).limit(
+                            flaskbb_config.get("PLUGIN_PORTAL_RECENT_TOPICS", 10))
 
     user_count = User.query.count()
     topic_count = Topic.query.count()