1
/*
2
 * This file is part of mailpot
3
 *
4
 * Copyright 2020 - Manos Pitsidianakis
5
 *
6
 * This program is free software: you can redistribute it and/or modify
7
 * it under the terms of the GNU Affero General Public License as
8
 * published by the Free Software Foundation, either version 3 of the
9
 * License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
 * GNU Affero General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU Affero General Public License
17
 * along with this program. If not, see <https://www.gnu.org/licenses/>.
18
 */
19

            
20
use super::*;
21

            
22
/// Show help page.
23
pub async fn help(
24
    _: HelpPath,
25
    mut session: WritableSession,
26
    auth: AuthContext,
27
    State(state): State<Arc<AppState>>,
28
) -> Result<Html<String>, ResponseError> {
29
    let crumbs = vec![
30
        Crumb {
31
            label: "Home".into(),
32
            url: "/".into(),
33
        },
34
        Crumb {
35
            label: "Help".into(),
36
            url: HelpPath.to_crumb(),
37
        },
38
    ];
39
    let context = minijinja::context! {
40
        title => state.site_title.as_ref(),
41
        page_title => "Help & Documentation",
42
        description => "",
43
        root_url_prefix => &state.root_url_prefix,
44
        current_user => auth.current_user,
45
        messages => session.drain_messages(),
46
        crumbs => crumbs,
47
    };
48
    Ok(Html(TEMPLATES.get_template("help.html")?.render(context)?))
49
}