From 18853a2baf20017e926e4bb465e3c02bb5a7af97 Mon Sep 17 00:00:00 2001 From: WriterV2 Date: Sat, 3 Sep 2022 18:45:45 +0200 Subject: Universalize method to create context from works and pass entire works object --- src/works/stories.rs | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) (limited to 'src/works/stories.rs') diff --git a/src/works/stories.rs b/src/works/stories.rs index 450f3bc..73d89ad 100644 --- a/src/works/stories.rs +++ b/src/works/stories.rs @@ -1,6 +1,6 @@ use serde::{Deserialize, Serialize}; -#[derive(Debug, Deserialize)] +#[derive(Debug, Deserialize, Serialize)] pub struct Stories(pub Vec); #[derive(Debug, Deserialize, Serialize)] @@ -13,15 +13,7 @@ pub struct Story { pub language: Language, } -impl super::Works for Stories { - fn create_tera_context(&self) -> tera::Context { - let mut context = tera::Context::new(); - for story in self.0.iter() { - context.insert(format!("story-{}", story.id), &story); - } - context - } -} +impl super::Works for Stories {} #[derive(Deserialize, Serialize, Debug)] pub enum Language { -- cgit v1.2.3