summaryrefslogblamecommitdiff
path: root/src/views/posts.rs
blob: 2ce69f84ff3650d58b78fab9a3d7825c333b0dae (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
















                                                                   
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 {
        Self {
            posts: posts.into_iter().collect(),
        }
    }
}