value: String,
to_load: bool,
to_save: bool,
+ to_render: bool,
tmpl: tera::Tera,
filters: Vec<super::filters::Filter>,
}
fn get_to_save(&self) -> bool;
fn set_to_save(&mut self, to_save: bool);
+ fn get_to_render(&self) -> bool;
+ fn set_to_render(&mut self, to_render: bool);
+
fn add_filter(&mut self, filter: super::filters::Filter);
fn filter(&mut self);
self.field.to_save = save;
}
+ fn get_to_render(&self) -> bool {
+ self.field.to_render
+ }
+
+ fn set_to_render(&mut self, render: bool) {
+ self.field.to_render = render;
+ }
+
fn add_filter(&mut self, filter: super::filters::Filter) {
self.field.filters.push(filter);
}
fn render(&self) -> String {
let mut s = String::new();
+ if !self.field.to_render {
+ return s;
+ }
let mut context = tera::Context::new();
context.insert("name", &self.field.name);
f.field.label = String::from(name);
f.field.to_load = true;
f.field.to_save = true;
+ f.field.to_render = true;
match f.field.tmpl.add_raw_template("field", r#"{% if label %}<div class="mb-3">
<label for="{{ name }}" class="form-label">{{ label }}</label>{% endif %}
self.field.to_save = save;
}
+ fn get_to_render(&self) -> bool {
+ self.field.to_render
+ }
+
+ fn set_to_render(&mut self, render: bool) {
+ self.field.to_render = render;
+ }
+
fn add_filter(&mut self, filter: super::filters::Filter) {
self.field.filters.push(filter);
}
fn render(&self) -> String {
let mut s = String::new();
+ if !self.field.to_render {
+ return s;
+ }
let mut context = tera::Context::new();
context.insert("name", &self.field.name);
f.field.label = String::from(name);
f.field.to_load = true;
f.field.to_save = true;
+ f.field.to_render = true;
f.rows = 5;
self.field.to_save = save;
}
+ fn get_to_render(&self) -> bool {
+ self.field.to_render
+ }
+
+ fn set_to_render(&mut self, render: bool) {
+ self.field.to_render = render;
+ }
+
fn add_filter(&mut self, filter: super::filters::Filter) {
self.field.filters.push(filter);
}
fn render(&self) -> String {
let mut s = String::new();
+ if !self.field.to_render {
+ return s;
+ }
let mut context = tera::Context::new();
context.insert("name", &self.field.name);
f.field.label = String::from(name);
f.field.to_load = true;
f.field.to_save = true;
+ f.field.to_render = true;
match f.field.tmpl.add_raw_template("field", r#"{% if label %}<div class="mb-3">
<label for="{{ name }}" class="form-label">{{ label }}</label><br/>{% endif %}
self.field.to_save = save;
}
+ fn get_to_render(&self) -> bool {
+ self.field.to_render
+ }
+
+ fn set_to_render(&mut self, render: bool) {
+ self.field.to_render = render;
+ }
+
fn add_filter(&mut self, filter: super::filters::Filter) {
self.field.filters.push(filter);
}
fn render(&self) -> String {
let mut s = String::new();
+ if !self.field.to_render {
+ return s;
+ }
let mut context = tera::Context::new();
context.insert("name", &self.field.name);
f.field.label = String::from(name);
f.field.to_load = true;
f.field.to_save = true;
+ f.field.to_render = true;
match f.field.tmpl.add_raw_template("field", r#"{% if label %}<div class="mb-3">
<label for="{{ name }}" class="form-label">{{ label }}</label><br/>{% endif %}
self.field.to_save = save;
}
+ fn get_to_render(&self) -> bool {
+ self.field.to_render
+ }
+
+ fn set_to_render(&mut self, render: bool) {
+ self.field.to_render = render;
+ }
+
fn add_filter(&mut self, filter: super::filters::Filter) {
self.field.filters.push(filter);
}
fn render(&self) -> String {
let mut s = String::new();
+ if !self.field.to_render {
+ return s;
+ }
let mut context = tera::Context::new();
context.insert("name", &self.field.name);
f.field.label = String::from(name);
f.field.to_load = true;
f.field.to_save = true;
+ f.field.to_render = true;
match f.field.tmpl.add_raw_template("field", r#"<div class="form-check">
<input type="checkbox" class="form-check-input{% if help %} is-invalid{% endif %}" name="{{ name }}" id="{{ name }}" {% if value == "1" or value == "on" %}checked{% endif %}/>
self.field.to_save = save;
}
+ fn get_to_render(&self) -> bool {
+ self.field.to_render
+ }
+
+ fn set_to_render(&mut self, render: bool) {
+ self.field.to_render = render;
+ }
+
fn add_filter(&mut self, filter: super::filters::Filter) {
self.field.filters.push(filter);
}
fn render(&self) -> String {
let mut s = String::new();
+ if !self.field.to_render {
+ return s;
+ }
let mut context = tera::Context::new();
context.insert("name", &self.field.name);
f.field.name = String::from(name);
f.field.label = String::from(name);
- f.field.to_load = false;
- f.field.to_save = false;
+ f.field.to_render = true;
match f.field.tmpl.add_raw_template("field", r#"<button class="btn btn-primary" type="submit" name="{{ name }}" id="{{ name }}"
{% if form %}form="{{ form }}"{% endif %}>{{ label }}</button>"#) {