Browse Source

Main page shows lists of distribusis

current_wdka_release
crunk 2 years ago
parent
commit
d7936dc3e0
  1. 1
      .gitignore
  2. 16
      verse/start.py
  3. 20
      verse/static/css/style.css
  4. 9
      verse/templates/index.html

1
.gitignore

@ -8,4 +8,5 @@ dist/
pip-wheel-metadata/ pip-wheel-metadata/
verse/tmpupload/* verse/tmpupload/*
verse/stash/*
*.db *.db

16
verse/start.py

@ -13,6 +13,7 @@ from flask import (
url_for, url_for,
session, session,
abort, abort,
send_from_directory,
) )
from sqlalchemy.exc import ( from sqlalchemy.exc import (
IntegrityError, IntegrityError,
@ -56,7 +57,11 @@ def session_handler():
@APP.route("/") @APP.route("/")
def index(): def index():
return render_template("index.html") users = User.query.filter(User.distribusiname.isnot(None)).all()
distribusinames = []
for user in users:
distribusinames.append(user.distribusiname)
return render_template("index.html", distribusinames=distribusinames)
@APP.route("/login", methods=["GET", "POST"]) @APP.route("/login", methods=["GET", "POST"])
@ -69,7 +74,7 @@ def login():
login_user(user) login_user(user)
flash("Logged in successfully.", "success") flash("Logged in successfully.", "success")
next = request.args.get("next") next = request.args.get("next")
if next is not None and not is_safe_url(next): if next is not None and not is_safe_url(next): # noqa: F821
return abort(400) return abort(400)
return redirect(next or url_for("index")) return redirect(next or url_for("index"))
else: else:
@ -144,7 +149,7 @@ def distribusi():
parser = build_argparser() parser = build_argparser()
args = parser.parse_args() args = parser.parse_args()
distribusify(args, newuserfolder) distribusify(args, newuserfolder)
return render_template("index.html") return redirect(url_for("index"))
template = render_template( template = render_template(
"distribusi.html", "distribusi.html",
uploadform=uploadform, uploadform=uploadform,
@ -178,6 +183,11 @@ def upload():
return template return template
@APP.route("/stash/<path:path>")
def distribusistash(path):
return send_from_directory("stash", path)
@APP.route("/admin") @APP.route("/admin")
@login_required @login_required
def admin(): def admin():

20
verse/static/css/style.css

@ -78,3 +78,23 @@ fieldset.required {
.button input:hover { .button input:hover {
background: #60337F; background: #60337F;
} }
/* unvisited link */
a:link {
color: red;
}
/* visited link */
a:visited {
color: #fff600;
}
/* mouse over link */
a:hover {
color: #60337F;
}
/* selected link */
a:active {
color: white;
}

9
verse/templates/index.html

@ -34,12 +34,9 @@
<div id="distribusiverse"> <div id="distribusiverse">
<h2>List of distribusis</h2> <h2>List of distribusis</h2>
<ul> <ul>
<li>CCL</li> {% for distribusiname in distribusinames %}
<li>Crunk</li> <li><a href="stash/{{distribusiname}}/index.html">{{distribusiname}}</a></li>
<li>CMOS4010</li> {% endfor%}
<li>CMOS4046</li>
<li>Other Names</li>
<li>List of stuff</li>
</ul> </ul>
</div> </div>
{% endblock %} {% endblock %}

Loading…
Cancel
Save