about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--bh20simplewebuploader/main.py9
-rw-r--r--bh20simplewebuploader/templates/form.html2
2 files changed, 9 insertions, 2 deletions
diff --git a/bh20simplewebuploader/main.py b/bh20simplewebuploader/main.py
index 0db7d84..8c5c18c 100644
--- a/bh20simplewebuploader/main.py
+++ b/bh20simplewebuploader/main.py
@@ -68,7 +68,8 @@ def generate_form(schema, options):
     form section in the template) or an 'id', 'label', 'type', and 'required'
     (in which case we make a form field in the template). Non-heading dicts
     with type 'select' will have an 'options' field, with a list of (name,
-    value) tuples, and represent a form dropdown element.
+    value) tuples, and represent a form dropdown element. Non-heading dicts may
+    have a human-readable 'docstring' field describing them.
 
     Takes the deserialized metadata schema YAML, and also a deserialized YAML
     of option values. The option values are keyed on (unscoped) field name in
@@ -110,8 +111,12 @@ def generate_form(schema, options):
             # For each field
 
             ref_iri = None
+            docstring = None
             if not isinstance(field_type, str):
                 # If the type isn't a string
+                
+                # It may have documentation
+                docstring = field_type.get('doc', None)
 
                 # See if it has a more info/what goes here URL
                 predicate = field_type.get('jsonldPredicate', {})
@@ -156,6 +161,8 @@ def generate_form(schema, options):
                 record['required'] = not optional and not subtree_optional
                 if ref_iri:
                     record['ref_iri'] = ref_iri
+                if docstring:
+                    record['docstring'] = docstring
 
                 if field_name in options:
                     # The field will be a 'select' type no matter what its real
diff --git a/bh20simplewebuploader/templates/form.html b/bh20simplewebuploader/templates/form.html
index 012b9c5..166f51c 100644
--- a/bh20simplewebuploader/templates/form.html
+++ b/bh20simplewebuploader/templates/form.html
@@ -224,7 +224,7 @@
                             {{ record['label'] }}
                             {{ "*" if record['required'] else "" }}
                             {% if 'ref_iri' in record %}
-                            <a href="{{ record['ref_iri'] }}" title="More Info" target="_blank">?</a>
+                            <a href="{{ record['ref_iri'] }}" title="{{ record.get('docstring', 'More Info') }}" target="_blank">?</a>
                             {% endif %}
                         </label>
                         {% if record['type'] == 'select' %}