From 0c288df5b9e91bf2345ce828d2de7f5d98b30826 Mon Sep 17 00:00:00 2001 From: Andrea Zagli Date: Sat, 7 Oct 2023 09:12:26 +0200 Subject: [PATCH] Added inline property to Radio field. --- src/fields.rs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/fields.rs b/src/fields.rs index 0ee91d4..57ac335 100644 --- a/src/fields.rs +++ b/src/fields.rs @@ -435,6 +435,7 @@ pub struct FOption { #[derive(Default)] pub struct FieldRadio { field: Field, + inline: bool, options: Vec, } @@ -554,6 +555,7 @@ impl TField for FieldRadio { context.insert("help", &self.field.help); context.insert("class", &self.field.class); context.insert("value", &self.field.value); + context.insert("inline", &self.inline); context.insert("options", &self.options); s.push_str(self.field.tmpl.render("field", &context).unwrap().as_str()); @@ -578,7 +580,7 @@ impl FieldRadio { match f.field.tmpl.add_raw_template("field", r#"{% if label %}

{% endif %} {% for o in options %} -
+
@@ -590,7 +592,7 @@ _ => {}, }; match f.field.tmpl.add_raw_template("field_single", r#"
- +
"#) { Err(e) => { println!("{:?}", e) }, @@ -600,6 +602,14 @@ _ => {}, f } + pub fn get_inline(&self) -> bool { + self.inline + } + + pub fn set_inline(&mut self, inline: bool) { + self.inline = inline; + } + pub fn add_option(&mut self, option: FOption) { self.options.push(option); } -- 2.49.0