diff --git a/src/content.py b/src/content.py
index f77bbaf..fc586e6 100644
--- a/src/content.py
+++ b/src/content.py
@@ -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
diff --git a/src/database.py b/src/database.py
index 89bb19e..ea472ef 100644
--- a/src/database.py
+++ b/src/database.py
@@ -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
diff --git a/src/static/css/style.css b/src/static/css/style.css
index a74c4a4..a8d7c83 100644
--- a/src/static/css/style.css
+++ b/src/static/css/style.css
@@ -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;
diff --git a/src/static/fonts/jetbrainsmono-medium.woff2 b/src/static/fonts/jetbrainsmono-medium.woff2
new file mode 100644
index 0000000..484c9e6
Binary files /dev/null and b/src/static/fonts/jetbrainsmono-medium.woff2 differ
diff --git a/src/static/fonts/linux_libertine.woff2 b/src/static/fonts/linux_libertine.woff2
new file mode 100644
index 0000000..4356db1
Binary files /dev/null and b/src/static/fonts/linux_libertine.woff2 differ
diff --git a/src/templates/archive.html b/src/templates/archive.html
index 00929e3..5662f07 100644
--- a/src/templates/archive.html
+++ b/src/templates/archive.html
@@ -4,14 +4,14 @@
Archive
- {% 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 -%}
{% 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 != "" -%}
{% set ns.open_ul = False -%}
{% endif -%}
@@ -19,21 +19,18 @@
{% 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 -%}
-
- {{ r_to_star(entry.rating) }} by {{ entry.user.name }}
-
{% else -%}
-
{{ entry.item.name }}
-
- {{ r_to_star(entry.rating) }} by {{ entry.user.name }}
-
{% set ns.open_li = True -%}
{% endif -%}
- {% set ns.last_year = entry.item.date -%}
- {% set ns.last_name = entry.item.name -%}
+
+ {{ entry.reviewed }} {{ r_to_star(entry.rating) }} by {{ entry.user.name }}
+
+ {% set ns.prev_item_date = entry.item.date -%}
+ {% set ns.prev_item_id = entry.item.id -%}
{% endfor -%}
{% if ns.open_li -%}
diff --git a/src/templates/error.html b/src/templates/error.html
index b7d567e..7013b17 100644
--- a/src/templates/error.html
+++ b/src/templates/error.html
@@ -1,10 +1,10 @@
{% extends "template.html" -%}
{% block content -%}
-
-
- Error
-
{{ errorcode }}
+
+
+ Error
+ {{ errorcode }}
+
-
{% endblock -%}
diff --git a/src/templates/index.html b/src/templates/index.html
index d632604..11f2bf8 100644
--- a/src/templates/index.html
+++ b/src/templates/index.html
@@ -1,27 +1,27 @@
{% extends "template.html" -%}
{% block content -%}
-
-
-
Blog
- {% for entry in entries -%}
-
-
-
- rated {{ entry.rating }}/100 by
-
- {{ entry.user.name }}
-
-
- {% autoescape off -%}
- {{ entry.text }}
- {% endautoescape -%}
-
- {% endfor -%}
+
+
+
Blog
+ {% for entry in entries -%}
+
+
+
+ rated {{ entry.rating }}/100 by
+
+ {{ entry.user.name }}
+ on {{ entry.reviewed }}
+
+ {% autoescape off -%}
+ {{ entry.text }}
+ {% endautoescape -%}
+
+ {% endfor -%}
+
-
{% endblock -%}
diff --git a/src/templates/login.html b/src/templates/login.html
index 502ef53..e0e44b7 100644
--- a/src/templates/login.html
+++ b/src/templates/login.html
@@ -1,24 +1,24 @@
{% extends "template.html" -%}
{% block content -%}
-
-
{% endblock -%}
diff --git a/src/templates/register.html b/src/templates/register.html
index 4bc3ed4..0536268 100644
--- a/src/templates/register.html
+++ b/src/templates/register.html
@@ -1,37 +1,37 @@
{% extends "template.html" -%}
{% block content -%}
-
-
{% endblock -%}
diff --git a/src/templates/standalone.html b/src/templates/standalone.html
index b54efe0..7e67a1b 100644
--- a/src/templates/standalone.html
+++ b/src/templates/standalone.html
@@ -1,34 +1,34 @@
{% extends "template.html" -%}
{% block content -%}
-
-
-
- {{ entry.item.name }} ({{ entry.item.date }})
- {{ r_to_star(entry.rating) }}
-
-
- rated {{ entry.rating }}/100 by
-
- {{ entry.user.name }}
-
- on
-
- {{ entry.reviewed }}
-
-
- {% if current_user.id == entry.user.id -%}
-
- [
-
- delete entry
-
- ]
-
- {% endif -%}
- {% autoescape off -%}
- {{ entry.text }}
- {% endautoescape -%}
+
+
+
+ {{ entry.item.name }} ({{ entry.item.date }})
+ {{ r_to_star(entry.rating) }}
+
+
+ rated {{ entry.rating }}/100 by
+
+ {{ entry.user.name }}
+
+ on
+
+ {{ entry.reviewed }}
+
+
+ {% if current_user.id == entry.user.id -%}
+
+ [
+
+ delete entry
+
+ ]
+
+ {% endif -%}
+ {% autoescape off -%}
+ {{ entry.text }}
+ {% endautoescape -%}
+
-
{% endblock -%}
diff --git a/src/templates/user.html b/src/templates/user.html
index 74b1c19..904ef4b 100644
--- a/src/templates/user.html
+++ b/src/templates/user.html
@@ -4,26 +4,40 @@
User: {{ name }}
- {% set ns = namespace(last_year="") -%}
- {% for entry in entries -%}
- {% if entry.item.date != ns.last_year -%}
- {% if ns.last_year != "" -%}
-
- {% endif -%}
-
{{ entry.item.date }}
-
- {% endif -%}
- {% set ns.last_year = entry.item.date -%}
- -
- {{ entry.item.name }}
-
- {{ r_to_star(entry.rating) }} by {{ entry.user.name }}
-
-
- {% 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 -%}
+
+ {% set ns.open_li = False -%}
+ {% endif -%}
+ {% if entry.item.date != ns.prev_item_date -%}
+ {% if ns.prev_item_date != "" -%}
+
+ {% set ns.open_ul = False -%}
+ {% endif -%}
+
{{ entry.item.date }}
+
+ {% set ns.open_ul = True -%}
+ {% endif -%}
+ {% if ns.prev_item_id == entry.item.id -%}
+
+ {% else -%}
+ -
+ {{ entry.item.name }}
+ {% set ns.open_li = True -%}
+ {% endif -%}
+
+ {{ entry.reviewed }} {{ r_to_star(entry.rating) }}
+
+ {% set ns.prev_item_date = entry.item.date -%}
+ {% set ns.prev_item_id = entry.item.id -%}
+ {% endfor -%}
+ {% if ns.open_li -%}
+
+ {% endif -%}
+ {% if ns.open_ul -%}
+
+ {% endif -%}
{% endblock -%}