Skip to main content

rumtk_web/static_components/
meta.rs

1/*
2 * rumtk attempts to implement HL7 and medical protocols for interoperability in medicine.
3 * This toolkit aims to be reliable, simple, performant, and standards compliant.
4 * Copyright (C) 2025  Luis M. Santos, M.D.
5 * Copyright (C) 2025  Nick Stephenson
6 * Copyright (C) 2025  Ethan Dixon
7 * Copyright (C) 2025  MedicalMasses L.L.C.
8 *
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either
12 * version 2.1 of the License, or (at your option) any later version.
13 *
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17 * Lesser General Public License for more details.
18 *
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
22 */
23use crate::utils::types::{HTMLResult, RUMString, SharedAppState};
24use crate::{rumtk_web_render_html, RUMWebTemplate};
25use askama::Template;
26
27#[derive(RUMWebTemplate)]
28#[template(
29    source = "
30            <meta charset='UTF-8'>
31            <meta http-equiv='Content-Type' content='text/html; charset=utf-8' />
32            <meta name='viewport' content='width=device-width, initial-scale=1.0' />
33            <meta http-equiv='X-UA-Compatible' content='IE=edge,chrome=1'/>
34            <meta name='description' content='{{description}}'>
35            <title>{{title}}</title>
36            <link rel='icon' type='image/png' href='/static/img/icon.png'>
37    ",
38    ext = "html"
39)]
40pub struct Meta {
41    title: RUMString,
42    description: RUMString,
43}
44
45pub fn meta(state: SharedAppState) -> HTMLResult {
46    let owned_state = state.read().expect("Lock failure");
47
48    rumtk_web_render_html!(Meta {
49        title: owned_state.get_config().title.clone(),
50        description: owned_state.get_config().description.clone()
51    })
52}