{% extends 'forms/base_widget.html' %}

{% block html -%}
    {{ field.radio_widget(field, **input_args)  }}
    {{ field.render_protection_message() }}
{%- endblock %}

{% block javascript -%}
    <script>
        setupProtectionWidget({
            fieldId: {{ field.id | tojson }},
            fieldName: {{ field.name | tojson }},
            parentProtected: {{ (field.get_form().protected_object.protection_parent.is_protected
                                 if field.can_inherit_protection else false) | tojson }},
            aclMessageUrl: {{ field.acl_message_url | tojson }},
            hasInheritedAcl: {{ (field.acl_message_url and field.protected_object.get_inherited_acl()) | bool | tojson }},
            permissionsFieldId: {{ (field.get_form().permissions.id if 'permissions' in field.get_form()
                                    else none) | tojson }},
            isUnlistedEvent: {{ field.is_unlisted_event | tojson }}
        });
    </script>
{%- endblock %}
