pub async fn create_new_class_message_page(id: i32, auth: AuthCookie, conn: Database) -> Html {
    use crate::schema::class::dsl as class;
    use crate::schema::class_teacher::dsl as class_teacher;
    match conn
        .run(move |c| {
            class_teacher::class_teacher
                .filter(class_teacher::user_id.eq(auth.0))
                .filter(class_teacher::class_id.eq(id))
                .inner_join(class::class)
                .select(crate::schema::class::all_columns)
                .get_result::<crate::models::Class>(c)
        })
        .await
    {
        Ok(class) => Html::default()
            .head(default_head(
                "Create a new message in this class".to_string(),
            ))
            .body(
                Body::default()
                    .child(H1::new(format!(
                        "Create a new message in class \"{class}\"",
                        class = class.name
                    )))
                    .child(create_new_message_form()),
            ),
        Err(diesel::result::Error::NotFound) => Html::default()
            .head(default_head("Error.".to_string()))
            .body(
                Body::default()
                    .child(H1::new("Error completing this request"))
                    .child(P::with_text(
                        "Either the class in question doesn't exist, or you aren't a
                teacher in that class.",
                    )),
            ),
        Err(e) => {
            error!("Error retrieving results from database: {:#?}", e);
            database_error()
        }
    }
}
/// Returns the form which needs to be filled in and submitted in order to create a new user in a
/// class.
Returns the form which needs to be filled in and submitted in order to create a new user in a
class.
Returns the form which needs to be filled in and submitted in order to create a new user in a class .
pub async fn create_new_class_message_page(id: i32, auth: AuthCookie, conn: Database) -> Html {
    use crate::schema::class::dsl as class;
    use crate::schema::class_teacher::dsl as class_teacher;
    match conn
        .run(move |c| {
            class_teacher::class_teacher
                .filter(class_teacher::user_id.eq(auth.0))
                .filter(class_teacher::class_id.eq(id))
                .inner_join(class::class)
                .select(crate::schema::class::all_columns)
                .get_result::<crate::models::Class>(c)
        })
        .await
    {
        Ok(class) => Html::default()
            .head(default_head(
                "Create a new message in this class".to_string(),
            ))
            .body(
                Body::default()
                    .child(H1::new(format!(
                        "Create a new message in class \"{class}\"",
                        class = class.name
                    )))
                    .child(create_new_message_form()),
            ),
        Err(diesel::result::Error::NotFound) => Html::default()
            .head(default_head("Error.".to_string()))
            .body(
                Body::default()
                    .child(H1::new("Error completing this request"))
                    .child(P::with_text(
                        "Either the class in question doesn't exist, or you aren't a
                teacher in that class.",
                    )),
            ),
        Err(e) => {
            error!("Error retrieving results from database: {:#?}", e);
            database_error()
        }
    }
}
pub async fn create_new_class_message_page ( id : i32 , auth : AuthCookie , conn : Database ) -> Html { use crate :: schema :: class :: dsl as class ; use crate :: schema :: class_teacher :: dsl as class_teacher ; match conn . run ( move | c | { class_teacher :: class_teacher . filter ( class_teacher :: user_id . eq ( auth . 0 ) ) . filter ( class_teacher :: class_id . eq ( id ) ) . inner_join ( class :: class ) . select ( crate :: schema :: class :: all_columns ) . get_result :: < crate :: models :: Class > ( c ) } ) . await { Ok ( class ) => Html :: default ( ) . head ( default_head ( " " . to_string ( ) , ) ) . body ( Body :: default ( ) . child ( H1 :: new ( format ! ( " \" \" " class class name ) ) ) . child ( create_new_message_form ( ) ) , ) , Err ( diesel :: result :: Error :: NotFound ) => Html :: default ( ) . head ( default_head ( " " . to_string ( ) ) ) . body ( Body :: default ( ) . child ( H1 :: new ( " " ) ) . child ( P :: with_text ( " " , ) ) , ) , Err ( e ) => { error ! ( " " e ) ; database_error ( ) } } }
Returns the form which needs to be filled in and submitted in order to create a new user in a
class.
Returns the form which needs to be filled in and submitted in order to create a new user in a class .
id
i32
auth
AuthCookie
conn
Database