| 12345678910111213141516171819202122232425262728 |
- {# myapp/templates/macros.html #}
- <!-- Highlight the current tab -->
- {% macro nav_link(endpoint, text) %}
- {% if request.endpoint is not none %}
- {% if request.endpoint.endswith(endpoint) %}
- <a class="active teal item" href="{{ url_for(endpoint) }}">{{ text }}</a>
- {% else %}
- <a class="item" href="{{ url_for(endpoint) }}">{{ text }}</a>
- {% endif %}
- {% else %}
- <a class="item" href="{{ url_for(endpoint) }}">{{ text }}</a>
- {% endif %}
- {% endmacro %}
- <!-- Render a WTForm form's field (with it's possible associated errors) from a WTForms form -->
- {% macro render_field(field) %}
- <div class="field">
- {{ field(name_=field.name, id=field.name, placeholder=field.description, class_="field") }}
- </div>
- {% if field.errors %}
- <ul>
- {% for error in field.errors %}
- <li class="form-error">{{ error }}</li>
- {% endfor %}
- </ul>
- {% endif %}
- {% endmacro %}
|