From 526b0bbe0c09abf08c2b9b89b1f8f03cffbae4fe Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Mar 19 2014 09:02:42 +0000 Subject: Add the _formhelper macros for the templates --- diff --git a/progit/templates/_formhelper.html b/progit/templates/_formhelper.html new file mode 100644 index 0000000..091b07b --- /dev/null +++ b/progit/templates/_formhelper.html @@ -0,0 +1,51 @@ +{% macro render_field(field, after="") %} +
+ {{ field.label }}{{ field(**kwargs)|safe }} + {% if after %} {{ after }}{% endif %} + {% if field.errors %} + + {% endif %} +
+{% endmacro %} + +{% macro render_field_invert(field, after="") %} +
+ {{ field(**kwargs)|safe }}{{ field.label }} + {% if after %} {{ after }}{% endif %} + {% if field.errors %} + + {% endif %} +
+{% endmacro %} + +{% macro render_field_in_row(field, after="") %} + + {{ field.label }} + {{ field(**kwargs)|safe }} +{% if after %} {{ after }}{% endif %} +{% if field.errors %} +{% for error in field.errors %} +{{ error }} +{% endfor %} +{% endif %} + +{% endmacro %} + +{% macro render_field_in_cell(field, after="") %} + {{ field.label }} + {{ field(**kwargs)|safe }} +{% if after %} {{ after }}{% endif %} +{% if field.errors %} +{% for error in field.errors %} +{{ error }} +{% endfor %} +{% endif %} +{% endmacro %}