{% load i18n %}

<div id="id_cradmin_modelchoicefieldwrapper_{{ fieldname }}"
        class="django-cradmin-modelchoicefield-wrapper"
        django-cradmin-model-choice-field-wrapper>

    {% block input %}
        <input type="{{ rendered_input_type }}" value="{{ fieldvalue }}"
               id="{{ fieldid }}" name="{{ fieldname }}"
               django-cradmin-model-choice-field-input>
    {% endblock input %}

    {% block preview %}
        <div django-cradmin-model-choice-field-preview>
            {% if preview %}
                {{ preview|safe }}
            {% endif %}
        </div>
    {% endblock preview %}

    {% block selectbutton %}
        <button class="btn btn-default" type="button" django-cradmin-model-choice-field-changebegin-button>
            {% trans "Select ..." %}
        </button>
    {% endblock selectbutton %}

    {% block iframewrapper %}
        <div class="ng-hide django-cradmin-floating-fullsize-iframe-wrapper django-cradmin-modelchoicefield-iframe-wrapper"
                django-cradmin-model-choice-field-iframe-wrapper>
            <a href="#" class="django-cradmin-floating-fullsize-iframe-closebutton"
                    django-cradmin-model-choice-field-iframe-closebutton>
                <span class="fa fa-close"></span>
                <span class="sr-only">{% trans "Close choice window" %}</span>
            </a>
            <div class="django-cradmin-floating-fullsize-loadspinner">
                <span class="fa fa-spinner fa-spin"></span>
            </div>
            <div class="django-cradmin-floating-fullsize-iframe-inner">
                <iframe django-cradmin-model-choice-field-iframe="{{ selectview_url }}"></iframe>
            </div>
        </div>
    {% endblock iframewrapper %}
</div>
