blob: 82b59964ec7d7f26d8eef3693e92df2350819dfd (
plain) (
tree)
|
|
use crate::helpers::*;
use crate::posts::abstractions::post::Post;
use askama::Template;
#[derive(Template)]
#[template(path = "posts.html")]
pub struct PostsView<P: Post> {
posts: Vec<P>,
}
impl<P: Post> PostsView<P> {
pub fn with_posts(posts: impl IntoIterator<Item = P>) -> Self {
let mut posts: Vec<P> = posts.into_iter().collect();
posts.sort();
posts.reverse();
Self { posts }
}
}
|