From 36039fceed0491e736ec1a4f3e7ae2cc9711987c Mon Sep 17 00:00:00 2001 From: crunk Date: Sun, 27 Mar 2022 12:46:08 +0200 Subject: [PATCH] last 2 tasks to go --- verse/app.py | 1 + verse/editor.py | 2 ++ verse/start.py | 14 +++++++-- verse/static/css/style.css | 6 +++- verse/templates/distribusi.html | 5 ++++ verse/templates/help.html | 50 +++++++++++++++++++++++++++++++++ verse/templates/index.html | 18 ++++++++---- 7 files changed, 86 insertions(+), 10 deletions(-) create mode 100644 verse/templates/help.html diff --git a/verse/app.py b/verse/app.py index 7dd6f6a..8bb6721 100644 --- a/verse/app.py +++ b/verse/app.py @@ -37,6 +37,7 @@ def create_app(): APP.config["SECRET_KEY"] = os.urandom(24) APP.config["UPLOAD_FOLDER"] = "tmpupload" + APP.config["PUBLIC_THEMES"] = "themes/publicthemes" csrf.init_app(APP) login_manager.init_app(APP) diff --git a/verse/editor.py b/verse/editor.py index 18c0cff..902f695 100644 --- a/verse/editor.py +++ b/verse/editor.py @@ -43,9 +43,11 @@ def ValidateEditCssForm(editorform, current_distribusi): newcssfolder = os.path.join("themes/userthemes", current_distribusi) if os.path.exists(newcssfolder): shutil.rmtree(newcssfolder) + publicfolder = os.path.join("themes/publicthemes", current_distribusi) if os.path.exists(publicfolder): shutil.rmtree(publicfolder) + if editorform.public.data: MakePublicTheme(editorform, current_distribusi) if editorform.cssfile.data: diff --git a/verse/start.py b/verse/start.py index de1be21..6442868 100644 --- a/verse/start.py +++ b/verse/start.py @@ -15,6 +15,7 @@ from flask_login import ( from flask_mail import Mail from flask_wtf.csrf import CSRFError from app import create_app, login_manager + from usermodel import User # Use upload form to populate filters @@ -50,19 +51,21 @@ def session_handler(): @APP.route("/") def index(): ResetUserState() + # http://localhost:5000/themes/publicthemes/RomeroTape/blueskies.css uploadform = UploadForm() distribusis = DistribusisInfo.visibledistribusis() - distribusies = {} + distribusisindex = {} for distribusi in distribusis: user = User.query.filter_by(id=distribusi.userid).first() singledistribusi = { "username": user.username, + "publictheme": distribusi.publictheme, "term": distribusi.term, "course": distribusi.course, "year": distribusi.year, "tags": distribusi.tags.split(","), } - distribusies[distribusi.distribusiname] = singledistribusi + distribusisindex[distribusi.distribusiname] = singledistribusi years = uploadform.academicyear.choices terms = uploadform.term.choices courses = uploadform.course.choices @@ -70,7 +73,7 @@ def index(): adminuser = isadminuser() template = render_template( "index.html", - distribusies=distribusies, + distribusisindex=distribusisindex, years=years, terms=terms, courses=courses, @@ -79,6 +82,11 @@ def index(): return template +@APP.route("/help") +def help(): + return render_template("help.html") + + @APP.route("/distribusi", methods=["GET", "POST"]) @login_required def distribusi(): diff --git a/verse/static/css/style.css b/verse/static/css/style.css index f150127..5731c1c 100644 --- a/verse/static/css/style.css +++ b/verse/static/css/style.css @@ -104,8 +104,12 @@ fieldset.tagfield > input { } #publicthemes > ul { max-height: 20em; - overflow: scroll; + overflow: auto; } +#publicthemes > ul > li{ + word-break: break-all; +} + input { border: none; background: #E0B0FF; diff --git a/verse/templates/distribusi.html b/verse/templates/distribusi.html index 104faed..8182e00 100644 --- a/verse/templates/distribusi.html +++ b/verse/templates/distribusi.html @@ -11,6 +11,11 @@ +
+ + + +
{% if selectorvisible %} diff --git a/verse/templates/help.html b/verse/templates/help.html new file mode 100644 index 0000000..2a6be49 --- /dev/null +++ b/verse/templates/help.html @@ -0,0 +1,50 @@ +{% extends "base.html" %} +{% block main %} +
+ {% if not current_user.is_authenticated %} + + + {% else %} +
+ + + +
+
+ + + +
+ {% endif %} + {% if adminuser %} +
+ + + +
+ {% endif %} +
+ {% if current_user.is_authenticated %} +

Hi {{ current_user.email }}!

+ {% else %} +

Welcome to distribusi-verse

+ {% endif %} +
+

Distribusi-verse

+

Zipfiles become websites

+

Folders become links and pages

+

Media files become visible

+

Text files become readable

+

Use Css to style your page

+
+ + +{% endblock %} diff --git a/verse/templates/index.html b/verse/templates/index.html index 050b09b..79c0a18 100644 --- a/verse/templates/index.html +++ b/verse/templates/index.html @@ -1,6 +1,7 @@ {% extends "base.html" %} {% block main %}
+ {% if not current_user.is_authenticated %} + {% if adminuser %} +
+ + + +
+ {% endif %} {% endif %} - {% if adminuser %} -
- - + - {% endif %}
{% if current_user.is_authenticated %}

Hi {{ current_user.email }}!

@@ -51,7 +57,7 @@

List of distribusis

{% include 'filtermenu.html' %}
    - {% for name, distribusi in distribusies.items() %} + {% for name, distribusi in distribusisindex.items() %}
  • {{distribusi["username"]}}:{{name}} {% for tag in distribusi["tags"] %}