{# https://gist.github.com/bearz/7394681 #} {% macro bs_form(form, action, opts, method='post') -%} {% from 'bs_form_body.htm' import bs_form_body with context %} {% if not opts.class %} {% do opts.update({'class': ''}) %} {% endif %}

{{ opts.title }}

{% if opts.is_ajax %} {% set atts = {'data-url': action, 'class': 'ajax-form'} %} {% else %} {% set atts = {'action': action} %} {% endif %} {% do atts.update({ 'method': method, 'enctype': "multipart/form-data", 'role': 'form' }) %} {{ bs_form_body(form) }} {% if caller %} {{ caller() }} {% endif %}
{%- endmacro %}