From 2e365755ce6a39ea6f161f660095bac7fbbbadb6 Mon Sep 17 00:00:00 2001 From: benjaoming Date: Wed, 9 Jan 2013 01:30:31 +0100 Subject: [PATCH] Scroll if there are many images, only warn about unsaved changes if there are in fact such --- .../images/templates/wiki/plugins/images/sidebar.html | 2 +- wiki/views/article.py | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/wiki/plugins/images/templates/wiki/plugins/images/sidebar.html b/wiki/plugins/images/templates/wiki/plugins/images/sidebar.html index ef61b76e..cccf93f1 100644 --- a/wiki/plugins/images/templates/wiki/plugins/images/sidebar.html +++ b/wiki/plugins/images/templates/wiki/plugins/images/sidebar.html @@ -30,7 +30,7 @@ $(document).ready( function() { -
+
{% for image in images %} {% with image.current_revision.imagerevision as revision %} diff --git a/wiki/views/article.py b/wiki/views/article.py index 79ffd59c..4375217f 100644 --- a/wiki/views/article.py +++ b/wiki/views/article.py @@ -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) -- 2.45.2