diff --git a/royalnet/royalgamesweb.py b/royalnet/royalgamesweb.py index 06afdc1f..b5a37c11 100644 --- a/royalnet/royalgamesweb.py +++ b/royalnet/royalgamesweb.py @@ -8,7 +8,8 @@ class TestConfig: TG_AK = os.environ["TG_AK"] -app = create_app(TestConfig, [rp_home, rp_wikiview, rp_tglogin, rp_docs, rp_wikiedit, rp_mcstatus, rp_diarioview]) +app = create_app(TestConfig, [rp_home, rp_wikiview, rp_tglogin, rp_docs, rp_wikiedit, rp_mcstatus, rp_diarioview, + rp_profile]) if __name__ == "__main__": diff --git a/royalnet/web/royalprints/__init__.py b/royalnet/web/royalprints/__init__.py index a2be01c6..a902af18 100644 --- a/royalnet/web/royalprints/__init__.py +++ b/royalnet/web/royalprints/__init__.py @@ -7,5 +7,6 @@ from .docs import rp as rp_docs from .wikiedit import rp as rp_wikiedit from .mcstatus import rp as rp_mcstatus from .diarioview import rp as rp_diarioview +from .profile import rp as rp_profile -__all__ = ["rp_home", "rp_wikiview", "rp_tglogin", "rp_docs", "rp_wikiedit", "rp_mcstatus", "rp_diarioview"] +__all__ = ["rp_home", "rp_wikiview", "rp_tglogin", "rp_docs", "rp_wikiedit", "rp_mcstatus", "rp_diarioview", "rp_profile"] diff --git a/royalnet/web/royalprints/diarioview/templates/diarioview_page.html b/royalnet/web/royalprints/diarioview/templates/diarioview_page.html index 3480aadd..414b4962 100644 --- a/royalnet/web/royalprints/diarioview/templates/diarioview_page.html +++ b/royalnet/web/royalprints/diarioview/templates/diarioview_page.html @@ -23,7 +23,7 @@
— {% if entry.quoted_account %} - {{ entry.quoted }} + {{ entry.quoted }} {% else %} {{ entry.quoted }} {% endif %} @@ -33,7 +33,7 @@
{% endif %} {% if entry.creator %} -
Salvato da {{ entry.creator.username }}
+
Salvato da {{ entry.creator.username }}
{% endif %} #{{ entry.diario_id }} diff --git a/royalnet/web/royalprints/home/templates/home.html b/royalnet/web/royalprints/home/templates/home.html index e9f55117..69623ebb 100644 --- a/royalnet/web/royalprints/home/templates/home.html +++ b/royalnet/web/royalprints/home/templates/home.html @@ -10,7 +10,9 @@ Under construction
- Lentamente, su questo sito stanno apparendo nuove features. Come il diario! +

+ Lentamente, su questo sito stanno apparendo nuove features. Come il diario e i profili! +

{% endblock %} \ No newline at end of file diff --git a/royalnet/web/royalprints/mcstatus/templates/mcstatus.html b/royalnet/web/royalprints/mcstatus/templates/mcstatus.html index 147dba9f..b90668a7 100644 --- a/royalnet/web/royalprints/mcstatus/templates/mcstatus.html +++ b/royalnet/web/royalprints/mcstatus/templates/mcstatus.html @@ -7,7 +7,7 @@ {% block content %}
- Minecraft Status + Minecraft Server Status
diff --git a/royalnet/web/royalprints/profile/__init__.py b/royalnet/web/royalprints/profile/__init__.py new file mode 100644 index 00000000..6c146e5d --- /dev/null +++ b/royalnet/web/royalprints/profile/__init__.py @@ -0,0 +1,29 @@ +"""The profile page :py:class:`royalnet.web.Royalprint` for Royalnet members.""" + +import flask as f +import os +from ... import Royalprint +from ....database.tables import * + + +# Maybe some of these tables are optional... +tmpl_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'templates') +rp = Royalprint("profile", __name__, url_prefix="/profile", template_folder=tmpl_dir, + required_tables={Royal, ActiveKvGroup, Alias, Diario, Discord, Keygroup, Keyvalue, Telegram, WikiPage, + WikiRevision}) + + +@rp.route("/") +def profile_index(): + alchemy, alchemy_session = f.current_app.config["ALCHEMY"], f.current_app.config["ALCHEMY_SESSION"] + royals = alchemy_session.query(alchemy.Royal).order_by(alchemy.Royal.username).all() + return f.render_template("profile_index.html", royals=royals) + + +@rp.route("/") +def profile_by_username(username): + alchemy, alchemy_session = f.current_app.config["ALCHEMY"], f.current_app.config["ALCHEMY_SESSION"] + royal = alchemy_session.query(alchemy.Royal).filter_by(username=username).one_or_none() + if royal is None: + return "No such user", 404 + return f.render_template("profile_page.html", royal=royal) diff --git a/royalnet/web/royalprints/profile/templates/profile_index.html b/royalnet/web/royalprints/profile/templates/profile_index.html new file mode 100644 index 00000000..83137d86 --- /dev/null +++ b/royalnet/web/royalprints/profile/templates/profile_index.html @@ -0,0 +1,22 @@ +{% extends "base.html" %} + +{% block title %} + Indice RYGwiki +{% endblock %} + +{% block content %} +
+
+ + Elenco Membri + +
+
+ +
+
+{% endblock %} diff --git a/royalnet/web/royalprints/profile/templates/profile_page.html b/royalnet/web/royalprints/profile/templates/profile_page.html new file mode 100644 index 00000000..b9c549a8 --- /dev/null +++ b/royalnet/web/royalprints/profile/templates/profile_page.html @@ -0,0 +1,66 @@ +{% extends "base.html" %} + +{% block title %} + {{ royal.username }} - Profilo RYG +{% endblock %} + +{% block content %} +
+

