A little app to serve my photography from my personal website

basic footer

+44 -29
+1 -9
src/date_time.rs
··· 7 7 de::{self, Visitor}, 8 8 }; 9 9 10 - #[derive(Clone, PartialOrd, Ord)] 10 + #[derive(Clone, PartialOrd, Ord, PartialEq, Eq)] 11 11 pub struct DateTime(chrono::DateTime<FixedOffset>); 12 12 13 13 impl DateTime { ··· 36 36 value.0.to_rfc3339() 37 37 } 38 38 } 39 - 40 - impl PartialEq for DateTime { 41 - fn eq(&self, other: &Self) -> bool { 42 - self.0 == other.0 43 - } 44 - } 45 - 46 - impl Eq for DateTime {} 47 39 48 40 struct DateTimeVisitor; 49 41
+7
src/templates.rs
··· 1 + use chrono::Datelike; 1 2 use minijinja::{Environment, Error, ErrorKind, Value}; 2 3 use minijinja_autoreload::AutoReloader; 3 4 use serde::Serialize; ··· 40 41 env.add_function("photo_thumbnail_url", photo_thumbnail_url); 41 42 env.add_function("photo_url", photo_url); 42 43 env.add_function("assets_path", assets_path); 44 + env.add_function("year", year); 43 45 env.add_global( 44 46 "nav_links", 45 47 Value::from_serialize([ ··· 132 134 fn assets_path(path: String) -> String { 133 135 format!("/photos/assets/{path}") 134 136 } 137 + 138 + fn year() -> String { 139 + let year = chrono::Utc::now().year(); 140 + format!("{year}") 141 + }
+36 -20
templates/layout.jinja
··· 47 47 display: flex; 48 48 flex-direction: column; 49 49 align-items: center; 50 + height: 100%; 50 51 } 51 52 52 53 .container { 53 54 width: 100%; 55 + height: 100%; 54 56 max-width: 3000px; 55 57 overflow: auto; 58 + display: flex; 59 + flex-direction: column; 60 + justify-content: space-between; 56 61 } 57 62 58 63 header { ··· 103 108 flex-direction: column; 104 109 } 105 110 } 111 + 112 + footer { 113 + margin-top: 30px; 114 + padding: 30px; 115 + color: var(--half); 116 + } 106 117 </style> 107 118 <title>{% block title %}{% endblock %}</title> 108 119 {% block head %}{% endblock %} 109 120 </head> 110 121 <body> 111 122 <div class="container"> 112 - <header> 113 123 <div> 114 - <h1>Eric Wood</h1> 115 - </div> 116 - <nav> 117 - <ul> 118 - {% set active_page = active_page|default('') %} 119 - {% for link in nav_links %} 120 - <li> 121 - <a 122 - href="{{ link.href }}" 123 - {% if active_page == link.id %} 124 - class="active" 125 - {% endif %} 126 - >{{ link.label }}</a> 127 - </li> 128 - {% endfor %} 129 - </ul> 130 - </nav> 131 - </header> 132 - {% block body %}{% endblock %} 124 + <header> 125 + <div> 126 + <h1>Eric Wood</h1> 127 + </div> 128 + <nav> 129 + <ul> 130 + {% set active_page = active_page|default('') %} 131 + {% for link in nav_links %} 132 + <li> 133 + <a 134 + href="{{ link.href }}" 135 + {% if active_page == link.id %} 136 + class="active" 137 + {% endif %} 138 + >{{ link.label }}</a> 139 + </li> 140 + {% endfor %} 141 + </ul> 142 + </nav> 143 + </header> 144 + {% block body %}{% endblock %} 145 + </div> 146 + <footer> 147 + © Eric Wood {{ year() }} 148 + </footer> 133 149 </div> 134 150 135 151 {{ inline_script("assets/app.js") }}