From 04f55b555ecc45e76c1a174a2dfbe0294a419e11 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Sun, 6 Jan 2019 19:29:06 +0100 Subject: [PATCH] Split in components and display the main page to anyone --- static/nryg.less | 43 ++++++++-- templates/components/diariooftheday.html | 9 ++ templates/components/eventlist.html | 12 +++ templates/components/gamestatsbox.html | 18 ++++ templates/components/links.html | 25 ++++++ templates/components/memberbox.html | 12 +++ templates/components/welcome.html | 8 ++ templates/components/whatarewe.html | 8 ++ templates/components/wikibox.html | 4 +- templates/main.html | 101 +++++------------------ webserver.py | 9 +- 11 files changed, 159 insertions(+), 90 deletions(-) create mode 100644 templates/components/diariooftheday.html create mode 100644 templates/components/eventlist.html create mode 100644 templates/components/gamestatsbox.html create mode 100644 templates/components/links.html create mode 100644 templates/components/memberbox.html create mode 100644 templates/components/welcome.html create mode 100644 templates/components/whatarewe.html diff --git a/static/nryg.less b/static/nryg.less index 5ae7619a..eb2395d0 100644 --- a/static/nryg.less +++ b/static/nryg.less @@ -254,6 +254,11 @@ table { border-radius: 0 0 4px 4px; padding: 8px; } + + ul { + column-width: 200px; + word-wrap: break-word; + } } .input-grid { @@ -270,6 +275,16 @@ table { } } +.super-title { + font-size: 64px; + text-align: center; + + img { + height: 128px; + vertical-align: middle; + } +} + @media (min-width:601px) { .mobile-only { display: none; @@ -815,7 +830,9 @@ table { .wiki-log { font-family: "Consolas", "Source Code Pro", monospace; + font-size: small; margin-bottom: 12px; + opacity: 0.4; .last-reason { font-style: italic; @@ -859,7 +876,7 @@ table { } } -.main-page { +.two-columns { display: grid; @media (min-width:601px) { @@ -894,11 +911,6 @@ table { grid-row-end: 3; } } - - ul { - column-width: 200px; - word-wrap: break-word; - } } .event { @@ -951,3 +963,22 @@ table { #edit-css { font-size: medium; } + +#members-list { + list-style: none; + + li { + &::before { + content: "•"; + display: inline-block; + width: 1em; + margin-left: -1em; + } + + &.admin { + &::before { + color: #ffff00; + } + } + } +} \ No newline at end of file diff --git a/templates/components/diariooftheday.html b/templates/components/diariooftheday.html new file mode 100644 index 00000000..4fd29399 --- /dev/null +++ b/templates/components/diariooftheday.html @@ -0,0 +1,9 @@ +
+
+ Citazione casuale dal diario +
+
+ {% include "components/diarioentry.html" %} + Visualizza tutto il diario +
+
\ No newline at end of file diff --git a/templates/components/eventlist.html b/templates/components/eventlist.html new file mode 100644 index 00000000..8a3269c8 --- /dev/null +++ b/templates/components/eventlist.html @@ -0,0 +1,12 @@ +
+ {% if next_events %} +
+ Prossimi eventi +
+
+ {% for event in events %} + {% include "components/event.html" %} + {% endfor %} +
+ {% endif %} +
\ No newline at end of file diff --git a/templates/components/gamestatsbox.html b/templates/components/gamestatsbox.html new file mode 100644 index 00000000..c5480d9c --- /dev/null +++ b/templates/components/gamestatsbox.html @@ -0,0 +1,18 @@ +
+
+ Noi in vari giochi +
+ +
\ No newline at end of file diff --git a/templates/components/links.html b/templates/components/links.html new file mode 100644 index 00000000..160479aa --- /dev/null +++ b/templates/components/links.html @@ -0,0 +1,25 @@ +
+
+ Link riservati ai membri +
+
+ +
+
\ No newline at end of file diff --git a/templates/components/memberbox.html b/templates/components/memberbox.html new file mode 100644 index 00000000..8088db4d --- /dev/null +++ b/templates/components/memberbox.html @@ -0,0 +1,12 @@ +
+
+ Membri +
+
+ +
+
\ No newline at end of file diff --git a/templates/components/welcome.html b/templates/components/welcome.html new file mode 100644 index 00000000..dfec0ee8 --- /dev/null +++ b/templates/components/welcome.html @@ -0,0 +1,8 @@ +
+
+ Benvenuti! +
+
+ Benvenuti al sito della community Royal Games! +
+
\ No newline at end of file diff --git a/templates/components/whatarewe.html b/templates/components/whatarewe.html new file mode 100644 index 00000000..e6c3effe --- /dev/null +++ b/templates/components/whatarewe.html @@ -0,0 +1,8 @@ +
+
+ Cosa siamo? +
+
+ La Royal Games è una community... indescrivibile! +
+
\ No newline at end of file diff --git a/templates/components/wikibox.html b/templates/components/wikibox.html index 79c9d4f6..13fe7360 100644 --- a/templates/components/wikibox.html +++ b/templates/components/wikibox.html @@ -14,6 +14,8 @@
  • {{ page.key }}
  • {% endfor %} - oppure... + {% if g.logged_in %} + oppure... + {% endif %} \ No newline at end of file diff --git a/templates/main.html b/templates/main.html index 26606b02..58d193d0 100644 --- a/templates/main.html +++ b/templates/main.html @@ -9,90 +9,31 @@ {% endblock %} {% block body %} -

    - Royal Games +

    + Royal Games

    -
    +
    -
    - {% if next_events %} -
    - Prossimi eventi -
    -
    - {% for event in next_events %} - {% include "components/event.html" %} - {% endfor %} -
    - {% endif %} -
    -
    -
    - Citazione casuale dal diario -
    -
    - {% include "components/diarioentry.html" %} - Visualizza tutto -
    -
    - {% include "components/wikibox.html" %} + {% if not g.logged_in %} + {% include "components/welcome.html" %} + {% endif %} + {% if g.logged_in %} + {% include "components/eventlist.html" %} + {% include "components/diariooftheday.html" %} + {% endif %} + {% include "components/memberbox.html" %}
    -
    -
    - Link utili -
    -
    - -
    -
    -
    -
    - Membri -
    -
    - -
    -
    -
    -
    - Resoconti -
    - -
    + {% if not g.logged_in %} + {% include "components/whatarewe.html" %} + {% endif %} + {% if g.logged_in %} + {% include "components/links.html" %} + {% endif %} + {% include "components/gamestatsbox.html" %} + {% if g.logged_in %} + {% include "components/wikibox.html" %} + {% endif %}
    {% endblock %} \ No newline at end of file diff --git a/webserver.py b/webserver.py index 066c49ad..f8e11ee7 100644 --- a/webserver.py +++ b/webserver.py @@ -61,8 +61,6 @@ def page_500(): @app.route("/") def page_main(): - if not fl_session.get("user_id"): - return redirect(url_for("page_login")) db_session = db.Session() royals = db_session.query(db.Royal).order_by(db.Royal.username).all() wiki_pages = db_session.query(db.WikiEntry).order_by(db.WikiEntry.key).all() @@ -72,7 +70,7 @@ def page_main(): halloween = db.Halloween.puzzle_status()[1] db_session.close() return render_template("main.html", royals=royals, wiki_pages=wiki_pages, entry=random_diario, - next_events=next_events, g=fl_g, escape=escape, halloween=enumerate(halloween)) + events=next_events, g=fl_g, escape=escape, halloween=enumerate(halloween)) @app.route("/profile/") @@ -436,6 +434,11 @@ def hooks_github(): def pre_request(): fl_g.css = "nryg.less" fl_g.rygconf = config + if fl_session is not None and fl_session.get("username") is not None and fl_session.get("user_id") is not None: + fl_g.logged_in = True + else: + fl_g.logged_in = False + if __name__ == "__main__":