+ {{ royal.username }} +

+ +
+
+ Statistiche +
+
+
    +
  • Righe del diario create: {{ royal.diario_created|length }}
  • +
  • Righe del diario in cui è menzionato: {{ royal.diario_quoted|length }}
  • +
  • Modifiche alla wiki: {{ royal.wiki_contributions|length }} + {% if royal.active_kv_group %} +
  • Kvgroup attivo: {{ royal.active_kv_group[0].group_name }}
  • + {% else %} +
  • Kvgroup attivo: Nessuno
  • + {% endif %} +
+
+
+
+
+ Alias +
+
+
    + {% for alias in royal.aliases %} +
  • {{ alias.alias|capitalize }}
  • + {% endfor %} +
+
+
+
+{% endblock %} diff --git a/royalnet/web/royalprints/wikiedit/templates/wikiedit_page.html b/royalnet/web/royalprints/wikiedit/templates/wikiedit_page.html index 6d2a24cb..b612d07f 100644 --- a/royalnet/web/royalprints/wikiedit/templates/wikiedit_page.html +++ b/royalnet/web/royalprints/wikiedit/templates/wikiedit_page.html @@ -13,7 +13,7 @@
- Wiki Editor + Editor Wiki
diff --git a/royalnet/web/royalprints/wikiview/templates/wikiview_index.html b/royalnet/web/royalprints/wikiview/templates/wikiview_index.html index e4d73745..84a2bcb0 100644 --- a/royalnet/web/royalprints/wikiview/templates/wikiview_index.html +++ b/royalnet/web/royalprints/wikiview/templates/wikiview_index.html @@ -8,7 +8,7 @@
- Wiki Index + Pagine Wiki
diff --git a/royalnet/web/static/ryg.css b/royalnet/web/static/ryg.css index 0622a526..2ae3e5f8 100644 --- a/royalnet/web/static/ryg.css +++ b/royalnet/web/static/ryg.css @@ -642,14 +642,14 @@ button[disabled=""] { } .diario { display: grid; - grid-template-columns: auto auto 8%; + grid-template-columns: auto auto 40px; } .diario .diario-content { grid-row: 1; grid-column-start: 1; grid-column-end: 4; } -.diario .diario-content .diario-img { +.diario .diario-content .diario-img img { color: red; margin-top: 2px; margin-bottom: 2px; @@ -701,4 +701,12 @@ button[disabled=""] { .diario.diario-spoiler:hover { color: #ff7d7d; } -/*# sourceMappingURL=ryg.css.map */ \ No newline at end of file +.profile .profile-links .links-linked { + font-family: "Consolas", "Source Code Pro", monospace; +} +.profile .profile-links .links-missing { + color: #ff7d7d; +} +.profile .profile-stats .stats-value { + font-weight: bold; +} diff --git a/royalnet/web/static/ryg.less b/royalnet/web/static/ryg.less index 1f011f65..b910d3a7 100644 --- a/royalnet/web/static/ryg.less +++ b/royalnet/web/static/ryg.less @@ -786,14 +786,14 @@ table { .diario { display: grid; - grid-template-columns: auto auto 8%; + grid-template-columns: auto auto 40px; .diario-content { grid-row: 1; grid-column-start: 1; grid-column-end: 4; - .diario-img { + .diario-img img { color: red; margin-top: 2px; margin-bottom: 2px; @@ -854,4 +854,25 @@ table { color: @pastel-red; } } +} + +.profile { + + .profile-links { + + .links-linked { + font-family: @monospace-fonts; + } + + .links-missing { + color: @pastel-red; + } + } + + .profile-stats { + + .stats-value { + font-weight: bold; + } + } } \ No newline at end of file diff --git a/royalnet/web/templates/base.html b/royalnet/web/templates/base.html index 876e0f3c..aebe2b63 100644 --- a/royalnet/web/templates/base.html +++ b/royalnet/web/templates/base.html @@ -28,6 +28,7 @@ Wiki Diario + Membri