added custom_css in config
This commit is contained in:
+23
@@ -13,6 +13,29 @@ success_message = "Success sending submission"
|
|||||||
# Text displayed in a popup shown after submitting, in case of an error
|
# Text displayed in a popup shown after submitting, in case of an error
|
||||||
error_message = "Error while sending submission"
|
error_message = "Error while sending submission"
|
||||||
|
|
||||||
|
custom_css = """
|
||||||
|
:root {
|
||||||
|
--bg-body: #0f172a;
|
||||||
|
--bg-card: #1e293b;
|
||||||
|
--bg-input: #0f172a;
|
||||||
|
|
||||||
|
--text-main: #f8fafc;
|
||||||
|
--text-muted: #94a3b8;
|
||||||
|
--text-inv: #ffffff;
|
||||||
|
|
||||||
|
--primary: #6366f1;
|
||||||
|
--primary-hover: #818cf8;
|
||||||
|
--primary-glow: rgba(99, 102, 241, 0.25);
|
||||||
|
|
||||||
|
--border-base: #334155;
|
||||||
|
--border-focus: #6366f1;
|
||||||
|
|
||||||
|
--radius-lg: 16px;
|
||||||
|
--radius-md: 10px;
|
||||||
|
--shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3), 0 10px 10px -5px rgba(0, 0, 0, 0.2);
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
|
||||||
# Standard single-line input
|
# Standard single-line input
|
||||||
[[fields]]
|
[[fields]]
|
||||||
name = "username"
|
name = "username"
|
||||||
|
|||||||
@@ -52,6 +52,7 @@ pub struct AppConfig {
|
|||||||
pub success_message: String,
|
pub success_message: String,
|
||||||
pub error_message: String,
|
pub error_message: String,
|
||||||
pub fields: Vec<FieldDef>,
|
pub fields: Vec<FieldDef>,
|
||||||
|
pub custom_css: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
@@ -71,6 +72,7 @@ pub async fn render_form(State(state): State<AppState>) -> impl IntoResponse {
|
|||||||
error_message: &'a str,
|
error_message: &'a str,
|
||||||
fields: &'a [FieldDef],
|
fields: &'a [FieldDef],
|
||||||
lang: &'a str,
|
lang: &'a str,
|
||||||
|
custom_css: &'a str,
|
||||||
}
|
}
|
||||||
|
|
||||||
let tmpl = FormTemplate {
|
let tmpl = FormTemplate {
|
||||||
@@ -80,6 +82,7 @@ pub async fn render_form(State(state): State<AppState>) -> impl IntoResponse {
|
|||||||
error_message: &state.cfg.error_message,
|
error_message: &state.cfg.error_message,
|
||||||
fields: &state.cfg.fields,
|
fields: &state.cfg.fields,
|
||||||
lang: "en",
|
lang: "en",
|
||||||
|
custom_css: state.cfg.custom_css.as_deref().unwrap_or(""),
|
||||||
};
|
};
|
||||||
match tmpl.render() {
|
match tmpl.render() {
|
||||||
Ok(html) => Html(html).into_response(),
|
Ok(html) => Html(html).into_response(),
|
||||||
|
|||||||
@@ -11,6 +11,7 @@
|
|||||||
<style>
|
<style>
|
||||||
/*<![CDATA[*/
|
/*<![CDATA[*/
|
||||||
{%~ include "_layout.css" ~%}
|
{%~ include "_layout.css" ~%}
|
||||||
|
{{ custom_css | safe }}
|
||||||
/*]]>*/
|
/*]]>*/
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
|
|||||||
Reference in New Issue
Block a user