1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-23 19:44:20 +00:00

Merge pull request #60 from royal-games/web

Web again
This commit is contained in:
Steffo 2019-06-02 19:34:59 +02:00 committed by GitHub
commit 4d356cda8d
7 changed files with 83 additions and 3 deletions

View file

@ -1,6 +1,6 @@
import os
from .web import create_app
from .web.blueprints import helloworld, testing
from .web.blueprints import home
class TestConfig:
@ -8,7 +8,7 @@ class TestConfig:
REQUIRED_TABLES = set()
app = create_app(TestConfig, [helloworld, testing])
app = create_app(TestConfig, [home])
if __name__ == "__main__":

View file

@ -1,4 +1,5 @@
from .helloworld import bp as helloworld
from .testing import bp as testing
from .home import bp as home
__all__ = ["helloworld", "testing"]
__all__ = ["helloworld", "testing", "home"]

View file

@ -0,0 +1,10 @@
import flask as f
from ... import Royalprint
bp = Royalprint("helloworld", __name__, url_prefix="/helloworld")
@bp.route("/")
def helloworld_index():
return "Hello world!"

View file

@ -0,0 +1,10 @@
import flask as f
from ... import Royalprint
bp = Royalprint("home", __name__, template_folder="templates")
@bp.route("/")
def home_index():
return f.render_template("home.html")

View file

@ -0,0 +1,16 @@
{% extends "base.html" %}
{% block title %}
Home
{% endblock %}
{% block content %}
<div class="doublebox">
<div class="top">
<span class="left">Ciao!</span>
</div>
<div class="bot">
Ciao!
</div>
</div>
{% endblock %}

View file

@ -0,0 +1,13 @@
import flask as f
from ... import Royalprint
from ....database.tables import Royal
bp = Royalprint("testing", __name__, url_prefix="/testing", required_tables={Royal})
@bp.route("/listroyals")
def testing_listroyals():
from ...alchemyhandler import alchemy, alchemy_session
royals = alchemy_session.query(alchemy.Royal).all()
return f'<body><script type="text/plain" style="display: block;">{repr(royals)}</script></body>'

View file

@ -0,0 +1,30 @@
<!DOCTYPE html>
<html lang="it">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="author" content="Stefano Pigozzi">
<meta name="keywords" content="Royal Games,RYG,Gaming,Videogames,Community">
<meta name="description" content="Royal Games Community">
<meta property="og:site_name" content="Royal Games">
<title>{% block title %}{% endblock %}</title>
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.1/css/all.css">
<link rel="stylesheet" href="https://steffo.eu/static/styling.css">
<link rel="icon" href="{{ url_for("static", filename="favicon.png") }}" type="image/png">
</head>
<body>
<!--TODO: togliere questa roba-->
<div id="top-bar">
<span id="steffo">
Royal Games
</span>
</div>
<div class="h-container">
{% block content %}{% endblock %}
</div>
<div id="foot-scripts">
{% block footscripts %}{% endblock %}
</div>
</body>
</html>