From bba9a563298102a85c8a5afdfc2964366fd1114e Mon Sep 17 00:00:00 2001 From: Bat Date: Tue, 4 Sep 2018 14:55:15 +0100 Subject: [PATCH] Add author biography at the bottom of the post --- src/routes/posts.rs | 3 ++- static/main.css | 2 +- templates/posts/details.html.tera | 14 ++++++++++++++ 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/routes/posts.rs b/src/routes/posts.rs index 678b262..7ecf9f4 100644 --- a/src/routes/posts.rs +++ b/src/routes/posts.rs @@ -57,7 +57,8 @@ fn details_response(blog: String, slug: String, conn: DbConn, user: Option "date": &post.creation_date.timestamp(), "previous": query.and_then(|q| q.responding_to.map(|r| Comment::get(&*conn, r).expect("Error retrieving previous comment").to_json(&*conn, &vec![]))), "user_fqn": user.clone().map(|u| u.get_fqn(&*conn)).unwrap_or(String::new()), - "is_author": user.map(|u| post.get_authors(&*conn).into_iter().any(|a| u.id == a.id)).unwrap_or(false) + "is_author": user.clone().map(|u| post.get_authors(&*conn).into_iter().any(|a| u.id == a.id)).unwrap_or(false), + "is_following": user.map(|u| u.is_following(&*conn, post.get_authors(&*conn)[0].id)).unwrap_or(false) })) }) }) diff --git a/static/main.css b/static/main.css index c30b313..c91cb76 100644 --- a/static/main.css +++ b/static/main.css @@ -778,5 +778,5 @@ figcaption { } .avatar.padded { - margin-right: 1em; + margin-right: 2rem; } diff --git a/templates/posts/details.html.tera b/templates/posts/details.html.tera index cae86e5..ea8280c 100644 --- a/templates/posts/details.html.tera +++ b/templates/posts/details.html.tera @@ -34,6 +34,20 @@