~netlandish/django-wiki

2e365755ce6a39ea6f161f660095bac7fbbbadb6 — benjaoming 11 years ago fb40d08
Scroll if there are many images, only warn about unsaved changes if there are in fact such
2 files changed, 7 insertions(+), 4 deletions(-)

M wiki/plugins/images/templates/wiki/plugins/images/sidebar.html
M wiki/views/article.py
M wiki/plugins/images/templates/wiki/plugins/images/sidebar.html => wiki/plugins/images/templates/wiki/plugins/images/sidebar.html +1 -1
@@ 30,7 30,7 @@ $(document).ready( function() {
<style type="text/css">
  #image-list tr:first-child td {border:0;}
</style>
<div style="max-height: 300px; overflow: scroll-y;">
<div style="max-height: 300px; overflow: auto;">
  <table class="table" style="margin-bottom: 0;" id="image-list">
    {% for image in images %}
      {% with image.current_revision.imagerevision as revision %}

M wiki/views/article.py => wiki/views/article.py +6 -3
@@ 278,10 278,13 @@ class Edit(FormView, ArticleMixin):
                        else:
                            messages.success(self.request, _(u'Your changes were saved.'))
                        
                        request.session['unsaved_article_title_%d' % self.article.id] = form.cleaned_data['unsaved_article_title']
                        request.session['unsaved_article_content_%d' % self.article.id] = form.cleaned_data['unsaved_article_content']
                        title = form.cleaned_data['unsaved_article_title']
                        content = form.cleaned_data['unsaved_article_content']
                        
                        messages.warning(request, _('Please note that your article text has not yet been saved!'))
                        if title != self.article.current_revision.title or content != self.article.current_revision.content:
                            request.session['unsaved_article_title_%d' % self.article.id] = title
                            request.session['unsaved_article_content_%d' % self.article.id] = content
                            messages.warning(request, _('Please note that your article text has not yet been saved!'))
                        
                        if self.urlpath:
                            return redirect('wiki:edit', path=self.urlpath.path)