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="container">
<div class="important">
Error<br>
<span>{{ errorcode }}</span>
</div>
</div>
</div>
{% endblock -%}

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

@ -1,7 +1,7 @@
{% extends "template.html" -%}
{% block content -%}
<div class="container">
<div class="container">
<div class="logging">
<h1>Sign In</h1>
<form action="" method="post" novalidate>
@ -20,5 +20,5 @@
{% endfor -%}
</form>
</div>
</div>
</div>
{% endblock -%}

@ -1,7 +1,7 @@
{% extends "template.html" -%}
{% block content -%}
<div class="container">
<div class="container">
<div class="logging">
<h1>Register</h1>
<form action="" method="post" novalidate>
@ -33,5 +33,5 @@
{% endfor -%}
</form>
</div>
</div>
</div>
{% endblock -%}

@ -1,7 +1,7 @@
{% extends "template.html" -%}
{% block content -%}
<div class="container">
<div class="container">
<div class="standalone">
<h1>
{{ entry.item.name }} ({{ entry.item.date }})
@ -30,5 +30,5 @@
{{ 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="") -%}
{% set ns = namespace(prev_item_date="", prev_item_id=None, open_li = False, open_ul = False) -%}
{% for entry in entries -%}
{% if entry.item.date != ns.last_year -%}
{% if ns.last_year != "" -%}
{% 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 -%}
{% set ns.last_year = entry.item.date -%}
{% if ns.prev_item_id == entry.item.id -%}
<br>
{% else -%}
<li>
{{ entry.item.name }}
{{ entry.item.name }}<br>
{% set ns.open_li = True -%}
{% endif -%}
<a href="{{ url_for('entry', ident=entry.id) }}">
{{ r_to_star(entry.rating) }} by {{ entry.user.name }}
{{ entry.reviewed }} {{ r_to_star(entry.rating) }}
</a>
</li><br>
{% set ns.prev_item_date = entry.item.date -%}
{% set ns.prev_item_id = entry.item.id -%}
{% endfor -%}
{% autoescape off -%}
{{ content_string }}
{% endautoescape -%}
{% if ns.open_li -%}
</li>
{% endif -%}
{% if ns.open_ul -%}
</ul>
{% endif -%}
</div>
</div>
{% endblock -%}

Loading…
Cancel
Save