From b0f003b5e1e5d156456a6e7462db1d771074b046 Mon Sep 17 00:00:00 2001 From: dave Date: Wed, 12 Sep 2018 21:55:00 -0700 Subject: [PATCH] use jinja right --- styles/less/main.less | 15 +++++-- templates/album.html | 54 ++++++++++++++++++++++++++ templates/create_tags.html | 43 ++++++++++++++++++++ templates/dates.html | 9 ++++- templates/feed.html | 9 ++++- templates/map.html | 9 ++++- templates/monthly.html | 9 ++++- templates/page-bottom.html | 5 --- templates/{page-top.html => page.html} | 11 +++++- templates/photo_tag.html | 12 ++++-- 10 files changed, 156 insertions(+), 20 deletions(-) create mode 100644 templates/album.html create mode 100644 templates/create_tags.html delete mode 100644 templates/page-bottom.html rename templates/{page-top.html => page.html} (90%) diff --git a/styles/less/main.less b/styles/less/main.less index eeb125c..4074a8f 100644 --- a/styles/less/main.less +++ b/styles/less/main.less @@ -71,15 +71,24 @@ a { margin-right: 0.5em; border-radius: 3px; } -.tag-icon-mod-3-0 { +.tag-icon-mod-6-0 { background: #ffc94c; } -.tag-icon-mod-3-1 { +.tag-icon-mod-6-1 { background: #41ccb4; } -.tag-icon-mod-3-2 { +.tag-icon-mod-6-2 { background: #40c365; } +.tag-icon-mod-6-3 { + background: #ffc900; +} +.tag-icon-mod-6-4 { + background: #4100b4; +} +.tag-icon-mod-6-5 { + background: #00c365; +} .email-content { padding: 0em 4em; diff --git a/templates/album.html b/templates/album.html new file mode 100644 index 0000000..2dd1820 --- /dev/null +++ b/templates/album.html @@ -0,0 +1,54 @@ +{% extends "page.html" %} +{% set title = "Photos by date" %} +{% set subtitle = "By date, descending" %} + +{% block buttons %} + xxx +{% endblock %} + +{% block body %} + +{% set locals = namespace() %} +{% set total_pages = (total_items/pgsize)|ceil %} + +
+ {% set locals.im_date = "" %} + {% for item in images %} + {% set newdate = item.date.strftime("%b %d, %Y") %} + {% if newdate != locals.im_date %} + {% set locals.im_date = newdate %} +

{{ locals.im_date }}

+ {% endif %} +
+ + + +
+ {% endfor %} +
+
+
Page
+ {% if page > 0 %} + + {% endif %} +
+
    + {% for pgnum in range(0, total_pages) %} + + {{ pgnum }} + + {% endfor %} +
+
+ {% if page + 1 < total_pages %} + + {% endif %} +
+
+ +{% endblock %} + diff --git a/templates/create_tags.html b/templates/create_tags.html new file mode 100644 index 0000000..8b4d407 --- /dev/null +++ b/templates/create_tags.html @@ -0,0 +1,43 @@ +{% set title = "Placeholder Title" %} +{% set subtitle = image.uuid %} + +{% include "page-top.html" %} + + +
+
+

Current Tags

+ {# + + #} + +
+
+

All tags

+
    + {% for tag in alltags %} +
  • +
    + + +
    +
  • + {% endfor %} +
+
+
+

Add tag

+
+ + +
+
+
+ +{% include "page-bottom.html" %} diff --git a/templates/dates.html b/templates/dates.html index 97a4a81..3ab0b6f 100644 --- a/templates/dates.html +++ b/templates/dates.html @@ -1,7 +1,12 @@ +{% extends "page.html" %} {% set title = "All photos" %} {% set subtitle = "By date, descending" %} -{% include "page-top.html" %} +{% block buttons %} + xxx +{% endblock %} + +{% block body %} {% set locals = namespace() %} @@ -21,4 +26,4 @@ {% endfor %} -{% include "page-bottom.html" %} +{% endblock %} diff --git a/templates/feed.html b/templates/feed.html index d0e8c72..4cbd2cf 100644 --- a/templates/feed.html +++ b/templates/feed.html @@ -1,7 +1,12 @@ +{% extends "page.html" %} {% set title = "Photos by date" %} {% set subtitle = "By date, descending" %} -{% include "page-top.html" %} +{% block buttons %} + xxx +{% endblock %} + +{% block body %} {% set locals = namespace() %} @@ -46,4 +51,4 @@ -{% include "page-bottom.html" %} +{% endblock %} diff --git a/templates/map.html b/templates/map.html index d162e4b..9714c9a 100644 --- a/templates/map.html +++ b/templates/map.html @@ -1,7 +1,12 @@ +{% extends "page.html" %} {% set title = "Photo map" %} {% set subtitle = "GPS data" %} -{% include "page-top.html" %} +{% block buttons %} + xxx +{% endblock %} + +{% block body %}
@@ -30,4 +35,4 @@
-{% include "page-bottom.html" %} +{% endblock %} diff --git a/templates/monthly.html b/templates/monthly.html index 680a386..f31af38 100644 --- a/templates/monthly.html +++ b/templates/monthly.html @@ -1,7 +1,12 @@ +{% extends "page.html" %} {% set title = "Server statistics" %} {% set subtitle = "Placeholder" %} -{% include "page-top.html" %} +{% block buttons %} + xxx +{% endblock %} + +{% block body %} {% set locals = namespace() %} @@ -31,4 +36,4 @@ -{% include "page-bottom.html" %} +{% endblock %} diff --git a/templates/page-bottom.html b/templates/page-bottom.html deleted file mode 100644 index aac1486..0000000 --- a/templates/page-bottom.html +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/templates/page-top.html b/templates/page.html similarity index 90% rename from templates/page-top.html rename to templates/page.html index db2af74..24b8f57 100644 --- a/templates/page-top.html +++ b/templates/page.html @@ -24,7 +24,7 @@
  • Bar
  • Tags
  • {% for tag in all_tags %} -
  • {{ tag.title }}
  • +
  • {{ tag.title }}
  • {% endfor %} @@ -40,9 +40,18 @@

    + {% block buttons %} + {% endblock %}
    + {% block body %}default body{% endblock %} +
    + + + + + diff --git a/templates/photo_tag.html b/templates/photo_tag.html index c9dcd7c..1fb73d0 100644 --- a/templates/photo_tag.html +++ b/templates/photo_tag.html @@ -1,9 +1,14 @@ +{% extends "page.html" %} + {% set title = "Placeholder Title" %} {% set subtitle = image.uuid %} -{% include "page-top.html" %} +{% block buttons %} + xxx +{% block body %} +

    Current Tags

    @@ -13,7 +18,7 @@ @@ -40,4 +45,5 @@
    -{% include "page-bottom.html" %} + +{% endblock %}