-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcomponents.rs
More file actions
95 lines (83 loc) · 2.13 KB
/
components.rs
File metadata and controls
95 lines (83 loc) · 2.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
use crate::{macros::renderable::Renderable, models::shortcut::Shortcut};
use axum::response::Html;
use serde::Serialize;
use tera::Tera;
use tera_hot_reload::TeraTemplate;
#[derive(TeraTemplate, Serialize)]
#[template(path = "components/alert/error.html")]
pub struct ErrorAlert {
pub error: String,
pub successful: bool,
}
#[derive(TeraTemplate, Serialize)]
#[template(path = "components/alert/info.html")]
pub struct InfoAlert {
pub message: String,
pub successful: bool,
}
#[derive(TeraTemplate, Serialize)]
#[template(path = "components/alert/success.html")]
pub struct SuccessAlert {
pub message: String,
pub successful: bool,
}
#[derive(TeraTemplate, Serialize)]
#[template(path = "components/search/search_results.html")]
pub struct SearchResultsTemplate {
pub shortcuts: Vec<Shortcut>,
pub query: String,
}
#[derive(TeraTemplate, Serialize)]
#[template(path = "components/create/check_update.html")]
pub struct CheckUpdateTemplate {
pub shortcut: Shortcut,
pub new_url: String,
pub successful: bool,
}
#[derive(TeraTemplate, Serialize)]
#[template(path = "components/search/create_new.html")]
pub struct CreateNewTemplate {
pub keyword: String,
}
#[derive(TeraTemplate, Serialize)]
#[template(path = "components/common/empty.html")]
pub struct EmptyTemplate {}
#[derive(TeraTemplate, Serialize)]
#[template(path = "components/dialog/success.html")]
pub struct SuccessDialog {
pub title: String,
pub message: String,
pub keyword: String,
pub action: String,
pub status: String,
}
#[derive(TeraTemplate, Serialize)]
#[template(path = "components/dialog/error.html")]
pub struct ErrorDialog {
pub title: String,
pub message: String,
pub keyword: String,
pub action: String,
pub status: String,
}
#[derive(TeraTemplate, Serialize)]
#[template(path = "components/dialog/info.html")]
pub struct InfoDialog {
pub title: String,
pub message: String,
pub keyword: String,
pub action: String,
pub status: String,
}
impl_renderable!(
SearchResultsTemplate,
SuccessAlert,
CheckUpdateTemplate,
ErrorAlert,
InfoAlert,
CreateNewTemplate,
EmptyTemplate,
SuccessDialog,
ErrorDialog,
InfoDialog
);