flaskbb-plugin-portal 2.0.0__tar.gz → 2.1.0.dev2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {flaskbb_plugin_portal-2.0.0 → flaskbb_plugin_portal-2.1.0.dev2}/PKG-INFO +4 -4
- {flaskbb_plugin_portal-2.0.0 → flaskbb_plugin_portal-2.1.0.dev2}/README.md +1 -1
- {flaskbb_plugin_portal-2.0.0 → flaskbb_plugin_portal-2.1.0.dev2}/portal/__init__.py +33 -19
- {flaskbb_plugin_portal-2.0.0 → flaskbb_plugin_portal-2.1.0.dev2}/portal/views.py +13 -4
- {flaskbb_plugin_portal-2.0.0 → flaskbb_plugin_portal-2.1.0.dev2}/pyproject.toml +2 -2
- {flaskbb_plugin_portal-2.0.0 → flaskbb_plugin_portal-2.1.0.dev2}/.gitignore +0 -0
- {flaskbb_plugin_portal-2.0.0 → flaskbb_plugin_portal-2.1.0.dev2}/LICENSE +0 -0
- {flaskbb_plugin_portal-2.0.0 → flaskbb_plugin_portal-2.1.0.dev2}/portal/templates/index.html +0 -0
- {flaskbb_plugin_portal-2.0.0 → flaskbb_plugin_portal-2.1.0.dev2}/portal/translations/de/LC_MESSAGES/messages.po +0 -0
- {flaskbb_plugin_portal-2.0.0 → flaskbb_plugin_portal-2.1.0.dev2}/portal/translations/en/LC_MESSAGES/messages.po +0 -0
- {flaskbb_plugin_portal-2.0.0 → flaskbb_plugin_portal-2.1.0.dev2}/portal/translations/messages.pot +0 -0
- {flaskbb_plugin_portal-2.0.0 → flaskbb_plugin_portal-2.1.0.dev2}/portal/translations/ru/LC_MESSAGES/message.po +0 -0
- {flaskbb_plugin_portal-2.0.0 → flaskbb_plugin_portal-2.1.0.dev2}/portal/translations/zh_CN/LC_MESSAGES/messages.po +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
2
|
Name: flaskbb-plugin-portal
|
|
3
|
-
Version: 2.0.
|
|
3
|
+
Version: 2.1.0.dev2
|
|
4
4
|
Summary: A portal plugin for FlaskBB.
|
|
5
5
|
Project-URL: Homepage, https://github.com/flaskbb/flaskbb-plugin-portal
|
|
6
6
|
Project-URL: Repository, https://github.com/flaskbb/flaskbb-plugin-portal
|
|
@@ -23,7 +23,7 @@ Classifier: Programming Language :: Python :: 3.14
|
|
|
23
23
|
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
|
|
24
24
|
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
25
25
|
Requires-Python: >=3.12
|
|
26
|
-
Requires-Dist: flaskbb>=
|
|
26
|
+
Requires-Dist: flaskbb>=3.0.0
|
|
27
27
|
Description-Content-Type: text/markdown
|
|
28
28
|
|
|
29
29
|
# Portal Plugin for FlaskBB
|
|
@@ -56,6 +56,6 @@ $ pip install flaskbb-plugin-portal
|
|
|
56
56
|
|
|
57
57
|
# Links
|
|
58
58
|
|
|
59
|
-
* [FlaskBB Website](https://flaskbb.
|
|
59
|
+
* [FlaskBB Website](https://flaskbb.com)
|
|
60
60
|
* [Source Code](https://github.com/flaskbb/flaskbb-plugin-portal)
|
|
61
61
|
* [Issue Tracker](https://github.com/flaskbb/flaskbb-plugin-portal/issues)
|
|
@@ -28,6 +28,6 @@ $ pip install flaskbb-plugin-portal
|
|
|
28
28
|
|
|
29
29
|
# Links
|
|
30
30
|
|
|
31
|
-
* [FlaskBB Website](https://flaskbb.
|
|
31
|
+
* [FlaskBB Website](https://flaskbb.com)
|
|
32
32
|
* [Source Code](https://github.com/flaskbb/flaskbb-plugin-portal)
|
|
33
33
|
* [Issue Tracker](https://github.com/flaskbb/flaskbb-plugin-portal/issues)
|
|
@@ -13,10 +13,11 @@ import os
|
|
|
13
13
|
|
|
14
14
|
from flask import Flask
|
|
15
15
|
from flask_babelplus import gettext as _
|
|
16
|
+
from flaskbb.core.settings import SelectMultipleSetting
|
|
17
|
+
from flaskbb.core.settings.definitions import IntSetting, SettingGroup, StringSetting
|
|
16
18
|
from flaskbb.display.navigation import NavigationLink
|
|
17
19
|
from flaskbb.extensions import db
|
|
18
20
|
from flaskbb.forum.models import Forum
|
|
19
|
-
from flaskbb.utils.forms import SettingValueType
|
|
20
21
|
from pluggy import HookimplMarker
|
|
21
22
|
from sqlalchemy import select
|
|
22
23
|
|
|
@@ -61,22 +62,35 @@ def flaskbb_tpl_navigation_before():
|
|
|
61
62
|
)
|
|
62
63
|
|
|
63
64
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
65
|
+
impl = HookimplMarker("flaskbb")
|
|
66
|
+
|
|
67
|
+
SETTINGS = SettingGroup(
|
|
68
|
+
key="portal",
|
|
69
|
+
name="Portal Settings",
|
|
70
|
+
description="Portal settings for your FlaskBB forum.",
|
|
71
|
+
settings=(
|
|
72
|
+
SelectMultipleSetting(
|
|
73
|
+
key="FORUM_IDS",
|
|
74
|
+
value=[1],
|
|
75
|
+
name="Forums",
|
|
76
|
+
description=(
|
|
77
|
+
"The forum ids from which forums the posts "
|
|
78
|
+
"should be displayed on the portal."
|
|
79
|
+
),
|
|
80
|
+
choices=available_forums,
|
|
81
|
+
coerce=int,
|
|
72
82
|
),
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
+
IntSetting(
|
|
84
|
+
key="RECENT_TOPICS",
|
|
85
|
+
value=10,
|
|
86
|
+
min=1,
|
|
87
|
+
name="Number of Recent Topics",
|
|
88
|
+
description="The number of topics in Recent Topics.",
|
|
89
|
+
),
|
|
90
|
+
),
|
|
91
|
+
)
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
@impl
|
|
95
|
+
def flaskbb_load_setting_groups():
|
|
96
|
+
return SETTINGS
|
|
@@ -10,14 +10,15 @@ This module contains the portal view.
|
|
|
10
10
|
"""
|
|
11
11
|
|
|
12
12
|
from flask import Blueprint, current_app, flash, request
|
|
13
|
+
from flask.helpers import redirect
|
|
13
14
|
from flask_babelplus import gettext as _
|
|
14
15
|
from flask_login import current_user
|
|
16
|
+
from flaskbb.core.settings import flaskbb_config
|
|
15
17
|
from flaskbb.extensions import db
|
|
16
18
|
from flaskbb.forum.models import Forum, Post, Topic
|
|
17
19
|
from flaskbb.plugins.models import PluginRegistry
|
|
18
20
|
from flaskbb.user.models import Group, User
|
|
19
21
|
from flaskbb.utils.helpers import get_online_users, render_template, time_diff
|
|
20
|
-
from flaskbb.utils.settings import flaskbb_config
|
|
21
22
|
from sqlalchemy import select
|
|
22
23
|
|
|
23
24
|
portal = Blueprint("portal", __name__, template_folder="templates")
|
|
@@ -29,7 +30,13 @@ def index():
|
|
|
29
30
|
forum_ids = []
|
|
30
31
|
|
|
31
32
|
plugin = PluginRegistry.get_by(name="portal")
|
|
32
|
-
if
|
|
33
|
+
if not plugin:
|
|
34
|
+
flash(
|
|
35
|
+
_("Plugin 'portal' could not be found in the plugin registry."),
|
|
36
|
+
"warning",
|
|
37
|
+
)
|
|
38
|
+
return redirect("forum.index")
|
|
39
|
+
if not plugin.settings:
|
|
33
40
|
flash(
|
|
34
41
|
_(
|
|
35
42
|
"Please install the plugin first to configure the forums "
|
|
@@ -38,7 +45,7 @@ def index():
|
|
|
38
45
|
"warning",
|
|
39
46
|
)
|
|
40
47
|
else:
|
|
41
|
-
forum_ids: list[int] = plugin.settings["
|
|
48
|
+
forum_ids: list[int] = plugin.settings["FORUM_IDS"]
|
|
42
49
|
group_ids = [group.id for group in current_user.groups]
|
|
43
50
|
|
|
44
51
|
forums = (
|
|
@@ -54,7 +61,9 @@ def index():
|
|
|
54
61
|
# get the news forums - check for permissions
|
|
55
62
|
news_ids = [f.id for f in forums]
|
|
56
63
|
news = db.paginate(
|
|
57
|
-
select(Topic)
|
|
64
|
+
select(Topic)
|
|
65
|
+
.where(Topic.forum_id.in_(news_ids), Topic.first_post_id.is_not(None))
|
|
66
|
+
.order_by(Topic.id.desc()),
|
|
58
67
|
page=page,
|
|
59
68
|
per_page=flaskbb_config["TOPICS_PER_PAGE"],
|
|
60
69
|
error_out=True,
|
|
File without changes
|
|
File without changes
|
{flaskbb_plugin_portal-2.0.0 → flaskbb_plugin_portal-2.1.0.dev2}/portal/templates/index.html
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{flaskbb_plugin_portal-2.0.0 → flaskbb_plugin_portal-2.1.0.dev2}/portal/translations/messages.pot
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|