tangled
alpha
login
or
join now
ericwood.org
/
photos-site
1
fork
atom
A little app to serve my photography from my personal website
1
fork
atom
overview
issues
pulls
pipelines
basic footer
ericwood.org
2 months ago
9f7410aa
c7686b55
+44
-29
3 changed files
expand all
collapse all
unified
split
src
date_time.rs
templates.rs
templates
layout.jinja
+1
-9
src/date_time.rs
···
7
7
de::{self, Visitor},
8
8
};
9
9
10
10
-
#[derive(Clone, PartialOrd, Ord)]
10
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
39
-
40
40
-
impl PartialEq for DateTime {
41
41
-
fn eq(&self, other: &Self) -> bool {
42
42
-
self.0 == other.0
43
43
-
}
44
44
-
}
45
45
-
46
46
-
impl Eq for DateTime {}
47
39
48
40
struct DateTimeVisitor;
49
41
+7
src/templates.rs
···
1
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
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
137
+
138
138
+
fn year() -> String {
139
139
+
let year = chrono::Utc::now().year();
140
140
+
format!("{year}")
141
141
+
}
+36
-20
templates/layout.jinja
···
47
47
display: flex;
48
48
flex-direction: column;
49
49
align-items: center;
50
50
+
height: 100%;
50
51
}
51
52
52
53
.container {
53
54
width: 100%;
55
55
+
height: 100%;
54
56
max-width: 3000px;
55
57
overflow: auto;
58
58
+
display: flex;
59
59
+
flex-direction: column;
60
60
+
justify-content: space-between;
56
61
}
57
62
58
63
header {
···
103
108
flex-direction: column;
104
109
}
105
110
}
111
111
+
112
112
+
footer {
113
113
+
margin-top: 30px;
114
114
+
padding: 30px;
115
115
+
color: var(--half);
116
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
112
-
<header>
113
123
<div>
114
114
-
<h1>Eric Wood</h1>
115
115
-
</div>
116
116
-
<nav>
117
117
-
<ul>
118
118
-
{% set active_page = active_page|default('') %}
119
119
-
{% for link in nav_links %}
120
120
-
<li>
121
121
-
<a
122
122
-
href="{{ link.href }}"
123
123
-
{% if active_page == link.id %}
124
124
-
class="active"
125
125
-
{% endif %}
126
126
-
>{{ link.label }}</a>
127
127
-
</li>
128
128
-
{% endfor %}
129
129
-
</ul>
130
130
-
</nav>
131
131
-
</header>
132
132
-
{% block body %}{% endblock %}
124
124
+
<header>
125
125
+
<div>
126
126
+
<h1>Eric Wood</h1>
127
127
+
</div>
128
128
+
<nav>
129
129
+
<ul>
130
130
+
{% set active_page = active_page|default('') %}
131
131
+
{% for link in nav_links %}
132
132
+
<li>
133
133
+
<a
134
134
+
href="{{ link.href }}"
135
135
+
{% if active_page == link.id %}
136
136
+
class="active"
137
137
+
{% endif %}
138
138
+
>{{ link.label }}</a>
139
139
+
</li>
140
140
+
{% endfor %}
141
141
+
</ul>
142
142
+
</nav>
143
143
+
</header>
144
144
+
{% block body %}{% endblock %}
145
145
+
</div>
146
146
+
<footer>
147
147
+
© Eric Wood {{ year() }}
148
148
+
</footer>
133
149
</div>
134
150
135
151
{{ inline_script("assets/app.js") }}