downloadable public themes on index

This commit is contained in:
crunk 2022-03-28 18:33:48 +02:00
parent b3f7e1fb6f
commit fd9f623193
5 changed files with 20 additions and 4 deletions

View File

@ -5,6 +5,7 @@ from flask import (
redirect,
url_for,
session,
send_from_directory,
Blueprint,
)
from flask_login import (
@ -17,6 +18,7 @@ from flask_wtf.csrf import CSRFError
from app import create_app, login_manager
from usermodel import User
from distribusimodel import Distribusis
# Use upload form to populate filters
from forms.uploadform import UploadForm
@ -107,6 +109,15 @@ def theme():
return ThemeSelector()
@APP.route("/publicthemes/<path>")
def publicthemes(path):
distribusi = Distribusis.query.filter_by(distribusiname=path).first()
publicthemefolder = f"publicthemes/{distribusi.distribusiname}/"
cssfile = f"{publicthemefolder}/{distribusi.publictheme}.css"
print(cssfile)
return send_from_directory("themes", cssfile, as_attachment=True)
@APP.route("/editor", methods=["GET", "POST"])
@login_required
def editor():
@ -156,7 +167,6 @@ def forgotpassword():
@APP.route("/resetpassword/<path>", methods=["GET", "POST"])
def resetpassword(path):
print(path)
return ResetPassword(path)

View File

@ -66,6 +66,9 @@ div#upload form {
#distribusiverse {
margin-bottom: 11em;
}
#distribusi-index {
padding-left: 1em;
}
div#buttons{
position: fixed;

View File

@ -1,5 +1,5 @@
<div id="edit" class="workflow">
<h2>(Optional) Step 3: Edit</h2>
<h2>Step 3: Edit Custom CSS (Optional)</h2>
{% if files_uploaded or distribusi_live %}
<p><a href="/editor">Go to CSS editor</a></p>
{% else %}

View File

@ -1,5 +1,5 @@
<div id="theme" class="workflow">
<h2>(Optional) Step 2: Choose a theme</h2>
<h2>Step 2: Choose a theme (Optional)</h2>
<p>Select your Theme here. If you want to make own custom css, skip and go to
step 3.</p>
<p>Don't forget to press Save</p>

View File

@ -56,13 +56,16 @@
<div id="distribusiverse" class="maincontent">
<h2>List of distribusis</h2>
{% include 'filtermenu.html' %}
<ul>
<ul id="distribusi-index">
{% for name, distribusi in distribusisindex.items() %}
<li class='distribusi filter {{ distribusi["term"] }} {{ distribusi["year"] }} {{ distribusi["course"] }}'>
<a href='stash/{{name}}/index.html'>{{distribusi["username"]}}:{{name}}</a>
{% for tag in distribusi["tags"] %}
<span class="tags">{{tag}}</span>
{% endfor%}
{% if distribusi.publictheme != None %}
<a href="publicthemes/{{name}}">theme 🗎</a>
{% endif %}
</li>
{% endfor%}
</ul>