Skip to main content

rumtk_web/static_components/
htmx.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;
24use crate::{rumtk_web_render_html, RUMWebTemplate};
25use askama::Template;
26
27#[derive(Debug)]
28pub struct HTMXElement {
29    version: &'static str,
30    sha: &'static str,
31}
32
33#[derive(RUMWebTemplate, Debug)]
34#[template(
35    source = "
36        <script src='https://cdn.jsdelivr.net/npm/htmx.org@{{lib.version}}/dist/htmx.min.js' integrity='{{lib.sha}}' crossorigin='anonymous'></script>
37    ",
38    ext = "html"
39)]
40pub struct HTMX {
41    lib: HTMXElement,
42}
43
44pub fn htmx() -> HTMLResult {
45    rumtk_web_render_html!(HTMX {
46        lib: HTMXElement {
47            version: "2.0.8",
48            sha: "sha384-/TgkGk7p307TH7EXJDuUlgG3Ce1UVolAOFopFekQkkXihi5u/6OCvVKyz1W+idaz"
49        }
50    })
51}