sh4nks 11 лет назад
Родитель
Сommit
814be76152
2 измененных файлов с 17 добавлено и 5 удалено
  1. 6 1
      flaskbb/fixtures/settings.py
  2. 11 4
      flaskbb/plugins/portal/__init__.py

+ 6 - 1
flaskbb/fixtures/settings.py

@@ -8,6 +8,11 @@
     :copyright: (c) 2014 by the FlaskBB Team.
     :license: BSD, see LICENSE for more details.
 """
+from flask.ext.themes2 import get_themes_list
+
+
+def available_themes():
+    return [(theme.identifier, theme.name) for theme in get_themes_list()]
 
 fixture = (
     # Settings Group
@@ -84,7 +89,7 @@ fixture = (
             ('default_theme', {
                 'value':        "bootstrap3",
                 'value_type':   "select",
-                'extra':        {'choices': None},
+                'extra':        {'choices': available_themes},
                 'name':         "Default theme",
                 'description':  "Change the default theme for your forum."
             }),

+ 11 - 4
flaskbb/plugins/portal/__init__.py

@@ -3,22 +3,29 @@ from flask.ext.plugins import connect_event
 from flaskbb.plugins import FlaskBBPlugin
 from flaskbb.utils.populate import (create_settings_from_fixture,
                                     delete_settings_from_fixture)
+from flaskbb.forum.models import Forum
+
 from .views import portal, inject_portal_link
 
 __version__ = "0.1"
 __plugin__ = "PortalPlugin"
 
+
+def available_forums():
+    forums = Forum.query.order_by(Forum.id.asc()).all()
+    return [(forum.id, forum.title) for forum in forums]
+
 fixture = (
     ('plugin_portal', {
         'name': "Portal Settings",
         "description": "Configure the portal",
         "settings": (
             ('plugin_portal_forum_ids', {
-                'value':        "1",
-                'value_type':   "array",
-                'input_type':   "array",
+                'value':        [1],
+                'value_type':   "selectmultiple",
                 'name':         "Forum IDs",
-                'description':  "The forum ids from which forums the posts should be displayed on the portal."
+                'description':  "The forum ids from which forums the posts should be displayed on the portal.",
+                'extra': {"choices": available_forums, "coerce": int}
             }),
         ),
     }),