diff --git a/src/c3nav/editor/static/editor/css/editor.css b/src/c3nav/editor/static/editor/css/editor.css index cc1da825..85e1b2e2 100644 --- a/src/c3nav/editor/static/editor/css/editor.css +++ b/src/c3nav/editor/static/editor/css/editor.css @@ -137,6 +137,11 @@ form button.invisiblesubmit { .change-group tr th small { font-weight:normal; } +.change-group tr th .btn.pull-right { + margin-right: -5px; + margin-top: -2px; + margin-bottom: -3px; +} .change-group tr td:first-child { width:23px; padding-right:0; diff --git a/src/c3nav/editor/templates/editor/changeset.html b/src/c3nav/editor/templates/editor/changeset.html index 31b3c3c1..55c9c484 100644 --- a/src/c3nav/editor/templates/editor/changeset.html +++ b/src/c3nav/editor/templates/editor/changeset.html @@ -16,6 +16,11 @@ + {% if group.edit_url %} + + {% trans 'Edit' %} + + {% endif %} {% if group.obj_title %} {{ group.obj_title }} ({{ group.obj }}) {% else %} diff --git a/src/c3nav/editor/views.py b/src/c3nav/editor/views.py index 97aa27b2..dac35e03 100644 --- a/src/c3nav/editor/views.py +++ b/src/c3nav/editor/views.py @@ -377,11 +377,26 @@ def changeset_detail(request, pk): obj_desc = _('%(model)s #%(id)s') % {'model': obj.__class__._meta.verbose_name, 'id': pk} if is_created_pk(pk): obj_desc = _('%s (created)') % obj_desc + obj_still_exists = int(pk[1:]) in changeset.created_objects[obj.__class__] + else: + obj_still_exists = pk not in changeset.deleted_existing[obj.__class__] + + edit_url = None + if obj_still_exists and changeset == request.changeset: + reverse_kwargs = {'pk': obj.pk} + if hasattr(obj, 'level'): + reverse_kwargs['level'] = obj.level_id + elif hasattr(obj, 'space'): + reverse_kwargs['space'] = obj.space_id + edit_url = reverse('editor.'+obj.__class__._meta.default_related_name+'.edit', kwargs=reverse_kwargs) + grouped_changes.append({ 'model': obj.__class__, + 'model_title': obj.__class__._meta.verbose_name, 'obj': obj_desc, 'obj_title': obj.title if obj.titles else None, 'changes': changes, + 'edit_url': edit_url, }) last_obj = obj