{% extends "admin/change_form.html" %}
{% load i18n widgy_tags admin_urls %}

{% block object-tools %}
  {% if change %}
    <ul class="object-tools">
    {% if original.status == 2 %}
    <li><a href="{% url 'admin:widgy_mezzanine_widgypage_unpublish' original.pk %}">{% trans "Unpublish" %}</a></li>
    {% endif %}
    {% get_action_links original original.root_node.working_copy as links %}
    {% for link in links %}
      <li><a class="{{ link.type }}" target="_blank" href="{{ link.url }}">{{ link.text }}</a></li>
    {% endfor %}
    {% if has_add_permission %}
    <li><a class="widgy-fancybox" href="{% url 'admin:widgy_mezzanine_widgypage_clone' original.pk %}">{% trans "Clone" %}</a></li>
    {% endif %}
    {% if history_url %}
      <li><a class="historylink" target="_blank" href="{{ history_url }}">{% trans "History" %}</a></li>
    {% endif %}
    {% if has_absolute_url and original.status == 2 %}
        <li><a href="{{ absolute_url }}" class="viewsitelink">
            {% trans "View live version" %}
        </a></li>
    {% endif%}
    </ul>
  {% endif %}
{% endblock %}

{% block submit_buttons_bottom %}
<div class="submit-row" {% if is_popup %}style="overflow: auto;"{% endif %}>
    {% if has_delete_permission and not add %}
      <p class="deletelink-box">
      <a href="{% url opts|admin_urlname:'delete' original.pk|admin_urlquote %}" class="deletelink">{% trans "Delete" %}</a>
      </p>
    {% endif %}
    {% for action, title in save_buttons %}
      <input type="submit" value="{{ title }}" class="default" name="{{ action }}">
    {% endfor %}
</div>
{% endblock %}
