diff --git a/app/templates/package_details.html b/app/templates/package_details.html new file mode 100644 index 0000000..c52cd62 --- /dev/null +++ b/app/templates/package_details.html @@ -0,0 +1,14 @@ +{% extends "base.html" %} + +{% block title %} +{{ package.title }} +{% endblock %} + +{% block content %} + {{ package.title }} + {{ package.author.display_name }} + {{ package.name }} + {{ package.desc }} + VCS Repo + Report Issue +{% endblock %} diff --git a/app/templates/packages.html b/app/templates/packages.html new file mode 100644 index 0000000..6caf3f0 --- /dev/null +++ b/app/templates/packages.html @@ -0,0 +1,17 @@ +{% extends "base.html" %} + +{% block title %} +{{ title }} +{% endblock %} + +{% block content %} + + {% endfor %} + +{% endblock %} diff --git a/app/templates/users/user_profile_page.html b/app/templates/users/user_profile_page.html index 0eb6adb..33526de 100644 --- a/app/templates/users/user_profile_page.html +++ b/app/templates/users/user_profile_page.html @@ -20,7 +20,11 @@ {% elif user == current_user %} Link Forums Account {% endif %} - | + + {% if (user.forums_username and user.github_username) or user == current_user %} + | + {% endif %} + {% if user.github_username %} GitHub {% elif user == current_user %} diff --git a/app/views/__init__.py b/app/views/__init__.py index bfe8c1b..1c126c1 100644 --- a/app/views/__init__.py +++ b/app/views/__init__.py @@ -14,7 +14,7 @@ cache = SimpleCache() def send_static(path): return send_from_directory('static', path) -import users, githublogin +import users, githublogin, mods @app.route('/') @menu.register_menu(app, '.', 'Home') diff --git a/app/views/mods.py b/app/views/mods.py new file mode 100644 index 0000000..ca349ea --- /dev/null +++ b/app/views/mods.py @@ -0,0 +1,19 @@ +from flask import * +from flask_user import * +from flask.ext import menu +from app import app +from app.models import * + +@app.route('/mods/') +@menu.register_menu(app, '.mods', 'Mods') +def mods_page(): + packages = Mod.query.all() + return render_template('packages.html', title="Mods", packages=packages) + +@app.route("/s///") +def package_page(type, author, name): + package = Mod.query.filter_by(name=name).first() + if package is None: + abort(404) + + return render_template('package_details.html', package=package) diff --git a/setup.py b/setup.py index 9949776..fb9069d 100644 --- a/setup.py +++ b/setup.py @@ -2,10 +2,10 @@ import os, datetime delete_db = False -if delete_db and os.path.isfile("app/data.sqlite"): - os.remove("app/data.sqlite") +if delete_db and os.path.isfile("db.sqlite"): + os.remove("db.sqlite") -if not os.path.isfile("app/data.sqlite"): +if not os.path.isfile("db.sqlite"): from app.models import * print("Creating database tables...") @@ -15,6 +15,17 @@ if not os.path.isfile("app/data.sqlite"): ruben = User("rubenwardy") ruben.github_username = "rubenwardy" db.session.add(ruben) + + mod1 = Mod() + mod1.name = "awards" + mod1.title = "Awards" + mod1.author = ruben + mod1.description = "Adds achievements and an API to register new ones." + mod1.repo = "https://github.com/rubenwardy/awards" + mod1.issueTracker = "https://github.com/rubenwardy/awards/issues" + mod1.forums = "https://forum.minetest.net/viewtopic.php?t=4870" + db.session.add(mod1) + db.session.commit() else: print("Database already exists")