{# -*- coding: utf-8 -*- This file is part of Invenio. Copyright (C) 2015-2020 CERN. Invenio is free software; you can redistribute it and/or modify it under the terms of the MIT License; see LICENSE file for more details. #} {% macro render_checkbox(field, label='') %}
{{ field(class_="form-control") }} {{ field.label }}
{% endmacro %} {% macro render_field_errors(errors) %} {% if errors is not mapping %} {%- else %} {%- endif %} {% endmacro %} {% macro render_field(field, icon="", placeholder='', autofocus=False) %} {%- if field.errors %} {{ render_field_errors(field.errors) }} {%- endif %}
{%- if field.widget.input_type == 'hidden' %} {{ field() }} {%- elif field.widget.input_type == 'checkbox' %} {{ render_checkbox(field, label=_(field.label.text | string)) }} {%- else %} {%- set extras = dict(autofocus="") if autofocus else dict() %} {%- set _placeholder = placeholder if placeholder else _(field.label.text | string) %} {{field(class_="form-control", placeholder=_placeholder, **extras)}} {%- if icon %} {%- endif%} {%- endif%}
{% endmacro %} {% macro oauth_button(name, next=None) %}
{{ _('Sign in with %(title)s', title=config.OAUTHCLIENT_REMOTE_APPS[name]['title']) }}
{% endmacro %}