No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

editable_component.html 1.2KB

123456789101112131415161718192021222324
  1. {% macro input(fieldname, field, value='') -%}
  2. <label for="field_input_{{fieldname}}">{{fieldname}}</label>
  3. {% if field.base_type == 'bool' %}
  4. <input id="field_input_{{fieldname}}" name="field_input_{{fieldname}}" type="checkbox" checked="{% if value %}checked{% endif %}" >
  5. {% elif field.base_type == 'char' or field.base_type == 'int' %}
  6. <input id="{{fieldname}}" name="field_input_{{fieldname}}" type="text" value="{{value}}" >
  7. {% elif field.base_type == 'ref' %}
  8. {% if value is iterable %}
  9. {% set sval=value|join(',') %}
  10. {% else %}
  11. {% set sval = value %}
  12. {% endif %}
  13. {% if field.directly_editable %}
  14. <input id="{{fieldname}}" name="field_input_{{fieldname}}" type="text" value="{{sval}}" >
  15. {% set l_classe = field.allowed_classes %}
  16. <p> Please enter uids to instances of {{ l_classe.__name__ }} separated by commas </p>
  17. {% else %}
  18. <input id="{{fieldname}}" name="field_input_{{fieldname}}" type="text" value="{{sval}}" readonly >
  19. <p> If you want to update this field, please do it in child objects</p>
  20. {% endif %}
  21. {% else %}
  22. Unsupported base type "{{field.base_type}}" </br>
  23. {% endif %}
  24. {%- endmacro %}