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.6KB

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