imagethumb.html 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  1. {% import 'bootstrap/wtf.html' as wtf %}
  2. {% macro field(field, image, size='100x100', crop='fit', quality=85, alt='', title='', delete_field=none, storage_type=none, bucket_name=none) %}
  3. <div class="form-group {% if field.errors %} has-error{% endif %}">
  4. {{field.label(class="control-label")|safe}}
  5. <div>
  6. {% if image %}
  7. <div class="pull-left" style="margin-right: 1em">
  8. <img src="{{ image|thumbnail(size, crop=crop, quality=quality, storage_type=storage_type, bucket_name=bucket_name) }}" alt="{{ alt }}" title="{{ title }}" />
  9. </div>
  10. {% endif %}
  11. {% if image %}<div class="pull-left">{% endif %}
  12. {{field(class="form-control", **kwargs)|safe}}
  13. {% if delete_field %}
  14. {{ wtf.form_field(delete_field) }}
  15. {% endif %}
  16. {% if image %}</div>{% endif %}
  17. </div>
  18. <div class="clearfix"></div>
  19. {%- if field.errors %}
  20. {%- for error in field.errors %}
  21. <p class="help-block">{{error}}</p>
  22. {%- endfor %}
  23. {%- elif field.description -%}
  24. <p class="help-block">{{field.description|safe}}</p>
  25. {%- endif %}
  26. </div>
  27. {% endmacro %}