From 79220c39f9b0f75b777c9900637706486400ace0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Laura=20Kl=C3=BCnder?= Date: Sun, 25 Jun 2017 16:12:57 +0200 Subject: [PATCH] add has_no_effect check to changes and replace undo button icon --- src/c3nav/editor/static/editor/css/editor.css | 5 +++++ .../editor/templates/editor/fragment_change_groups.html | 4 +++- src/c3nav/editor/views/changes.py | 1 + src/c3nav/mapdata/fields.py | 4 +++- 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/c3nav/editor/static/editor/css/editor.css b/src/c3nav/editor/static/editor/css/editor.css index 2bef8b2f..2f9b2cee 100644 --- a/src/c3nav/editor/static/editor/css/editor.css +++ b/src/c3nav/editor/static/editor/css/editor.css @@ -172,6 +172,11 @@ form button.invisiblesubmit { margin-top: -6px; margin-bottom: -2px; margin-right: -5px; + margin-left: 5px; +} +.change-group .glyphicon-share-alt { + transform: scale(-1, 1); + -webkit-transform: scale(-1, 1); } .change-group tr td:last-child>i { margin-right: -2px; diff --git a/src/c3nav/editor/templates/editor/fragment_change_groups.html b/src/c3nav/editor/templates/editor/fragment_change_groups.html index b5b304b3..91b68def 100644 --- a/src/c3nav/editor/templates/editor/fragment_change_groups.html +++ b/src/c3nav/editor/templates/editor/fragment_change_groups.html @@ -29,6 +29,8 @@ {% if change.apply_problem %} + {% elif change.has_no_effect %} + {% endif %} {% if change.author and change.author != changeset.author %} @@ -38,7 +40,7 @@ {% endif %} {% if change.can_restore %} - + {% endif %} diff --git a/src/c3nav/editor/views/changes.py b/src/c3nav/editor/views/changes.py index 4dfa744e..39f0e20f 100644 --- a/src/c3nav/editor/views/changes.py +++ b/src/c3nav/editor/views/changes.py @@ -129,6 +129,7 @@ def group_changes(changeset, can_edit=False, show_history=False): else: change_data.update({ 'apply_problem': change.check_apply_problem(), + 'has_no_effect': change.check_has_no_effect(), 'can_restore': change.can_restore, }) changes.append(change_data) diff --git a/src/c3nav/mapdata/fields.py b/src/c3nav/mapdata/fields.py index 727a2359..63ad34ef 100644 --- a/src/c3nav/mapdata/fields.py +++ b/src/c3nav/mapdata/fields.py @@ -49,7 +49,9 @@ class GeometryField(models.TextField): return clean_geometry(shape(json.loads(value))) def get_prep_value(self, value): - if self.geomtype == 'polygon' and not isinstance(value, Polygon): + if value == '': + return None + elif self.geomtype == 'polygon' and not isinstance(value, Polygon): raise TypeError(_('Expected Polygon instance, got %s instead.') % repr(value)) elif self.geomtype == 'linestring' and not isinstance(value, LineString): raise TypeError(_('Expected LineString instance, got %s instead.') % repr(value))