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


{% block extrahead %}{{ block.super }}
<!-- admin/dbtemplates/template/change_form - extrahead - START -->
<script type="text/javascript">
try {
    jQuery(document);
} catch (e) {
    alert("Error, jQuery JS not loaded!\n Original error was:" + e);
}
jQuery(document).ready(function($) {
  
  var diff_url = "diff/";
  var diff_div = $("#diff");
  
  $("#template_diff").click(function() {
    log("template diff link clicked");
    diff_div.fadeTo('fast', 0.5);
    diff_div.html(""); // overwrite old content
    
    try {
        var content = editor.getCode(); // Get the code from CodeMirror editor
    } catch (e) {
        log("Error can't getCode() from CodeMirror editor\n Original error was:" + e);
        var content = $("#id_content")[0].value;
    }
    $.post(diff_url, { "content": content }, function(form_html) {
        diff_div.fadeTo('fast', 1.0);
        diff_div.html(form_html);
    });
  });
});
</script>
<!-- admin/dbtemplates/template/change_form - extrahead - END -->
{% endblock %}


{% block object-tools %}
<!-- admin/dbtemplates/template/change_form - object-tools - START -->
    <ul class="object-tools">
      <li><a href="JavaScript:void(0)" id="template_diff">diff</a></li>      
      <li><a href="{% url PageAdmin-page_list %}?markup_id=0" class="openinwindow" title="{% trans 'List of all pages for creating links' %}">{% trans 'page list' %}</a></li>
      <li><a href="{% url PageAdmin-tag_list %}" class="openinwindow" title="{% trans 'List of all available PyLucid template tags' %}">{% trans 'tag list' %}</a></li>
      <li><a href="history/" class="historylink">{% trans "History" %}</a></li>
    </ul>
<!-- admin/dbtemplates/template/change_form - object-tools - END -->
{% endblock %}


{% block content %}
<!-- admin/dbtemplates/template/change_form - content - START -->
<ul>
    <li>Click on diff button, to get a diff of this current edited content compared with the filesystem content (if available)</li>
    <li>{% include "admin/pylucid/includes/design_link.html" %}</li>
</ul>
<div id="diff"></div>
<!-- admin/dbtemplates/template/change_form - content - END -->
{{ block.super }}{% endblock %}

