~netlandish/django-wiki

c14ee731e94304b8646baceac9fd080fa98b6aae — benjaoming 11 years ago 2e36575
Use JS to save article form data on all sidebar plugin forms
M wiki/plugins/images/templates/wiki/plugins/images/sidebar.html => wiki/plugins/images/templates/wiki/plugins/images/sidebar.html +0 -10
@@ 13,16 13,6 @@ function insert_image(image_id) {
    $('#id_content').insertAtCaret(imagetag+'\n\n');  
  }
}

$(document).ready( function() {
  $('.sidebar-form').each(function () {
    $(this).submit( function() {
      this.unsaved_article_title.value = $('#id_title').val();
      this.unsaved_article_content.value = $('#id_content').val();
    });
  });
});

</script>
{% endaddtoblock %}


M wiki/templates/wiki/includes/editor_sidebar.html => wiki/templates/wiki/includes/editor_sidebar.html +13 -0
@@ 1,3 1,16 @@
{% addtoblock "js" %}
<script type="text/javascript">
  $(document).ready( function() {
    $('.sidebar-form').each(function () {
      $(this).submit( function() {
        this.unsaved_article_title.value = $('#id_title').val();
        this.unsaved_article_content.value = $('#id_content').val();
      });
    });
  });
</script>
{% endaddtoblock %}

<div class="accordion" id="accordion_{{ plugin.slug }}">

{% for plugin, plugin_form in sidebar %}