diff --git a/amanuensis/server/home.py b/amanuensis/server/home.py
index e3b4645..d98c720 100644
--- a/amanuensis/server/home.py
+++ b/amanuensis/server/home.py
@@ -1,9 +1,15 @@
from flask import Blueprint, render_template, url_for
from flask_login import login_required, current_user
+from flask_wtf import FlaskForm
+from wtforms import TextAreaField, SubmitField
import config
import user
+class DashboardForm(FlaskForm):
+ submit = SubmitField("Submit")
+ text = TextAreaField()
+
def get_bp():
"""Create a blueprint for pages outside of a specific lexicon"""
bp = Blueprint('home', __name__, url_prefix='/home')
@@ -13,4 +19,22 @@ def get_bp():
def home():
return render_template('home/home.html')
+ @bp.route('/admin/', methods=['GET'])
+ @login_required
+ def admin():
+ if not current_user.get('admin'):
+ return redirect(url_for('home.home'))
+
+ with config.json_ro('config.json') as j:
+ global_config = j
+ import json
+ text = json.dumps(j, indent=2, allow_nan=False)
+
+ form = DashboardForm()
+ if form.is_submitted():
+ return "k"
+ else:
+ form.text.data = text
+ return render_template('home/admin.html', form=form)
+
return bp
diff --git a/amanuensis/templates/home/admin.html b/amanuensis/templates/home/admin.html
new file mode 100644
index 0000000..98172a8
--- /dev/null
+++ b/amanuensis/templates/home/admin.html
@@ -0,0 +1,17 @@
+{% extends "page_2col.html" %}
+{% block title %}Admin | Amanuensis{% endblock %}
+{% block header %}
Amanuensis - Admin Dashboard
{% endblock %}
+
+{% block sb_topline %}{{ current_user.get('displayname') }}{% endblock %}
+{% block sb_logout %}Log out{% endblock %}
+{% block sb_home %}Home{% endblock %}
+{% set template_sidebar_rows = [self.sb_topline(), self.sb_logout(), self.sb_home()] %}
+
+{% block main %}
+
+{% endblock %}
+{% set template_content_blocks = [self.main()] %}
\ No newline at end of file
diff --git a/amanuensis/templates/home/home.html b/amanuensis/templates/home/home.html
index 2a5be27..03c26f3 100644
--- a/amanuensis/templates/home/home.html
+++ b/amanuensis/templates/home/home.html
@@ -1,9 +1,16 @@
{% extends "page_2col.html" %}
{% block title %}Home | Amanuensis{% endblock %}
{% block header %}Amanuensis - Dashboard
{% endblock %}
+
{% block sb_topline %}{{ current_user.get('displayname') }}{% endblock %}
{% block sb_logout %}Log out{% endblock %}
{% set template_sidebar_rows = [self.sb_topline(), self.sb_logout()] %}
+
+{% if current_user.get('admin') %}
+ {% block sb_admin %}Admin{% endblock %}
+ {% set template_sidebar_rows = template_sidebar_rows + [self.sb_admin()] %}
+{% endif %}
+
{% block main %}
Home Page
{% endblock %}
diff --git a/amanuensis/user.py b/amanuensis/user.py
index e04f3ba..ad85497 100644
--- a/amanuensis/user.py
+++ b/amanuensis/user.py
@@ -58,6 +58,7 @@ def create_user(username, displayname, email):
'password': None,
'created': now,
'newPasswordRequired': True,
+ 'admin': False,
}
config.new_user(user_json)
u = User(uid)