doido-view 0.0.12

Default Tera engine, layouts, partials — Action View style templating for Doido.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
//! Hotwire helpers (Turbo Frames/Streams + Stimulus).

/// A Turbo Frame wrapping `content`.
pub fn turbo_frame(id: &str, content: &str) -> String {
    format!("<turbo-frame id=\"{id}\">{content}</turbo-frame>")
}

/// A Turbo Stream action (`append`/`replace`/`remove`/…) targeting `target`.
pub fn turbo_stream(action: &str, target: &str, content: &str) -> String {
    format!(
        "<turbo-stream action=\"{action}\" target=\"{target}\"><template>{content}</template></turbo-stream>"
    )
}

/// A Stimulus `data-controller` attribute string.
pub fn stimulus_controller(name: &str) -> String {
    format!("data-controller=\"{name}\"")
}