fonts: set fonts

master
tiyn 2 years ago
parent d2ad7b3125
commit a6e1735cac

@ -14,6 +14,9 @@ def rating_to_star(rating):
string: unicode-formatted star-rating string.
"""
res = u"\u272D"*int(rating/20)
length = len(res)
if rating/20 % 1 >= 0.5:
res += u"\u00BD"
length += 1
res += u" \u2BE8 "
res += (u"\u2606" * (5 - length))
return res

@ -85,8 +85,9 @@ class Database:
crs.execute(query)
query = "CREATE TABLE IF NOT EXISTS " + self.ITEM_TABLE_FILE + \
"(id INTEGER PRIMARY KEY AUTOINCREMENT," + \
"name CHAR(32) NOT NULL," + \
"date CHAR(4)," + \
"name CHAR(32) NOT NULL UNIQUE)"
"UNIQUE(date, name))"
crs.execute(query)
query = "CREATE TABLE IF NOT EXISTS " + self.ENTRY_TABLE_FILE + \
"(id INTEGER PRIMARY KEY AUTOINCREMENT," + \
@ -118,8 +119,8 @@ class Database:
"(`name`,`date`)" + "VALUES (?, ?)"
crs.execute(query, (name, date))
query = "SELECT id FROM " + self.ITEM_TABLE_FILE + \
" WHERE name = ?"
crs.execute(query, (name, ))
" WHERE name = ? AND date = ?"
crs.execute(query, (name, date))
item_id = crs.fetchone()[0]
reviewed = dt.today().strftime('%Y-%m-%d')
query = "INSERT INTO " + self.ENTRY_TABLE_FILE + \
@ -209,7 +210,7 @@ class Database:
return user
def db_to_item(self, ident, name, date):
item = Item(date, name)
item = Item(name, date)
item.set_id(ident)
return item

@ -3,6 +3,20 @@
--transtime: 0.7s;
}
@font-face{
font-family: "LocalMono";
src: url("/static/fonts/jetbrainsmono-medium.woff2") format("woff2");
}
@font-face {
font-family: "LocalSans";
font-style: normal;
font-weight: 400;
src: url("/static/fonts/linux_libertine.woff2") format("woff2");
}
* {
margin: 0;
padding: 0;
@ -38,7 +52,7 @@ body {
body,
html {
font-family: sans-serif;
font-family: LocalSans, sans-serif;
height: 100%;
max-width: 100%;
overflow-x: hidden;
@ -83,7 +97,7 @@ span {
.main-menu-dropdown span {
float: left;
font-family: monospace;
font-family: LocalMono, monospace;
font-size: 30px;
font-weight: bold;
line-height: 100px;
@ -152,7 +166,7 @@ span {
.main-menu {
float: right;
font-family: monospace;
font-family: LocalMono, monospace;
font-size: 30px;
font-weight: bold;
line-height: 100px;

@ -4,14 +4,14 @@
<div class="container">
<div class="archive">
<h1>Archive</h1><br>
{% set ns = namespace(last_year="", last_name="", open_li = False, open_ul = False) -%}
{% set ns = namespace(prev_item_date="", prev_item_id=None, open_li = False, open_ul = False) -%}
{% for entry in entries -%}
{% if ns.last_name != entry.item.name and ns.last_name != "" -%}
{% if ns.prev_item_id != entry.item.id and ns.prev_item_id != None -%}
</li>
{% set ns.open_li = False -%}
{% endif -%}
{% if entry.item.date != ns.last_year -%}
{% if ns.last_year != "" -%}
{% if entry.item.date != ns.prev_item_date -%}
{% if ns.prev_item_date != "" -%}
</ul>
{% set ns.open_ul = False -%}
{% endif -%}
@ -19,21 +19,18 @@
<ul>
{% set ns.open_ul = True -%}
{% endif -%}
{% if ns.last_name == entry.item.name and ns.last_year == entry.item.date -%}
{% if ns.prev_item_id == entry.item.id -%}
<br>
<a href="{{ url_for('entry', ident=entry.id) }}">
{{ r_to_star(entry.rating) }} by {{ entry.user.name }}
</a>
{% else -%}
<li>
{{ entry.item.name }}<br>
<a href="{{ url_for('entry', ident=entry.id) }}">
{{ r_to_star(entry.rating) }} by {{ entry.user.name }}
</a>
{% set ns.open_li = True -%}
{% endif -%}
{% set ns.last_year = entry.item.date -%}
{% set ns.last_name = entry.item.name -%}
<a href="{{ url_for('entry', ident=entry.id) }}">
{{ entry.reviewed }} {{ r_to_star(entry.rating) }} by {{ entry.user.name }}
</a>
{% set ns.prev_item_date = entry.item.date -%}
{% set ns.prev_item_id = entry.item.id -%}
{% endfor -%}
{% if ns.open_li -%}
</li>

@ -1,10 +1,10 @@
{% extends "template.html" -%}
{% block content -%}
<div class="container">
<div class="important">
Error<br>
<span>{{ errorcode }}</span>
<div class="container">
<div class="important">
Error<br>
<span>{{ errorcode }}</span>
</div>
</div>
</div>
{% endblock -%}

@ -1,27 +1,27 @@
{% extends "template.html" -%}
{% block content -%}
<div class="container">
<div class="blog">
<h1>Blog</h1><br>
{% for entry in entries -%}
<div class="entry">
<h1 id="{{ entry.id }}">
<a href="{{ url_for('entry', ident=entry.id) }}">
{{ entry.item.name }} ({{ entry.item.date }}) {{ r_to_star(entry.rating) }}
</a>
</h1>
<small>
rated {{ entry.rating }}/100 by
<a href="{{ url_for('user', name=entry.user.name) }}">
{{ entry.user.name }}
</a>
</small><br>
{% autoescape off -%}
{{ entry.text }}
{% endautoescape -%}
</div><br>
{% endfor -%}
<div class="container">
<div class="blog">
<h1>Blog</h1><br>
{% for entry in entries -%}
<div class="entry">
<h1 id="{{ entry.id }}">
<a href="{{ url_for('entry', ident=entry.id) }}">
{{ entry.item.name }} ({{ entry.item.date }}) {{ r_to_star(entry.rating) }}
</a>
</h1>
<small>
rated {{ entry.rating }}/100 by
<a href="{{ url_for('user', name=entry.user.name) }}">
{{ entry.user.name }}
</a> on {{ entry.reviewed }}
</small><br>
{% autoescape off -%}
{{ entry.text }}
{% endautoescape -%}
</div><br>
{% endfor -%}
</div>
</div>
</div>
{% endblock -%}

@ -1,24 +1,24 @@
{% extends "template.html" -%}
{% block content -%}
<div class="container">
<div class="logging">
<h1>Sign In</h1>
<form action="" method="post" novalidate>
{{ form.hidden_tag() }}
<p>
{{ form.username.label }}<br>
{{ form.username(size=32) }}
</p>
<p>
{{ form.password.label }}<br>
{{ form.password(size=32) }}
</p>
<p>{{ form.submit() }}</p>
{% for mesg in get_flashed_messages() -%}
<p>{{ mesg }}</p>
{% endfor -%}
</form>
<div class="container">
<div class="logging">
<h1>Sign In</h1>
<form action="" method="post" novalidate>
{{ form.hidden_tag() }}
<p>
{{ form.username.label }}<br>
{{ form.username(size=32) }}
</p>
<p>
{{ form.password.label }}<br>
{{ form.password(size=32) }}
</p>
<p>{{ form.submit() }}</p>
{% for mesg in get_flashed_messages() -%}
<p>{{ mesg }}</p>
{% endfor -%}
</form>
</div>
</div>
</div>
{% endblock -%}

@ -1,37 +1,37 @@
{% extends "template.html" -%}
{% block content -%}
<div class="container">
<div class="logging">
<h1>Register</h1>
<form action="" method="post" novalidate>
{{ form.hidden_tag() }}
<p>
{{ form.username.label }}<br>
{{ form.username(size=32) }}
{% for error in form.username.errors -%}
<span style="color: red;">[{{ error }}]</span>
<div class="container">
<div class="logging">
<h1>Register</h1>
<form action="" method="post" novalidate>
{{ form.hidden_tag() }}
<p>
{{ form.username.label }}<br>
{{ form.username(size=32) }}
{% for error in form.username.errors -%}
<span style="color: red;">[{{ error }}]</span>
{% endfor -%}
</p>
<p>
{{ form.password.label }}<br>
{{ form.password(size=32) }}
{% for error in form.password.errors -%}
<span style="color: red;">[{{ error }}]</span>
{% endfor -%}
</p>
<p>
{{ form.password2.label }}<br>
{{ form.password2(size=32) }}
{% for error in form.password2.errors -%}
<span style="color: red;">[{{ error }}]</span>
{% endfor -%}
</p>
<p>{{ form.submit() }}</p>
{% for mesg in get_flashed_messages() -%}
<p>{{ mesg }}</p>
{% endfor -%}
</p>
<p>
{{ form.password.label }}<br>
{{ form.password(size=32) }}
{% for error in form.password.errors -%}
<span style="color: red;">[{{ error }}]</span>
{% endfor -%}
</p>
<p>
{{ form.password2.label }}<br>
{{ form.password2(size=32) }}
{% for error in form.password2.errors -%}
<span style="color: red;">[{{ error }}]</span>
{% endfor -%}
</p>
<p>{{ form.submit() }}</p>
{% for mesg in get_flashed_messages() -%}
<p>{{ mesg }}</p>
{% endfor -%}
</form>
</form>
</div>
</div>
</div>
{% endblock -%}

@ -1,34 +1,34 @@
{% extends "template.html" -%}
{% block content -%}
<div class="container">
<div class="standalone">
<h1>
{{ entry.item.name }} ({{ entry.item.date }})
{{ r_to_star(entry.rating) }}
</h1>
<small>
rated {{ entry.rating }}/100 by
<a href="{{ url_for('user', name=entry.user.name) }}">
{{ entry.user.name }}
</a>
on
<a href="{{ url_for('index', _anchor=entry.id) }}">
{{ entry.reviewed }}
</a>
</small><br>
{% if current_user.id == entry.user.id -%}
<small>
[
<a href="{{ url_for('delete_entry', ident=entry.id) }}">
delete entry
</a>
]
</small><br>
{% endif -%}
{% autoescape off -%}
{{ entry.text }}
{% endautoescape -%}<br>
<div class="container">
<div class="standalone">
<h1>
{{ entry.item.name }} ({{ entry.item.date }})
{{ r_to_star(entry.rating) }}
</h1>
<small>
rated {{ entry.rating }}/100 by
<a href="{{ url_for('user', name=entry.user.name) }}">
{{ entry.user.name }}
</a>
on
<a href="{{ url_for('index', _anchor=entry.id) }}">
{{ entry.reviewed }}
</a>
</small><br>
{% if current_user.id == entry.user.id -%}
<small>
[
<a href="{{ url_for('delete_entry', ident=entry.id) }}">
delete entry
</a>
]
</small><br>
{% endif -%}
{% autoescape off -%}
{{ entry.text }}
{% endautoescape -%}<br>
</div>
</div>
</div>
{% endblock -%}

@ -4,26 +4,40 @@
<div class="container">
<div class="archive">
<h1>User: {{ name }}</h1><br>
{% set ns = namespace(last_year="") -%}
{% for entry in entries -%}
{% if entry.item.date != ns.last_year -%}
{% if ns.last_year != "" -%}
</ul>
{% endif -%}
<h2> {{ entry.item.date }} </h2>
<ul>
{% endif -%}
{% set ns.last_year = entry.item.date -%}
<li>
{{ entry.item.name }}
<a href="{{ url_for('entry', ident=entry.id) }}">
{{ r_to_star(entry.rating) }} by {{ entry.user.name }}
</a>
</li><br>
{% endfor -%}
{% autoescape off -%}
{{ content_string }}
{% endautoescape -%}
{% set ns = namespace(prev_item_date="", prev_item_id=None, open_li = False, open_ul = False) -%}
{% for entry in entries -%}
{% if ns.prev_item_id != entry.item.id and ns.prev_item_id != None -%}
</li>
{% set ns.open_li = False -%}
{% endif -%}
{% if entry.item.date != ns.prev_item_date -%}
{% if ns.prev_item_date != "" -%}
</ul>
{% set ns.open_ul = False -%}
{% endif -%}
<h2> {{ entry.item.date }} </h2>
<ul>
{% set ns.open_ul = True -%}
{% endif -%}
{% if ns.prev_item_id == entry.item.id -%}
<br>
{% else -%}
<li>
{{ entry.item.name }}<br>
{% set ns.open_li = True -%}
{% endif -%}
<a href="{{ url_for('entry', ident=entry.id) }}">
{{ entry.reviewed }} {{ r_to_star(entry.rating) }}
</a>
{% set ns.prev_item_date = entry.item.date -%}
{% set ns.prev_item_id = entry.item.id -%}
{% endfor -%}
{% if ns.open_li -%}
</li>
{% endif -%}
{% if ns.open_ul -%}
</ul>
{% endif -%}
</div>
</div>
{% endblock -%}

Loading…
Cancel
Save