mirror of
https://github.com/RYGhub/royalnet.git
synced 2024-11-23 19:44:20 +00:00
Add [diario](https://ryg.steffo.eu/diario) page
This commit is contained in:
parent
f633f2f82f
commit
898400ef40
5 changed files with 71 additions and 7 deletions
|
@ -18,10 +18,12 @@ h1, h2, h3, h4, h5, h6 {
|
|||
|
||||
a {
|
||||
color: @link-color;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
a:active {
|
||||
a:hover, a:active {
|
||||
color: @link-color;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
a:visited {
|
||||
|
@ -32,14 +34,13 @@ blockquote {
|
|||
border-left: 3px solid @quote-color;
|
||||
color: @quote-color;
|
||||
background-color: rgba(red(@quote-color), green(@quote-color), blue(@quote-color), 0.1);
|
||||
padding-left: 8px;
|
||||
padding: 2px 4px 2px 8px;
|
||||
margin-left: 8px;
|
||||
}
|
||||
|
||||
blockquote p {
|
||||
padding-top: 4px;
|
||||
padding-bottom: 2px;
|
||||
margin: 6px 0;
|
||||
padding-top: 2px;
|
||||
margin: 4px 0;
|
||||
}
|
||||
|
||||
blockquote.spoiler {
|
||||
|
@ -171,13 +172,13 @@ nav {
|
|||
}
|
||||
|
||||
@media (min-width:600px) {
|
||||
.desktop-only {
|
||||
.mobile-only {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width:600px) {
|
||||
.mobile-only {
|
||||
.desktop-only {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
@ -570,6 +571,28 @@ nav {
|
|||
}
|
||||
}
|
||||
|
||||
.diario blockquote {
|
||||
display: grid;
|
||||
|
||||
.left {
|
||||
grid-column: 1;
|
||||
}
|
||||
|
||||
.right {
|
||||
grid-column: 2;
|
||||
text-align: right;
|
||||
margin-top: auto;
|
||||
}
|
||||
|
||||
cite {
|
||||
font-size: smaller;
|
||||
}
|
||||
|
||||
.entry-id {
|
||||
text-align: right;
|
||||
}
|
||||
}
|
||||
|
||||
#edit-css {
|
||||
font-size: medium;
|
||||
}
|
13
templates/components/diarioentry.html
Normal file
13
templates/components/diarioentry.html
Normal file
|
@ -0,0 +1,13 @@
|
|||
<blockquote id="entry-{{ entry.id }}" class="entry">
|
||||
<div class="left">
|
||||
<p>
|
||||
<span class="text">{{ entry.text }}</span>
|
||||
</p>
|
||||
<p>
|
||||
<cite>— {% if entry.author is not none %}<a class="author" href="/profile/{{ entry.author.royal.username }}">{{ entry.author.royal.username }}</a>{% else %}<span class="author anonymous">Anonimo</span>{% endif %}, <span class="timestamp">{{ entry.timestamp.strftime('%Y-%m-%d %H:%M:%S %Z') }}</span> {% if entry.saver is not none and entry.saver != entry.author %}<span class="saver">(salvato da <a href="/profile/{{ entry.saver.royal.username }}">{{ entry.saver.royal.username }}</a>)</span>{% endif %}</cite>
|
||||
</p>
|
||||
</div>
|
||||
<div class="right">
|
||||
<a class="entry-id" href="#{{ entry.id }}">#{{ entry.id }}</a>
|
||||
</div>
|
||||
</blockquote>
|
16
templates/diario.html
Normal file
16
templates/diario.html
Normal file
|
@ -0,0 +1,16 @@
|
|||
{% extends 'base.html' %}
|
||||
|
||||
{% block pagetitle %}
|
||||
Diario
|
||||
{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
<h1>
|
||||
Diario
|
||||
</h1>
|
||||
<div class="diario">
|
||||
{% for entry in entries %}
|
||||
{% include "components/diarioentry.html" %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endblock %}
|
|
@ -33,4 +33,8 @@
|
|||
<li><a href="/wiki/{{ page.key }}">{{ page.key }}</a></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
<h2>Diario</h2>
|
||||
<ul>
|
||||
<a href="/diario">Nuovo</a>
|
||||
</ul>
|
||||
{% endblock %}
|
|
@ -236,6 +236,14 @@ def page_wiki(key: str):
|
|||
return redirect(url_for("page_wiki", key=key))
|
||||
|
||||
|
||||
@app.route("/diario")
|
||||
def page_diario():
|
||||
db_session = db.Session()
|
||||
diario_entries = db_session.query(db.Diario).all()
|
||||
db_session.close()
|
||||
return render_template("diario.html", config=config, entries=diario_entries)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
try:
|
||||
app.run(host="0.0.0.0", port=1235, debug=__debug__)
|
||||
|
|
Loading…
Reference in a new issue