From 70dd2332f095e2fefc10d30fe8a59aac5a1e736a Mon Sep 17 00:00:00 2001
From: Anders Harrisson <anders.harrisson@ess.eu>
Date: Fri, 22 Oct 2021 11:32:21 +0200
Subject: [PATCH] Add description to host IOC boolean field

JIRA INFRA-4308
---
 app/network/forms.py        | 6 +++++-
 app/templates/_helpers.html | 9 +++++++--
 2 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/app/network/forms.py b/app/network/forms.py
index a3c4b17..0f91db3 100644
--- a/app/network/forms.py
+++ b/app/network/forms.py
@@ -165,7 +165,11 @@ class HostForm(CSEntryForm):
     )
     description = TextAreaField("Description")
     device_type_id = SelectField("Device Type")
-    is_ioc = BooleanField("IOC", default=False)
+    is_ioc = BooleanField(
+        "IOC",
+        default=False,
+        description="This host will be used to run IOCs",
+    )
     ansible_vars = YAMLField(
         "Ansible vars",
         description="Enter variables in YAML format. See https://docs.ansible.com/ansible/latest/reference_appendices/YAMLSyntax.html",
diff --git a/app/templates/_helpers.html b/app/templates/_helpers.html
index 90df01d..e796d99 100644
--- a/app/templates/_helpers.html
+++ b/app/templates/_helpers.html
@@ -136,7 +136,12 @@
       {{ field(class_="form-check-input", **kwargs) }}
       {{ field.label(class_="form-check-label") }}
     </div>
-  </div>
+    {% if field.description %}
+    <small class="form-text text-muted">
+      {{ field.description|safe }}
+    </small>
+    {% endif %}
+</div>
   {% else %}
   {{ field.label(class_="col-sm-" + label_size + " col-form-label") }}
   <div class="col-sm-{{ input_size }}">
@@ -277,4 +282,4 @@
   </div>
   <div class="card-body item-comment">{{ comment.body }}</div>
 </div>
-{%- endmacro %}
\ No newline at end of file
+{%- endmacro %}
-- 
GitLab