platzky 0.3.4__tar.gz → 0.3.6__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.
- {platzky-0.3.4 → platzky-0.3.6}/PKG-INFO +1 -1
- {platzky-0.3.4 → platzky-0.3.6}/platzky/admin/admin.py +15 -11
- {platzky-0.3.4 → platzky-0.3.6}/platzky/admin/templates/admin.html +6 -5
- {platzky-0.3.4 → platzky-0.3.6}/platzky/engine.py +10 -0
- {platzky-0.3.4 → platzky-0.3.6}/platzky/models.py +16 -0
- {platzky-0.3.4 → platzky-0.3.6}/platzky/platzky.py +1 -1
- {platzky-0.3.4 → platzky-0.3.6}/pyproject.toml +1 -1
- {platzky-0.3.4 → platzky-0.3.6}/README.md +0 -0
- {platzky-0.3.4 → platzky-0.3.6}/platzky/__init__.py +0 -0
- {platzky-0.3.4 → platzky-0.3.6}/platzky/admin/fake_login.py +0 -0
- {platzky-0.3.4 → platzky-0.3.6}/platzky/admin/templates/login.html +0 -0
- {platzky-0.3.4 → platzky-0.3.6}/platzky/admin/templates/module.html +0 -0
- {platzky-0.3.4 → platzky-0.3.6}/platzky/blog/__init__.py +0 -0
- {platzky-0.3.4 → platzky-0.3.6}/platzky/blog/blog.py +0 -0
- {platzky-0.3.4 → platzky-0.3.6}/platzky/blog/comment_form.py +0 -0
- {platzky-0.3.4 → platzky-0.3.6}/platzky/config.py +0 -0
- {platzky-0.3.4 → platzky-0.3.6}/platzky/db/README.md +0 -0
- {platzky-0.3.4 → platzky-0.3.6}/platzky/db/__init__.py +0 -0
- {platzky-0.3.4 → platzky-0.3.6}/platzky/db/db.py +0 -0
- {platzky-0.3.4 → platzky-0.3.6}/platzky/db/db_loader.py +0 -0
- {platzky-0.3.4 → platzky-0.3.6}/platzky/db/github_json_db.py +0 -0
- {platzky-0.3.4 → platzky-0.3.6}/platzky/db/google_json_db.py +0 -0
- {platzky-0.3.4 → platzky-0.3.6}/platzky/db/graph_ql_db.py +0 -0
- {platzky-0.3.4 → platzky-0.3.6}/platzky/db/json_db.py +0 -0
- {platzky-0.3.4 → platzky-0.3.6}/platzky/db/json_file_db.py +0 -0
- {platzky-0.3.4 → platzky-0.3.6}/platzky/locale/en/LC_MESSAGES/messages.po +0 -0
- {platzky-0.3.4 → platzky-0.3.6}/platzky/locale/pl/LC_MESSAGES/messages.po +0 -0
- {platzky-0.3.4 → platzky-0.3.6}/platzky/plugin/plugin.py +0 -0
- {platzky-0.3.4 → platzky-0.3.6}/platzky/plugin/plugin_loader.py +0 -0
- {platzky-0.3.4 → platzky-0.3.6}/platzky/seo/seo.py +0 -0
- {platzky-0.3.4 → platzky-0.3.6}/platzky/static/blog.css +0 -0
- {platzky-0.3.4 → platzky-0.3.6}/platzky/static/styles.css +0 -0
- {platzky-0.3.4 → platzky-0.3.6}/platzky/templates/404.html +0 -0
- {platzky-0.3.4 → platzky-0.3.6}/platzky/templates/base.html +0 -0
- {platzky-0.3.4 → platzky-0.3.6}/platzky/templates/blog.html +0 -0
- {platzky-0.3.4 → platzky-0.3.6}/platzky/templates/body_meta.html +0 -0
- {platzky-0.3.4 → platzky-0.3.6}/platzky/templates/dynamic_css.html +0 -0
- {platzky-0.3.4 → platzky-0.3.6}/platzky/templates/feed.xml +0 -0
- {platzky-0.3.4 → platzky-0.3.6}/platzky/templates/head_meta.html +0 -0
- {platzky-0.3.4 → platzky-0.3.6}/platzky/templates/page.html +0 -0
- {platzky-0.3.4 → platzky-0.3.6}/platzky/templates/post.html +0 -0
- {platzky-0.3.4 → platzky-0.3.6}/platzky/templates/robots.txt +0 -0
- {platzky-0.3.4 → platzky-0.3.6}/platzky/templates/sitemap.xml +0 -0
- {platzky-0.3.4 → platzky-0.3.6}/platzky/www_handler.py +0 -0
|
@@ -3,7 +3,14 @@ from os.path import dirname
|
|
|
3
3
|
from flask import Blueprint, render_template, session
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
def create_admin_blueprint(login_methods,
|
|
6
|
+
def create_admin_blueprint(login_methods, cms_modules):
|
|
7
|
+
"""Create admin blueprint with dynamic module routes.
|
|
8
|
+
|
|
9
|
+
Args:
|
|
10
|
+
login_methods: Available login methods
|
|
11
|
+
cms_modules: List of CMS modules to register routes for
|
|
12
|
+
"""
|
|
13
|
+
# …rest of the function…
|
|
7
14
|
admin = Blueprint(
|
|
8
15
|
"admin",
|
|
9
16
|
__name__,
|
|
@@ -11,23 +18,20 @@ def create_admin_blueprint(login_methods, db, locale_func):
|
|
|
11
18
|
template_folder=f"{dirname(__file__)}/templates",
|
|
12
19
|
)
|
|
13
20
|
|
|
14
|
-
|
|
15
|
-
def admin_panel_home():
|
|
16
|
-
user = session.get("user", None)
|
|
21
|
+
for module in cms_modules:
|
|
17
22
|
|
|
18
|
-
|
|
19
|
-
|
|
23
|
+
@admin.route(f"/module/{module.slug}", methods=["GET"])
|
|
24
|
+
def module_route(module=module):
|
|
20
25
|
|
|
21
|
-
|
|
22
|
-
return render_template("admin.html", user=user, cms_modules=cms_modules)
|
|
26
|
+
return render_template(module.template, module=module)
|
|
23
27
|
|
|
24
|
-
@admin.route("/
|
|
25
|
-
def
|
|
28
|
+
@admin.route("/", methods=["GET"])
|
|
29
|
+
def admin_panel_home():
|
|
26
30
|
user = session.get("user", None)
|
|
27
31
|
|
|
28
32
|
if not user:
|
|
29
33
|
return render_template("login.html", login_methods=login_methods)
|
|
30
34
|
|
|
31
|
-
return render_template("
|
|
35
|
+
return render_template("admin.html", user=user, cms_modules=cms_modules)
|
|
32
36
|
|
|
33
37
|
return admin
|
|
@@ -18,12 +18,13 @@
|
|
|
18
18
|
{% block left_panel %}
|
|
19
19
|
<div id="admin-panel">
|
|
20
20
|
<p>User: {{ user.username }}</p>
|
|
21
|
-
{% for
|
|
21
|
+
{% for cms_module in cms_modules %}
|
|
22
22
|
<div class="cms-module mb-2">
|
|
23
|
-
<
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
<ul>
|
|
24
|
+
<li>
|
|
25
|
+
<a href="/{{ cms_module.slug }}"> {{ cms_module.name }} </a>
|
|
26
|
+
</li>
|
|
27
|
+
</ul>
|
|
27
28
|
</div>
|
|
28
29
|
{% endfor %}
|
|
29
30
|
</div>
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import os
|
|
2
|
+
from typing import List
|
|
2
3
|
|
|
3
4
|
from flask import Flask, request, session
|
|
4
5
|
from flask_babel import Babel
|
|
5
6
|
|
|
6
7
|
from platzky.config import Config
|
|
8
|
+
from platzky.models import CmsModule
|
|
7
9
|
|
|
8
10
|
|
|
9
11
|
class Engine(Flask):
|
|
@@ -25,6 +27,10 @@ class Engine(Flask):
|
|
|
25
27
|
default_translation_directories=babel_translation_directories,
|
|
26
28
|
)
|
|
27
29
|
|
|
30
|
+
self.cms_modules: List[CmsModule] = []
|
|
31
|
+
# TODO add plugins as CMS Module - all plugins should be visible from
|
|
32
|
+
# admin page at least as configuration
|
|
33
|
+
|
|
28
34
|
def notify(self, message: str):
|
|
29
35
|
for notifier in self.notifiers:
|
|
30
36
|
notifier(message)
|
|
@@ -32,6 +38,10 @@ class Engine(Flask):
|
|
|
32
38
|
def add_notifier(self, notifier):
|
|
33
39
|
self.notifiers.append(notifier)
|
|
34
40
|
|
|
41
|
+
def add_cms_module(self, module: CmsModule):
|
|
42
|
+
"""Add a CMS module to the modules list."""
|
|
43
|
+
self.cms_modules.append(module)
|
|
44
|
+
|
|
35
45
|
# TODO login_method should be interface
|
|
36
46
|
def add_login_method(self, login_method):
|
|
37
47
|
self.login_methods.append(login_method)
|
|
@@ -4,6 +4,22 @@ import humanize
|
|
|
4
4
|
from pydantic import BaseModel
|
|
5
5
|
|
|
6
6
|
|
|
7
|
+
class CmsModule(BaseModel):
|
|
8
|
+
"""Represents a CMS module with basic metadata."""
|
|
9
|
+
|
|
10
|
+
name: str
|
|
11
|
+
description: str
|
|
12
|
+
template: str
|
|
13
|
+
slug: str
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
# CmsModuleGroup is also a CmsModule, but it contains other CmsModules
|
|
17
|
+
class CmsModuleGroup(CmsModule):
|
|
18
|
+
"""Represents a group of CMS modules, inheriting module properties."""
|
|
19
|
+
|
|
20
|
+
modules: list[CmsModule] = []
|
|
21
|
+
|
|
22
|
+
|
|
7
23
|
class Image(BaseModel):
|
|
8
24
|
url: str = ""
|
|
9
25
|
alternateText: str = ""
|
|
@@ -86,7 +86,7 @@ def create_app_from_config(config: Config) -> Engine:
|
|
|
86
86
|
engine = create_engine(config, db)
|
|
87
87
|
|
|
88
88
|
admin_blueprint = admin.create_admin_blueprint(
|
|
89
|
-
login_methods=engine.login_methods,
|
|
89
|
+
login_methods=engine.login_methods, cms_modules=engine.cms_modules
|
|
90
90
|
)
|
|
91
91
|
|
|
92
92
|
if config.feature_flags and config.feature_flags.get("FAKE_LOGIN", False):
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|