From 22bac37fcaa1b1cdf8755754184ec8b3ace313b1 Mon Sep 17 00:00:00 2001 From: Harald Eilertsen Date: Thu, 11 Jan 2018 22:41:09 +0100 Subject: Drop the lib. The misc stuff from the lib root was moved to the utils module (terrible name, it's meant to be temporary.) The modules under the lib has been moved directly under the app. --- src/posts.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src/posts.rs') diff --git a/src/posts.rs b/src/posts.rs index 859cce5..fde08a8 100644 --- a/src/posts.rs +++ b/src/posts.rs @@ -1,5 +1,6 @@ use rocket::request::Form; use rocket::response::Redirect; +use utils; #[derive(BartDisplay)] #[template = "templates/new_post.html"] @@ -11,12 +12,12 @@ pub struct NewPostTemplate<'a> { implement_responder_for!(NewPostTemplate<'a>); #[get("/new", format = "text/html")] -fn new<'a>(_conn: ::rocket_blog::DbConn) -> NewPostTemplate<'a> { +fn new<'a>(_conn: utils::DbConn) -> NewPostTemplate<'a> { NewPostTemplate { title: "Bloggen", post: Default::default() } } #[post("/create", data="")] -fn create(post: Form<::models::NewPost>, conn: ::rocket_blog::DbConn) -> Redirect { +fn create(post: Form<::models::NewPost>, conn: utils::DbConn) -> Redirect { ::models::Post::create(post.get(), conn); Redirect::to("/") } @@ -30,7 +31,7 @@ pub struct ShowPostTemplate { implement_responder_for!(ShowPostTemplate); #[get("/", format = "text/html")] -fn show<'a>(id: i32, conn: ::rocket_blog::DbConn) -> ShowPostTemplate { +fn show<'a>(id: i32, conn: utils::DbConn) -> ShowPostTemplate { let p = ::models::Post::get(id, conn); ShowPostTemplate { post: p } } @@ -44,13 +45,13 @@ pub struct EditPostTemplate { implement_responder_for!(EditPostTemplate); #[get("//edit", format = "text/html")] -fn edit(id: i32, conn: ::rocket_blog::DbConn) -> EditPostTemplate { +fn edit(id: i32, conn: utils::DbConn) -> EditPostTemplate { let p = ::models::Post::get(id, conn); EditPostTemplate { post: p } } #[post("/update", data="")] -fn update(post: Form<::models::Post>, conn: ::rocket_blog::DbConn) -> Redirect { +fn update(post: Form<::models::Post>, conn: utils::DbConn) -> Redirect { ::models::Post::update(post.get(), conn); Redirect::to("/") } -- cgit v1.2.3