{% load i18n %}

<div class="related-widget-wrapper">
  {{ rendered_widget }}

  {% block links %}{% spaceless %}
    {% if not is_hidden %}
      {% if can_view_related or can_add_related or can_change_related or can_delete_related %}
        <div class="related-widget-wrapper__buttons btn-square-group">

          {% if can_add_related %}
            <a id="add_id_{{ name }}"
               class="related-widget-wrapper__link add-related btn btn-square btn-sm btn-square--success"
               href="{{ add_related_url }}?{{ url_params }}"
               data-toggle="tooltip"
               data-placement="top"
               data-trigger="hover"
               data-html="true"
               title="{% blocktrans %}Add another {{ model }}{% endblocktrans %}">
                <i class="fa fa-plus"></i>
            </a>
          {% endif %}

          {% if can_view_related or can_change_related %}
            <a id="change_id_{{ name }}"
               class="related-widget-wrapper__link change-related btn btn-square btn-sm btn-square--info"
               data-href-template="{{ change_related_template_url }}?{{ url_params }}"
               data-toggle="tooltip"
               data-placement="top"
               data-trigger="hover"
               data-html="true"
               {% if can_change_related %}
                title="{% blocktrans %}Change selected {{ model }}{% endblocktrans %}">
               {% else %}
                title="{% blocktrans %}View selected {{ model }}{% endblocktrans %}">
               {% endif %}
                <i class="fa {% if can_change_related %}fa-pencil{% else %}fa-eye{% endif %}"></i>
            </a>
          {% endif %}

          {% if can_delete_related %}
            <a id="delete_id_{{ name }}"
               class="related-widget-wrapper__link delete-related btn btn-square btn-sm btn-square--danger"
               data-href-template="{{ delete_related_template_url }}?{{ url_params }}"
               data-toggle="tooltip"
               data-placement="top"
               data-trigger="hover"
               data-html="true"
               title="{% blocktrans %}Delete selected {{ model }}{% endblocktrans %}">
                <i class="fa fa-trash"></i>
            </a>
          {% endif %}

        </div>
      {% endif %}
    {% endif %}
  {% endspaceless %}{% endblock %}
</div>
